Shaders: 64-bit texture atomics as one i64 atomic #2241
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2241
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2241"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@FoxxoOwO on GitHub · 2026-11-25 08:35 UTC · original
FoxxoOwO:shader/64-bit-image-atomics→main· +265 −9 · 1 files · 1 commits · closed without mergingThe console's MIMG image_atomic instructions with
dmask3 (or 0xF for cmpswap) carry two data dwords: the low and high halves of an i64. Previously they lowered to two separate 32-bit atomics, so a carry from the low dword was lost. Now they lower to one i64 atomic on an R32G32 integer texture UAV (SM 6.6).Changes:
emit/lower.rs:fn image()detects width fromdmask, builds an i64 atomic withjoin64/split64, and emitsatomicBinOp.i64/atomicCompareExchange.i64(dx.op 78/79). Handle props stay(kind | 0x1000, 0x105)as the 32-bit path used.emit/shader.rs: new module flagsATOMIC_INT64_ON_TYPED_RESOURCE = 1 << 27andATOMIC_INT64_ON_HEAP_RESOURCE = 1 << 32; SFI0 feature bits 22 and 28 mapped.emit/host.rs:View::Uint2TextureUav(R32G32_UINT) added; one arm handles both U32 and U64 texture UAVs, format and pitch chosen bywords(1/2).emit/valu_tests.rs: helperss_load_dwordx8,s_load_dwordx4_at,image_atomic64; builderbuild_atomic_cs+ runnerrun_atomic_cases; testswide_image_atomic_add(add with carry) andwide_image_atomic_cmpswap(compare-exchange); both run on hardware and WARP.Validator errors fixed: "Flags must match usage" (missing bits 27/32) then "Container part 'Feature Info' does not match" (missing SFI0 bits 22/28). Authoritative table: llvm/include/llvm/BinaryFormat/DXContainerConstants.def SHADER_FEATURE_FLAG(sfi0, module, name) — 22/27 AtomicInt64OnTypedResource, 28/32 AtomicInt64OnHeapResource.
Not exercised: signed/unsigned min/max i64 atomics (same path, untested).
Rebased onto origin/main
940d32f.@Marvisak on GitHub · 2026-11-25 09:14 UTC · original · edited 2026-11-25 10:23 UTC
Automated triage for the maintainers.
Needs work. Now merges cleanly into
main, but the lowering this PR describes is already inmain. Commit0b35b7fadded the 64-bit image atomics: inemit/lower.rs(the image atomic lowering), a two-dworddmaskbecomes an i64 atomic withATOMIC64_TYPED/ATOMIC64_HEAPandView::Uint2TextureUav. Theimage_atomics_of_64_bitstest invalu_tests.rscovers umax, swap and cmpswap. After the rebase, this PR's diff touches onlyvalu_tests.rs, and the description no longer matches it.To be mergeable:
scalar_quad_masks_pack_nibbles_and_set_scc,a_branch_to_fallthrough_keeps_both_values_at_a_join,v_cvt_off_f32_i4_uses_the_signed_low_nibble).wide_image_atomic_cmpswap, whichimage_atomics_of_64_bitsalready covers.wide_image_atomic_add), whichmaindoes not cover. Ideally build it with the existingimage_atomichelper instead of the new duplicate helpers.CI passes.
Generated by Claude Code
@iGoldenNinja on GitHub · 2026-11-25 09:16 UTC · original
I tested clean head
e2624b3384813a444067fe9ba93dfd131473a63cand its direct parentffe310eb2098e52169f4c44db5ffdabf43a72622on an RTX 5080, driver 617.14, and Windows 11 Pro 25H2 build 26200.9974, using Rust 1.98.1 MSVC anddxil.dll1.9.2609.5.0x8000000000000002and0x7ffffffffffffffedifferently across signed and unsigned operations and verifies the returned old texel in each case. Synthetic fixture patchimage_atomic_umax, the direct parent refused all 168 at emission witha 64-bit image atomic. The PR head emitted and validated 162 and created 162 D3D12 pipelines. Six still refused during emission withbarycentrics read directly. The matched-program check reached offline pipeline creation. Pinned report@sinan-cmyk on GitHub · 2026-11-25 10:37 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
00bd40bbontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@catminou4 on GitHub · 2026-11-25 08:48 UTC · original · reviewed
This PR no longer merges cleanly into main
940d32f69b(git merge origin/mainconflicts locally). Please rebase; I will re-test the 64-bit texture atomics lowering on macOS afterwards (shader lowering/unit tests are the portable part; execution tests are Windows-gated).@FoxxoOwO on GitHub · 2026-11-26 09:42 UTC · original
Split into #3135 with only the add-with-carry test, as the triage asked: the lowering is already on
main(0b35b7f), the rustfmt-only churn and the cmpswap test are dropped, and the test is built with the existingimage_atomic/lower_cs32helpers.Pull request closed