Skip to content

perf(llvm): emit proven nonnull and align for kernel refs - #1244

Merged
nihalpasham merged 3 commits into
NVIDIA:mainfrom
uurl:perf/kernel-reference-validity-attrs
Sep 15, 2026
Merged

nihalpasham merged 3 commits into
NVIDIA:mainfrom
uurl:perf/kernel-reference-validity-attrs

Conversation

@uurl

@uurl uurl commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What this fixes

Emit nonnull and align for kernel reference parameters when typed Rust layout facts and the host launch packet establish those guarantees. This completes the currently unblocked portion of #1098.

Shape of the fix

  • Carry reference kind and alignment through MIR and the existing argument mapping.
  • Check nonempty device addresses before enqueue. Null or insufficiently aligned pointers panic at the shared packet boundary.
  • Give empty and zero-sized slices an aligned, non-null sentinel.
Rust reference -> typed layout fact -> kernel pointer -> LLVM attribute
                                             ^
                                  checked host launch packet

Guardrails

Validation

@nihalpasham
nihalpasham force-pushed the perf/kernel-reference-validity-attrs branch from 5db8942 to 969548a Compare September 15, 2026 06:07
@nihalpasham nihalpasham added codegen Device code-generation pipeline (Rust MIR to IR to PTX) host-apis Host-side runtime APIs (cuda-host, cuda-core, cuda-async) llvm-export Textual LLVM/NVVM IR exporter (llvm-export crate) maintainer-owned labels Sep 15, 2026

@nihalpasham nihalpasham left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and validated c5e94c51: ready after maintainer repair.

  • Kept the typed reference facts and added the host-side alignment check before enqueue.
  • Empty/ZST slices retain their aligned sentinel; sync and both async routes share the guarantee.
  • The example now runs on GPU. Metadata naming and example pins also pass their CI guards.
align 8192 required + address 0x1000 -> reject before launch
empty/ZST slice                    -> aligned packet sentinel

Workspace/example checks, native and legacy/modern NVVM, GPU memcheck and all seven hosted workflows pass. Author/DCO are preserved and commits are signed. This partially addresses #1098; broader alias attributes remain open.

@nihalpasham
nihalpasham merged commit 7ce30ec into NVIDIA:main Sep 15, 2026
54 checks passed
@uurl
uurl deleted the perf/kernel-reference-validity-attrs branch September 16, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen Device code-generation pipeline (Rust MIR to IR to PTX) host-apis Host-side runtime APIs (cuda-host, cuda-core, cuda-async) llvm-export Textual LLVM/NVVM IR exporter (llvm-export crate) maintainer-owned

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants