Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ jobs:
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
export RUSTDOCFLAGS=-Dwarnings
cargo doc --workspace --all-features --document-private-items --no-deps \
--exclude cust_raw
cargo doc --workspace --all-features --document-private-items --no-deps
'

- name: Normalize build artifacts ownership
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
- name: Check documentation
env:
RUSTDOCFLAGS: -Dwarnings
run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude cudnn --exclude cudnn-sys --exclude cust_raw
run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude cudnn --exclude cudnn-sys

# Disabled due to dll issues, someone with Windows knowledge needed
# - name: Compiletest
Expand Down
16 changes: 0 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/cust_raw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ build = "build/main.rs"
bindgen = "0.71.1"
bimap = "0.6.3"
cc = "1.2.17"
doxygen-bindgen = "0.1"

[package.metadata.docs.rs]
features = [
Expand Down
13 changes: 0 additions & 13 deletions crates/cust_raw/build/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,6 @@ impl BindgenCallbacks {
}

impl ParseCallbacks for BindgenCallbacks {
fn process_comment(&self, comment: &str) -> Option<String> {
// First replace backslashes with @ to avoid doctest parsing issues
let cleaned = comment.replace('\\', "@");
// Then transform doxygen syntax to rustdoc
match doxygen_bindgen::transform(&cleaned) {
Ok(res) => Some(res),
Err(err) => {
println!("cargo:warning=Problem processing doxygen comment: {comment}\n{err}");
None
}
}
}

fn will_parse_macro(&self, name: &str) -> MacroParsingBehavior {
match self {
Self::WithFunctionRenames {
Expand Down
27 changes: 25 additions & 2 deletions crates/cust_raw/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn main() {
create_cuda_driver_bindings(&sdk, &outdir, &manifest_dir);
create_cuda_runtime_bindings(&sdk, &outdir, &manifest_dir);
create_cublas_bindings(&sdk, &outdir, &manifest_dir);
create_nptx_compiler_bindings(&sdk, &outdir, &manifest_dir);
create_nvptx_compiler_bindings(&sdk, &outdir, &manifest_dir);
create_nvvm_bindings(&sdk, &outdir, &manifest_dir);

if cfg!(any(
Expand Down Expand Up @@ -154,6 +154,20 @@ fn create_cuda_driver_bindings(
.size_t_is_usize(true)
.layout_tests(true)
.must_use_type("CUresult")
// The CUDA docs have lots of malformed Doxygen directives, e.g.
//
// \sa
// Foo,
// Bar
//
// instead of
//
// \sa Foo
// \sa Bar
//
// (And others.) If we try to convert these to rustdoc, even using the doxygen-bindgen
// crate, we end up with rustdocs that trigger lots of warnings. So don't even try.
.generate_comments(false)
.generate()
.expect("Unable to generate CUDA driver bindings.");
bindings
Expand Down Expand Up @@ -192,6 +206,7 @@ fn create_cuda_runtime_bindings(
.allowlist_type("^libraryPropertyType.*")
.allowlist_var("^CU.*")
.allowlist_function("^cu.*")
.no_partialeq("cudaHostNodeParams.*")
.default_enum_style(bindgen::EnumVariation::Rust {
non_exhaustive: false,
})
Expand All @@ -202,6 +217,8 @@ fn create_cuda_runtime_bindings(
.size_t_is_usize(true)
.layout_tests(true)
.must_use_type("cudaError_t")
// See the comment on `generate_comments` in `create_cuda_runtime_bindings`.
.generate_comments(false)
.generate()
.expect("Unable to generate CUDA runtime bindings.");
bindings
Expand Down Expand Up @@ -253,6 +270,8 @@ fn create_cublas_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest
.size_t_is_usize(true)
.layout_tests(true)
.must_use_type("cublasStatus_t")
// See the comment on `generate_comments` in `create_cuda_runtime_bindings`.
.generate_comments(false)
.generate()
.unwrap_or_else(|_| panic!("Unable to generate {pkg} bindings."));
bindings
Expand All @@ -261,7 +280,7 @@ fn create_cublas_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest
}
}

fn create_nptx_compiler_bindings(
fn create_nvptx_compiler_bindings(
sdk: &cuda_sdk::CudaSdk,
outdir: &path::Path,
manifest_dir: &path::Path,
Expand Down Expand Up @@ -293,6 +312,8 @@ fn create_nptx_compiler_bindings(
.size_t_is_usize(true)
.layout_tests(true)
.must_use_type("nvPTXCompileResult")
// See the comment on `generate_comments` in `create_cuda_runtime_bindings`.
.generate_comments(false)
.generate()
.expect("Unable to generate nvptx-compiler bindings.");
bindings
Expand Down Expand Up @@ -326,6 +347,8 @@ fn create_nvvm_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest_d
.size_t_is_usize(true)
.layout_tests(true)
.must_use_type("nvvmResult")
// See the comment on `generate_comments` in `create_cuda_runtime_bindings`.
.generate_comments(false)
.generate()
.expect("Unable to generate libNVVM bindings.");
bindings
Expand Down
Loading