Skip to content

fix(cuda-host): use same-major cubin compatibility - #379

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
niklebedenko:codex/upstream-same-major-cubin-compat
Jul 22, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
niklebedenko:codex/upstream-same-major-cubin-compat

Conversation

@niklebedenko

Copy link
Copy Markdown
Contributor

Closes #378.

Summary

Allow cuda-host to use cubins on newer GPUs within the same compute-capability major version, following NVIDIA's binary compatibility contract. Preserve existing rejection for backward, architecture-suffixed, and unsupported cross-major forwarding.

Before: sm_80 artifact on sm_86 -> IncompatibleExecutionTarget
After:  sm_80 artifact on sm_86 -> Cubin route and successful execution

What changed

Binary-compatible route selection

  • Compare parsed numeric compute-capability major versions after exact-match, suffix, and backward-target checks.
  • Select ExecutionRoute::Cubin when execution has the same major capability and a greater minor capability.
  • Cover both sm_XX and compute_XX input spellings through the shared parser.

Correctness boundaries

  • Preserve newer-to-older rejection, including same-major sm_89 -> sm_86.
  • Preserve architecture-suffix restrictions and the existing cross-major PTX bridge.
  • Pin two-digit (sm_80 -> sm_86) and three-digit (sm_120 -> sm_121) capability encoding.

Known separate limitations

  • This does not add cross-major cubin compatibility.
  • Architecture- and family-suffixed targets retain their existing forwarding policy.
  • PTX bridging from legacy LLVM IR to Blackwell remains unchanged.

Testing

  • cargo oxide fmt --check
  • cargo test -p cuda-host: 61 passed, 1 ignored unit test; 9 cuda_module_api; 13 kernel_family; 6 doctests passed and 8 ignored
  • cargo clippy -p cuda-host --all-targets -- -D warnings
  • cargo oxide run vecadd --emit-nvvm-ir --arch sm_80 on RTX 3080 (sm_86): 1,024/1,024 elements correct
  • CUDA_OXIDE_NO_OPT=1 cargo oxide run vecadd --emit-nvvm-ir --arch sm_80: 1,024/1,024 elements correct
  • Artifact evidence: target sidecar sm_80; executable .oxart section contained OXIDEART, vecadd, sm_80, and vecadd.ll

Reference: https://docs.nvidia.com/cuda/archive/13.2.1/cuda-programming-guide/01-introduction/cuda-platform.html#binary-compatibility

Checklist

  • Branch based directly on current upstream/main
  • Correctness claim covered by focused route tests
  • Unsupported cases fail clearly
  • Optimized and unoptimized GPU behavior verified
  • All commits signed off (git commit -s)
  • Diff contains no fork-only scaffolding

@nihalpasham nihalpasham added bug Something isn't working host-apis Host-side runtime APIs (cuda-host, cuda-core, cuda-async) cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) tests Adds or improves test coverage labels Jul 21, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Thanks for the PR. LGTM.

  • execution_route now allows a cubin to run on a newer GPU within the same compute-capability major, matching NVIDIA's binary compatibility contract.
  • The same-major check sits after the exact-match, architecture-suffix, and backward-rejection guards, so suffixed and backward pairs are still refused.
  • Both consumers (file-artifact and embedded-artifact loading) compile for the emitted arch and load on the execution device, which is exactly the scenario the contract covers.
  • Tests were strengthened alongside: backward rejection is now also pinned within a major (sm_89 -> sm_86).

For example:

sm_80 artifact on sm_86 -> Cubin route (same major, newer minor)
sm_86 artifact on sm_80 -> rejected (backward)
sm_90a artifact         -> rejected (architecture-suffixed)

Reviewer note: The predicate was verified against the CUDA Programming Guide's documented rule, and all 61 cuda-host lib tests passed at the head commit. All hosted CI checks passed. One known boundary: numeric major grouping treats sm_101 (Thor) as same-major with sm_10x, where the PTX ISA family tables disagree; exposure is negligible because target validation already restricts sm_101 pairings, and the worst case is a driver load error, not a miscompile.

This closes #378.

@nihalpasham
nihalpasham merged commit a2c2b24 into NVIDIA:main Jul 22, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) host-apis Host-side runtime APIs (cuda-host, cuda-core, cuda-async) tests Adds or improves test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cuda-host rejects binary-compatible cubins on newer same-major GPUs

2 participants