feat(cuda-module): expose concrete kernel signatures - #1252
Conversation
Let #[kernel] declarations mark immutable reference parameters as grid constants, derive the generated host launch ABI from the same declaration, and carry pointee layout through MIR and LLVM lowering. Emit LLVM byval alignment and NVVM grid_constant metadata, with compiler and SM120 contract coverage. Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>
There was a problem hiding this comment.
Reviewed draft 64333820: changes requested on the metadata changes.
- Scalar identity cannot come from the identifier text:
type f32 = u32;
kernel(value: f32)
launcher: u32 descriptor: F32
- Use resolved type identity, or opaque metadata where identity is unproven. Equal-size aliases also fail, so a size check is insufficient.
- Preserve lifetime scope and distinct names:
PhantomData<&'a ()>andstep/STEPcompile on the parent but fail with the new module constants. - Keep the draft blocked on #1225, and sign/complete DCO on the revised stack.
Ordinary host/macro tests pass; independent host-only controls confirm these three boundaries. #1251 remains partial.
Integrate current main to retain the merged grid-constant ABI and launch safety fixes. Keep ambiguous scalar spellings opaque, erase function lifetimes only for host layout queries, and preserve case in generated signature names. Signed-off-by: nihalpasham <nihalp@nvidia.com>
nihalpasham
left a comment
There was a problem hiding this comment.
I fixed the metadata blockers in 54afbfa4 and brought the branch onto the merged #1225 implementation:
- Ambiguous scalar names now report opaque layout metadata. Qualified
core::primitive/std::primitivepaths retain their scalar identity, so a shadowedf32cannot be reported as a float. - Lifetime-only signatures retain valid layout queries.
- Generated signature names preserve case;
stepandSTEPno longer collide. - Added semantic regressions for aliases, lifetimes, raw names, configuration and nested modules.
The host and macro suites pass with default and all features, along with strict Clippy and formatting. The remaining diff is metadata only; current grid-constant ABI and unsafe launch contracts are preserved. This is a partial answer to #1251, not a complete device ABI or a safe dynamic launch binder.
There was a problem hiding this comment.
I fixed the metadata blockers in 54afbfa4 and brought the branch onto the merged #1225 implementation:
- Ambiguous scalar names now report opaque layout metadata. Qualified
core::primitive/std::primitivepaths retain their scalar identity, so a shadowedf32cannot be reported as a float. - Lifetime-only signatures retain valid layout queries.
- Generated signature names preserve case;
stepandSTEPno longer collide. - Added semantic regressions for aliases, lifetimes, raw names, configuration and nested modules.
The host and macro suites pass with default and all features, along with strict Clippy and formatting. The remaining diff is metadata only; current grid-constant ABI and unsafe launch contracts are preserved. This is a partial answer to #1251, not a complete device ABI or a safe dynamic launch binder.
At 54afbfa4, hosted tests, lint/format checks, guards, docs/book and example compilation passed. CodeQL was still running at the final review check.
What this adds
Expose static host metadata for concrete kernel entries: PTX entry name, ordered source arguments and the carriers used by generated launchers.
A kernel named
stepexportsstep_CUDA_SIGNATURE. Constants retain the kernel's visibility and configuration, and nested modules keep their own metadata.What we fixed
::core::primitiveand::std::primitivepaths retain scalar identity.Verification
At
54afbfa4, hosted tests, lint/format checks, guards, docs/book and example compilation passed. CodeQL was still running at the final review check.Scope
Descriptors cover concrete entries and host launch carriers. They do not describe the complete device ABI or prove that a dynamic launch is safe. Generic entry registries and launch binders remain separate work.
Two inherited merge commits (
f3850f30,e918d680) still lack DCO trailers. Their sign-off history needs resolving before landing; the new maintainer commit is signed off.Partially addresses #1251.