Skip to content

test(codegen): cover address-space 3 aggregate device-call round trips - #867

Merged
nihalpasham merged 2 commits into
NVIDIA:mainfrom
uurl:test/as3-aggregate-device-call-roundtrip
Aug 14, 2026
Merged

nihalpasham merged 2 commits into
NVIDIA:mainfrom
uurl:test/as3-aggregate-device-call-roundtrip

Conversation

@uurl

@uurl uurl commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #866

Summary

Adds explicit regression coverage for shared-memory (addrspace(3)) pointers crossing device-call boundaries inside aggregate values.

The test extends addressof_sharedarray with non-inlined device helpers that round-trip aggregates containing shared pointers through both argument and return ABIs.

Covered aggregate shapes:

  • struct
  • tuple
  • array
  • enum

What this tests

Each case exercises the following path:

AS3 pointer
    ↓
aggregate construction
    ↓
device-call argument ABI
    ↓
callee
    ↓
aggregate return ABI
    ↓
aggregate projection
    ↓
shared-memory access

The returned pointer is used for an actual shared-memory operation, so the test verifies that the pointer remains usable as an AS3 pointer after the complete round trip.

#[inline(never)] is used on the helper functions to preserve the call boundary.

Result

All four aggregate forms already work with the current lowering, so this PR contains no compiler changes. It only adds regression coverage for the existing behavior.

Validation

cargo fmt --check

PASS.

cargo clippy \
  -p dialect-mir \
  -p mir-importer \
  -p mir-lower \
  --all-targets -- -D warnings

PASS.

cargo oxide run addressof_sharedarray

PASS.

CUDA_OXIDE_NO_OPT=1 cargo oxide run addressof_sharedarray

PASS.

Runtime coverage confirms that struct, tuple, array, and enum device-call round trips preserve shared pointers correctly.

The existing raw shared-array receiver regression also continues to pass.

@uurl
uurl force-pushed the test/as3-aggregate-device-call-roundtrip branch from ee8b975 to d1a4918 Compare August 13, 2026 05:57
@nihalpasham nihalpasham added enhancement New feature or request codegen Device code-generation pipeline (Rust MIR to IR to PTX) labels Aug 14, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Gist: test-only, and it checks the part that matters: shared-memory (addrspace(3)) pointers packed inside struct, tuple, array, and enum aggregates round-trip through #[inline(never)] device-call argument and return ABIs, and each returned pointer is then used for a real shared-memory access, so usability after the round trip is proven rather than assumed. Closes #866.

Verified here:

  • ran on an RTX 5090 (sm_120): addressof_sharedarray PASS in both optimization modes, including the four new round-trip lanes and the raw-receiver check;
  • clean merge with current main.

Landing once CI is green.

@nihalpasham nihalpasham changed the title test(codegen): cover AS3 aggregate device-call round trips test(codegen): cover address-space 3 aggregate device-call round trips Aug 14, 2026
@nihalpasham
nihalpasham merged commit 5021256 into NVIDIA:main Aug 14, 2026
44 checks passed
@uurl
uurl deleted the test/as3-aggregate-device-call-roundtrip branch August 14, 2026 06:00
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) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(codegen): add AS3 aggregate device-call round-trip coverage

2 participants