Skip to content

feat: add dp4a/dp2a end-to-end GPU example (sm_61+) - #282

Merged
nihalpasham merged 2 commits into
NVIDIA:mainfrom
honeyspoon:upstream-dotprod-example
Jun 28, 2026
Merged

nihalpasham merged 2 commits into
NVIDIA:mainfrom
honeyspoon:upstream-dotprod-example

Conversation

@honeyspoon

@honeyspoon honeyspoon commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #275; adds the GPU-verified example the maintainer noted as still owed.

  • Single-thread kernel exercises all four dot-product intrinsics: dp4a_s32, dp4a_u32, dp2a_s32, dp2a_u32
  • Host packs known byte/half-word values, launches, and asserts exact results
  • Graceful skip on sm < 61 (dp4a/dp2a require Pascal+)

Test plan

  • cargo oxide run dotprod on sm_61+ GPU -- all four results match expected values
  • Verify PTX contains dp4a.s32.s32, dp4a.u32.u32, dp2a.lo.s32.s32, dp2a.lo.u32.u32 instructions

Part of #274

@honeyspoon
honeyspoon force-pushed the upstream-dotprod-example branch from de3f7bb to 805a22d Compare June 24, 2026 13:33
@honeyspoon
honeyspoon force-pushed the upstream-dotprod-example branch from 805a22d to 901c3e4 Compare June 26, 2026 17:31
honeyspoon and others added 2 commits June 28, 2026 08:26
Follow-up to NVIDIA#275, adds the GPU-verified example noted as owed.

Part of NVIDIA#274

Signed-off-by: abder <[email protected]>
@nihalpasham
nihalpasham force-pushed the upstream-dotprod-example branch from 901c3e4 to 9942983 Compare June 28, 2026 03:12
@nihalpasham nihalpasham added enhancement New feature or request intrinsics Device intrinsics and libdevice math mappings cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) tests Adds or improves test coverage examples Example kernels and host harnesses under crates/rustc-codegen-cuda/examples labels Jun 28, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Thank you for adding the promised end-to-end dot-product example. The operand choices and worked calculations make the signed and unsigned behavior easy to audit.

I added the standalone lockfile and made the sm_61 target explicit in the run command. The example compiles cleanly, emits all four expected PTX instructions, and its calculations match the instruction semantics.

@nihalpasham
nihalpasham merged commit 0d91d52 into NVIDIA:main Jun 28, 2026
26 checks passed
@honeyspoon
honeyspoon deleted the upstream-dotprod-example branch June 30, 2026 01:47
meefs pushed a commit to meefs/cuda-oxide that referenced this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) enhancement New feature or request examples Example kernels and host harnesses under crates/rustc-codegen-cuda/examples intrinsics Device intrinsics and libdevice math mappings tests Adds or improves test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants