Repository navigation
ci: cover the device-only kernel build that #702 made possible - #844
Merged
Merged
Conversation
NVIDIA#702 put the generated host surface behind a default-on `host` feature, so a crate that only compiles kernels can take `cuda-macros = { default-features = false }` and stop pulling cuda-host -> cuda-core -> cuda-bindings -> `cuda.h`. That is what NVIDIA#701 asked for, and it works today -- but nothing exercises it. No example takes that configuration, and every CI lane that builds a kernel crate installs the toolkit, so the whole point of the feature was reachable only by a user who tried it. The regression direction is quiet as well. Proc-macro features unify per build graph, so one crate enabling `cuda-macros/host` makes every crate expanding these macros get the host-emitting expansion -- including one that asked for `default-features = false` and has no cuda-host to resolve the generated `cuda_host::` paths. cuda-macros' manifest documents that trap; nothing catches it, and it surfaces downstream as E0433 on a path the user never wrote. Adds a fixture crate that exercises both macro entry points which emit host items -- a bare `#[kernel]` (the `CudaKernel` impl) and a `#[cuda_module]` (the loader and launchers) -- and a guard asserting the two properties NVIDIA#701 named: * cuda-host, cuda-core and cuda-bindings are absent from the resolved graph, read from `cargo metadata` rather than the manifest so an indirect reacquisition counts; * it type-checks with the CUDA environment variables unset. The CI job deliberately installs no toolkit, since a toolkit on the runner would mask the dependency the job exists to keep out. The fixture carries its own `[workspace]` and is not a root member, so the root `cargo metadata` still resolves 25 packages and no existing lane builds it. Verified: guard passes on a clean tree (8-package host-free graph) and exits 1 under four mutations -- `default-features` dropped, cuda-host added back, `#[cuda_module]` removed from the fixture, and the fixture made not to compile. All eight fast guards still pass. Signed-off-by: Vyncint Ng <[email protected]>
Collaborator
|
Gist: covers the device-only, no-default-features build that #702 made possible and nothing guarded since. The out-of-workspace fixture is the correct mechanism here: cargo-hack cannot express it because cuda-macros dev-depends on cuda-host, which feature-unification turns back on even under Verified here:
After this lands, #701 can be closed manually: #702 fixed the behavior, this adds the coverage that was the thread's one live item. Landing once CI is green. |
nihalpasham
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following up on my comment on #701, where I offered to add this.
The gap
#702 put the generated host surface behind a default-on
hostfeature, so a crate that only compiles kernels can takecuda-macros = { default-features = false }and stop pulling cuda-host → cuda-core → cuda-bindings →cuda.h. It works today — I verified it before commenting. Nothing exercises it. No example takes that configuration, and every CI lane that builds a kernel crate installs the toolkit, so the whole point of the feature was reachable only by a user who tried it.The regression direction is quiet too. Proc-macro features unify per build graph, so one crate enabling
cuda-macros/hostmakes every crate expanding these macros get the host-emitting expansion — including one that asked fordefault-features = falseand has no cuda-host to resolve the generatedcuda_host::paths. cuda-macros' own manifest documents that trap; nothing catches it, and it surfaces downstream as E0433 on a path the user never wrote.The change
A fixture crate exercising both macro entry points that emit host items — a bare
#[kernel](theCudaKernelimpl) and a#[cuda_module](the loader and launchers) — plus a guard asserting the two properties #701 named:cuda-host,cuda-coreandcuda-bindingsare absent from the resolved graph. Read fromcargo metadata, not the manifest, so an indirect reacquisition counts.CUDA_HOME/CUDA_TOOLKIT_PATH/CUDA_TOOLKIT_TARGET_DIRunset.The CI job deliberately installs no toolkit — a toolkit on the runner would mask exactly the dependency the job exists to keep out.
The fixture carries its own
[workspace]and is not a root member, so the rootcargo metadatastill resolves 25 packages and no existing lane builds it.Verified
Clean run reports an 8-package host-free graph. Exits 1 under four mutations:
default-features = falsedroppedcuda-hostadded back as a dependency#[cuda_module]removed from the fixtureAll nine fast guards pass on the merged tree, and
just --listrenders with the new recipe wired intocheck-guards. No GPU, no toolkit, no backend build.