Skip to content

fix(cuda-bindings): preserve complete struct layouts with libclang 22 - #1684

Merged
elibol merged 4 commits into
NVIDIA:mainfrom
elibol:fix/bindgen-clang22-layouts
Oct 31, 2026
Merged

elibol merged 4 commits into
NVIDIA:mainfrom
elibol:fix/bindgen-clang22-layouts

Conversation

@elibol

@elibol elibol commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Older bindgen can emit a one-byte placeholder instead of the fields of a forward-declared C struct when using libclang 22. This produces incorrect CUDA bindings and failing layout checks. Upgrade cuda-bindings to bindgen 0.72.1, which includes the upstream type-completeness fix in rust-lang/rust-bindgen#3278.

The regression test uses a self-contained C typedef chain and verifies that both fields of the completed struct survive binding generation. With bindgen 0.69.5 and libclang 22 it fails because only _address is emitted; with 0.72.1 it passes. It runs as part of the existing cuda-bindings test suite. Use libclang 22 to exercise the original failure.

The large diff is generated lockfile maintenance: 263 affected workspace/example lockfiles now resolve the updated shared bindings dependency. Package additions are limited to the new bindgen and its required rustc-hash version; obsolete transitive dependencies disappear. Archived benchmarks that use separately published crates are unchanged.

Validation:

  • The regression fails with bindgen 0.69.5/libclang 22 and passes with 0.72.1/libclang 22.
  • Full cuda-bindings tests pass, including a CUDA 13.3/libclang 21 compatibility run. Bindgen now emits compile-time layout assertions, so validation includes compiling the generated bindings rather than filtering for old runtime layout-test names.
  • Shared-host workspace all-target checks, Tile all-target checks, 108 SIMT host tests, and SIMT codegen/Cargo frontend checks pass.
  • All 263 updated lockfiles resolve with --offline --locked; the example lockfile consistency gate also passes after aligning six existing rustc-hash pins with the other examples; dependency policy checks pass for the host, Tile, SIMT, backend, and device-only workspaces.
  • Formatting, strict bindings Clippy, license inventory, shared-crate pin, and SPDX checks pass.
  • The new binding-generation regression remains required in the CPU/build suite, which passes with libclang 22 (15 tests; two live-driver cases filtered). The archive-only GPU runner excludes that one compiler-dependent test because its image has no libclang. Reproduced the unfiltered failure in the CI CUDA 13.3.0 image, then verified all 16 runtime tests pass with the corrected filter, including live CUDA/cuRAND.
  • The head includes merged fix(cutile): validate full tensor shapes before allocation #1452; its five shape unit tests and three GPU regressions pass on the combined branch.

Target: cuTile Rust v0.5.0.

@elibol

elibol commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator Author

Merging now that CI is green; changes under cuda-oxide/ are limited to lockfiles.

@elibol
elibol merged commit 2d47e43 into NVIDIA:main Oct 31, 2026
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant