Skip to content

cuda-oxide: preserve rustc reference attributes on kernels - #1483

Merged
nihalpasham merged 2 commits into
mainfrom
feat/cudaoxide-reference-attrs
Oct 11, 2026
Merged

nihalpasham merged 2 commits into
mainfrom
feat/cudaoxide-reference-attrs

Conversation

@nihalpasham

@nihalpasham nihalpasham commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Use rustc's noalias and proven dereferenceable(N) facts on cuda-oxide kernel references. This lets LLVM reuse input reads across writes to separate outputs.

Raw pointers and DisjointSlice storage receive no new attributes. Rust's interior-mutability, pinning, and lifetime rules still apply. Explicit readonly is deferred because current NVPTX backends can lose volatile reads.

Includes regression tests, corrected atomic example pointer contracts, and load-width checks that accept cached loads.

Validation: compiler/backend suites and strict checks pass; reference launches pass memory, race, and synchronization checks on both RTX 5090s. LLVM and both NVVM paths preserve two volatile reads while combining ordinary reads. Final hosted CI is pending.

The existing FP8 failure is handled by #1487. The existing AtomicF16 sanitizer failure remains a separate follow-up.

Partially addresses #1088 and #1098.

Checklist

  • All commits signed off
  • SPDX headers on new source files

@nihalpasham nihalpasham added the cuda-oxide SIMT programming model: rustc backend, cargo oxide, cuda-device, cuda-host, book label Oct 11, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 11, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

nihalpasham added a commit that referenced this pull request Oct 11, 2026
Update CUDAoxide from `nightly-2026-08-28` to `nightly-2026-10-11`. This
brings in rust-lang/rust#163242, needed for the separate kernel
parameter-attribute work in #1483 (related to #1088 and #1098).

## Changes

- Adapt to rustc API changes, generic floating-point intrinsics, and
integer min/max.
- Follow the new `core::intrinsics::reflection::type_id` path in the
kernel-name helper.
- Update toolchain/Nix pins, diagnostic snapshots, and intrinsic
evidence. Intrinsic declarations are unchanged.

## Validation

- CI: 55 passed, 7 expected skips; all 234 examples compile.
- Compiler tests, formatting, clippy, and IR comparison pass. Targeted
checks pass on both RTX 5090s with no memcheck errors.
- GPU sweep: 232/233 passed. The existing FP8 example failure is
addressed separately in #1487; hardware-limited cases retain
compile-only coverage.

The existing scaffold issue—mixing registry and Git runtime types—also
remains a separate follow-up.

## Checklist

- [x] All commits signed off
- [x] SPDX headers on new source files, where applicable

---------

Signed-off-by: nihalp <nihalp@nvidia.com>
Signed-off-by: nihalp <nihalp@nvidia.com>
@nihalpasham nihalpasham added codegen Device code-generation pipeline (Rust MIR to IR to PTX) llvm-export Textual LLVM/NVVM IR exporter (llvm-export crate) IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) enhancement New feature or request labels Oct 11, 2026
@nihalpasham
nihalpasham changed the base branch from feat/cudaoxide-nightly-2026-10-11 to main October 11, 2026 12:09
@nihalpasham
nihalpasham force-pushed the feat/cudaoxide-reference-attrs branch from f29b204 to d3a4a58 Compare October 11, 2026 12:09
@nihalpasham nihalpasham added the needs-changes Review found changes required before this PR can land label Oct 11, 2026
Defer explicit readonly while retaining rustc noalias and whole-call dereferenceability. Check volatile accesses and ordinary load reuse through actual code generation. Correct atomic example pointer contracts and accept valid cached vector loads.

Signed-off-by: nihalp <nihalp@nvidia.com>
@nihalpasham nihalpasham removed the needs-changes Review found changes required before this PR can land label Oct 11, 2026
@nihalpasham
nihalpasham marked this pull request as ready for review October 11, 2026 13:14
@nihalpasham

Copy link
Copy Markdown
Collaborator Author

I filed LLVM #230960 with a standalone reproducer: noalias readonly makes NVPTX drop volatility, allowing two required reads to become one machine load. It reproduces on LLVM 22.1.8, 23.1.0, and 23.1.3, so it predates the nightly bump.

This PR keeps noalias and proven dereferenceability, defers explicit kernel readonly, and tests that both volatile reads survive. It still partially addresses #1088 and #1098.

@nihalpasham
nihalpasham merged commit d141118 into main Oct 11, 2026
60 checks passed
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) cuda-oxide SIMT programming model: rustc backend, cargo oxide, cuda-device, cuda-host, book enhancement New feature or request IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) llvm-export Textual LLVM/NVVM IR exporter (llvm-export crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant