Skip to content

Support PTX ISA 9.5 - #194

Draft
AntonOresten wants to merge 2 commits into
mainfrom
agent/ptx-isa-9.5
Draft

AntonOresten wants to merge 2 commits into
mainfrom
agent/ptx-isa-9.5

Conversation

@AntonOresten

@AntonOresten AntonOresten commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Brings PTX.jl's reviewed surface up to PTX ISA 9.5 (CUDA 13.5).

What changes

Fixes

  • Fabric-read completion. PTX 9.5 defines fabric.wait.sync_restrict::reads as having no effect, so the existing wrapper no longer makes it safe to reuse a source .shared::cta buffer. This adds wrappers for the replacement pair, fabric.submit.commit_group and fabric.wait.sync_restrict::read N (N passed as Val, baked into the asm). The old wrapper is kept for source compatibility, and its comment and docs now say it does nothing.
  • tensormap.query.alloc_class_large. Before this change it rendered under the tensormap.replace sink contract with no .pred destination. It is now typed-wrapper-only (a new TYPED_WRAPPER_ONLY_RULES entry, prefix = (:query,)), with Bool-returning wrappers for generic, .global and .shared::cta pointers. .const and .param are left unwrapped and fail loudly.
  • tensormap.query shared address width. ptxas 13.5 rejects a 32-bit .shared::cta address for the query ("Arguments mismatch for instruction 'mov'") and accepts a 64-bit one; tensormap.replace and mbarrier accept 32-bit. The .shared::cta wrapper passes it as l, as the tensormap.replace chain already does.
  • Special registers. %locality_domain_id and %locality_domain_supplemental_sm (9.5, sm_100+) were rejected as unknown. They are now in the ledger, so the inventory goes from 151 to 153.

Version and inventory

  • The parser's newest known ISA is now 9.5. 9.5 adds no targets or .target options, so the future-version header test now uses .version 9.6.
  • SURFACE.toml:
    • Sections renumbered to match the 9.5 spec (spcompress is now §9.7.10.31, spdecompress §9.7.10.32).
    • New §9.7.10.30 entry for the query. The §9.7.10.29 tensormap entry becomes strict, since it now has a typed-wrapper-only subfamily.
    • New raw-only §9.7.21.6 entry for trace.mark. Its event label needs a module-level .metadata_section, which an inline-asm call can't declare.
    • Notes added for the 9.5 forms that already render through the chain: sin/cos.approx.2pi.ftz.f32, fence.alias.sync_restrict::read.release.sys, cp.async.bulk.wait_group.sync_restrict::proxy::async N, and tensormap.replace with .alloc_class.
  • docs/src/wrappers.md gets a short section on the 9.5 additions.

Evidence

  • New test/host/ptx_isa_9_5.jl checks the asm text and constraints, the Bool/UInt32 result types, the typed-wrapper misses, and the chain forms. The ledger and inventory pins are updated (special registers, the typed-wrapper-only rule set, module headers).

  • Compiling to PTX through LLVM emits the expected 9.5 syntax: tensormap.query.alloc_class_large.global.b1024 %p1, [%rd1];, fabric.wait.sync_restrict::read 1;, mov.u32 %r1, %locality_domain_id;.

  • Full test suite: 246,547 of 246,548 assertions passed locally on GB10. The one failure was a special-register count pin in test/host/codegen.jl; it is fixed in this PR and that file passes on rerun. 5 of 176 test files are skipped by target routing.

  • New test/ptxas/ptx_isa_9_5.jl assembles every bound 9.5 form at its ISA floor and pins the floor with a ptxas rejection one target below: the locality registers, the fabric submit-group pair and the sync_restrict::proxy::async bulk wait at sm_100 (rejected at sm_90); the read-only alias release fence at sm_90 (rejected at sm_80); sin/cos.approx.2pi at sm_75; tensormap.query at sm_90a, sm_100f, sm_110f and sm_120f (rejected at sm_90 and sm_100); and the tensormap.replace .alloc_class forms at sm_90a, sm_100f and sm_120f.

  • Against CUDACore from CUDA.jl main (Support CUDA 13.5 and cuDNN 9.28. JuliaGPU/CUDA.jl#3526 maps ptxas 13.5 to PTX 9.5) with CUDA_Compiler_jll 13.5.37, the host and ptxas suites pass: 245,092 tests across 84 files. The GPU runtime tier has not been run on 13.5.

Not covered: 9.5 assembly in CI

The registered CUDACore (6.5.1) still maps the newest toolchain to PTX 9.4, so CI emits .version 9.4 and test/ptxas/ptx_isa_9_5.jl skips (one @test_skip). Once a CUDACore release includes #3526, bumping test/LocalPreferences.toml to 13.5 turns it on. Bumping it before then gains nothing, because 6.5.1 also restricts CUDA_Runtime_jll to 0.25.

Spec changes that need no code

  • tensormap.replace on .global_address without .alloc_class now resets the allocation class to Small. PTX.jl never emits tensormap.replace itself.
  • The range that must be accessible under .override::global_address is now set by a device attribute instead of a fixed 128 KiB. Nothing in PTX.jl hard-codes 128 KiB.
  • The 9.4 fabric tensor syntax was corrected (.tile, .L2::cache_hint, optional attributeOverrideInfo). Those forms are still unimplemented here.
  • The rest is editorial (the ldmatrix register-count formula, (T,2k)→(T,2) in the canonical layouts, typos) and already matches PTX.jl.

🤖 Generated with Claude Code

PTX 9.5 redefines fabric.wait.sync_restrict::reads as a no-op, so add the
replacement fabric.submit.commit_group / fabric.wait.sync_restrict::read N
wrappers and document the old one as inert. tensormap.query.alloc_class_large
rendered under the tensormap.replace sink contract without its .pred
destination; it is now typed-wrapper-only with Bool-returning wrappers for
generic, .global and .shared::cta pointers. Add %locality_domain_id and
%locality_domain_supplemental_sm to the special-register ledger, raise the
parser's known ISA to 9.5 (9.5 adds no targets or .target options), and
update SURFACE.toml to the 9.5 section numbering, including raw-only
trace.mark.

No 9.5 form is assembled yet: CUDACore maps its newest toolchain to PTX 9.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

ptxas 13.5 rejects a 32-bit .shared::cta address for
tensormap.query.alloc_class_large ("Arguments mismatch for instruction
'mov'") while accepting a 64-bit one, so the shared wrapper now passes it
as `l`, as the tensormap.replace chain already does.

test/ptxas/ptx_isa_9_5.jl assembles every bound 9.5 form at its ISA floor
and pins the floor with a ptxas rejection below it. It skips until the
managed compiler supports ISA 9.5; CUDACore main maps ptxas 13.5 to 9.5
(JuliaGPU/CUDA.jl#3526) but no release carries it yet. Against CUDACore
main with CUDA_Compiler_jll 13.5 the host and ptxas suites pass
(245092 tests). SURFACE.toml and the wrapper docs now describe the
assembly evidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant