Fix/typed image atomic int64 #705
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/705"
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?
Imported from Marvisak/VIctory. Originally posted by Abhishek-Sood on 2026-11-24T07:08:07Z.
No description provided.
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T07:41:58Z.
Review: APPROVED
Tested and verified on Windows 11 MSVC (Rust 1.98.1). \image_atomics_64_bit_lower_with_typed_int64_flag\ passes along with the full 70 unit tests in \ictory-shader.
Imported from Marvisak/VIctory. Originally posted by Abhishek-Sood on 2026-11-24T07:15:19Z.
The change adds 64-bit typed-image atomic lowering, including arithmetic, bitwise, min/max, swap, and compare-exchange operations. It also handles packing and unpacking 64-bit values across VGPR pairs, adds the required DXIL feature flags, and includes a regression test for the new lowering path.
What this change does
Adds lowering for 64-bit typed image atomic operations: add, subtract, bitwise operations, min/max, swap, and compare-exchange.
Packs pairs of 32-bit VGPR values into DXIL 64-bit integers and splits returned values back into register pairs.
Declares the required 64-bit integer and typed-resource atomic feature flags.
Adds a shader-lowering regression test covering the 64-bit typed-image atomic path.
Files changed
crates/victory-shader/src/emit/lower.rs — 64-bit value packing and typed-image atomic lowering.
crates/victory-shader/src/emit/shader.rs — required shader feature-flag mapping.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T08:04:03Z.
Review: COMMENTED
Heads-up: this no longer merges cleanly with current main (
7374bfb) — textual conflict incrates/victory-shader/src/emit/lower.rs. Needs a rebase.Head itself is green on macOS 26 arm64, rustc 1.98.1 (
cargo test -p victory-shader: 57 passed / 0 failed against its own base, +1 ungated test).Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T09:05:27Z.
Review: APPROVED
Re-checked after the rebase: merges cleanly with current main (
8e79c80), andcargo test -p victory-shader --lockedon macOS arm64 / rustc 1.98.1 → 71 passed / 0 failed (1 ignored, the Windows-only execution suite).Static pass on the lowering: the
dmask/cmpswapwidth table ((1,false)|(3,true)→ 32-bit,(3,false)|(0xF,true)→ 64-bit, anything else refused) is consistent,pack64zero-extends both dwords before the shift/or, and the newATOMIC_INT64_ON_TYPED_RESOURCEflag maps to SFI feature bit0x40_0000alongside the existingINT64→0x8000path. Refusing unsupported widths instead of silently truncating is the right call.Windows-side execution (the
valu_tests/image_testssuites and the DXIL validator) is covered by the new CI; nothing in the diff is macOS-visible beyond the unit tests above.Imported from Marvisak/VIctory. Originally posted by justr4mzi on 2026-11-24T09:06:51Z.
Tested PR #705 (
92ed309d) on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2), Rust 1.98.1 (x86_64-pc-windows-msvc), anddxil.dllfrom Windows SDK10.0.26100.0, againstmain(02f404e) as negative control.victory translate --validate(full game shader set, 26,599 containers / 26,148 programs)64-bit image atomicrefusalsFlags must match usage.validator errorsmain(02f404e, negative control)92ed309)emit: a 64-bit image atomicrefusals are cleared, emitting 520 extra programs (518 VS/PS + 2 CS; the remaining 133 programs advance to downstream refusals such asscalar memory read as data604 -> 708 andbarycentrics read directly13 -> 36).dxil.dllvalidation withvalidator: error: Flags must match usage., resulting in +0 validated shaders (12,160VS/PS and1,417CS unchanged).crates/victory-shader/src/emit/shader.rsin92ed309: the PR setsATOMIC_INT64_ON_TYPED_RESOURCE(1 << 27/SFI00x40_0000), but programs accessing UAVs throughResourceDescriptorHeap[]also require the heap-resource int64 atomic flag (1 << 32/SFI00x1000_0000). Note also that92ed309includes#696and#706in its branch history ahead of currentmain(02f404e).Build and checks
cargo clippy -p victory-shader --lib: clean.cargo xtask policy:152 files ok.cargo build --release -p victory: succeeded.cargo test -p victory-shader -- --test-threads=1and--all-targets: failed to compile test target on pre-existingmainissue#719(lowers(&words)missingrsrc2argument atlower.rs:7021), unrelated to this PR.AI-assisted analysis and test execution (reviewed locally).
Imported from Marvisak/VIctory. Originally posted by dcastell1 on 2026-11-24T10:16:26Z.
This does not build on current
main@ffe310e, so it needs a rebase:The PR is based on
8e79c80;resource::trackgained the structured-access argument in between (that is #709's subject), so the branch predates it. Nothing else was run.Environment: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.98.1, MSVC 14.44.35207, debug build, patch applied clean. AI-assisted (opencode).
Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-24T11:01:50Z.
Same result as I measured on #539, which covers the same 64-bit image atomics. Over the world's shaders (751 programs dumped from a run into the world, re-translated offline), this PR translates the same 4 extra pixel programs (670/751, none lost). Under vkd3d-proton (dxil-spirv
34f0ff8) all 4 failspirv-val(OpAtomicUMinwith a non-integer result type) unless #177's handle-key change is in as well. Details and numbers in my comment on #539.Setup: RX 9070 XT, RADV (Mesa 26.3.1), CachyOS, vkd3d-proton master
30b0eb9.Imported from Marvisak/VIctory. Originally posted by ErRusso on 2026-11-24T11:19:18Z.
Audit: ✅ Looks good — verified & tested
Reviewed this PR as part of an audit of mergeable PRs.
crates/victory-shader/src/emit/lower.rs+shader.rs(+176/-26). Adds 64-bit typed image atomics:dmask=3→atomicBinOp.i64,dmask=0xF(cmpswap) →atomicCompareExchange.i64, packing/unpacking the value through VGPR pairs via the newpack64/split64helpers. Sets the DXIL feature bitsINT64,ATOMIC_INT64_ON_TYPED_RESOURCE, andATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE.main.image_atomics_64_bit_lower_with_typed_int64_flag→ passed. The test builds both a 64-bit add and cmpswap MIMG shader, lowers them, and asserts all three feature bits are present in the emitted DXIL SFI0 flags..glcold-value handling for the hi dword are handled correctly.compis derived from width (0x105vs0x107), andsubnegates the full i64.No issues found. Nice, well-scoped feature with proper feature-bit declaration.
Imported from Marvisak/VIctory. Originally posted by h0useadv on 2026-11-24T12:36:57Z.
Offline coverage on
mainffe310e(full retail shader pack,victory translate --validate, programs matched one by one): +520 programs validate, 0 newly fail;a 64-bit image atomic653 → 0. #305, #539 and #705 give exactly the same 520 programs, so on coverage they're interchangeable and the choice can rest on review alone. Stacked with #180 and the lane-mask branch from #653: +1,193, 0 regressions. Full table: https://github.com/Marvisak/VIctory/issues/293#issuecomment-7131677641AI-assisted (Claude Code). Counts only, no game data.
Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-24T14:24:17Z.
Verified offline: the class is gone and 518 more programs emit DXIL
Applied the branch's two-file diff on
ffe310e+ local diag changes; same container dump(26,503 containers / 26,084 programs), same host, both runs.
emit: a 64-bit image atomicemit: a scalar memory read as data+518 vertex/pixel programs reaching DXIL is the largest single-patch gain we have measured
offline so far.
One thing to know before merge:
a scalar memory read as datarose by 104. That is the nextfailure being exposed, not a regression — those programs used to stop at the atomic and now
translate far enough to hit something else. It does mean this class (875) becomes the top
remaining blocker once #705 lands, so it is the natural next thing to attack.
Repro:
cargo build --release -p victorythenvictory translate <container dump>; nothingelse in the failure table moved.
Imported from Marvisak/VIctory. Originally posted by dpalacios69 on 2026-11-24T15:07:55Z.
Independent check of the current head
ee037b0on Linux (cargo test -p victory-shader --locked; no GPU). It already containsmain(ffe310e).The tests do not compile.
resource::tracktakes a fourth argument onmain(lanes: Option<&Structured>,resource.rs:147), and one test still calls it with three:error[E0061]: this function takes 4 arguments but 3 arguments were suppliedatcrates/victory-shader/src/emit/lower.rs:7524:23. The other calls in the file already passSome(&st); this one needs the same.cargo clippy -p victory-shader --libis clean.For anyone choosing between the three 64-bit image atomics PRs (#305, #539, #705; they conflict in pairs in
lower.rsandshader.rs), what I could verify statically onffe310e:i64(0x107), and all three set the same two feature bits (1 << 27and1 << 32) under different names: #305ATOMIC_INT64_ON_TYPED_RESOURCE/ATOMIC_INT64_ON_HEAP_RESOURCE, #705..._ON_TYPED_RESOURCE/..._ON_DESCRIPTOR_HEAP_RESOURCE, #539ATOMIC_INT64_TYPED/ATOMIC_INT64_HEAP. None of these exists onmainyet.lower.rs:5707-5708); #705 sets the heap bit only when a heap handle is used (:5580).Only the first point is a defect in this PR; the rest is information for whoever decides the order. AI-assisted; no game data.
Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-24T15:11:34Z.
Useful: the tree you measured is not the tree we measured, which narrows the regression.
Our A/B in this thread ran on
4efabc4(the head at the time), and therecargo test --offline -p victory-shader --libcompiled and ran: 129 passed, 15 failed, 1 ignored.(The 15 failures are all "no SM 6.6 hardware device; skipped" — environmental, this host has no
device available to those GPU numerical tests at that moment, and they are unrelated to #705.)
So
resource::trackstill took three arguments at4efabc4. The arity change to four(
lanes: Option<&Structured>) came in withmain's later commits, and the stale call atlower.rs:7524is wherever #705's branch stopped trackingmain. Rebased onee037b0's base it will need that fourth argument like the other call sites in the file.Our offline numbers (653 → 0, +518 vertex/pixel programs) stand for
4efabc4; they should notchange if the rebase is mechanical, but I have not measured
ee037b0.Imported from Marvisak/VIctory. Originally posted by Abhishek-Sood on 2026-11-24T15:16:51Z.
can anyone tell whats the final benchmarks or the bottlenecks that we are currently encountering or at ? i need some clear info
Imported from Marvisak/VIctory. Originally posted by dpalacios69 on 2026-11-24T15:20:45Z.
@Abhishek-Sood there is no official benchmark yet, but the picture is fairly clear from the README status and the testers' runs in #71. Summary, with the sources:
Where it stands (README, 2026-11-23). Menus, intro video and loading run at 30 fps. The world is reached but frames take 0.5-1.8 s and most of the scene is dark or missing.
Bottlenecks, in order of how much they block:
DEVICE_HUNG). Measured causes: translated loops running to the 2^20 cap (a lowerVICTORY_SHADER_LOOP_LIMITkeeps the run alive: h0useadv, Machad3x), unbounded root SRVs (#493 alone: 19 min in the world vs ~20 s onmainon an RTX 4090), and wave64 compute on 32-lane GPUs (#189). Sunkiller-qc's merge order is the best map of this.4efabc4.For #705 itself, the next step is small: the current head
ee037b0already containsmain, but the test atlower.rs:7524still callsresource::trackwith 3 arguments (it takes 4 now,resource.rs:147), socargo test -p victory-shaderdoesn't compile. PassingSome(&st)like the other calls fixes it. #305 and #539 cover the same ground and conflict with yours, so it may be worth asking which one the maintainer wants to land.AI-assisted; no game data.
Imported from Marvisak/VIctory. Originally posted by muhammed-aksoy on 2026-11-24T17:16:28Z.
I tested
ee037b0on Windows 11 with Rust 1.98.1 and the Windows SDK DXIL validator. With the following test-fixture change incrates/victory-shader/src/emit/lower.rs, the serial shader suite passed 121 tests, with zero failures and one ignored.Nonepreserves the original fixture's tracking behavior. This run used synthetic inputs. AI-assisted.Imported from Marvisak/VIctory. Originally posted by alexdeliu on 2026-11-24T17:24:09Z.
Merged onto
main@ffe310eb, this PR (ee037b0c) no longer compiles its tests.crates/victory-shader/src/emit/lower.rs:7524callsresource::trackwith 3 arguments. Since6638098cit takes a 4th,lanes: Option<&Structured>; main's tests passSome(&st)withlet st = structure::structure(&p).unwrap();.Checked with CI's steps (both clippy runs with
-D warnings,cargo test --workspace) on Windows 11, AMD RX 9070. Every open PR: https://gist.github.com/alexdeliu/ef9ef0ebc1776ff104b5aa8eaea18e87Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:27:55Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Empty description; the same 64-bit image atomics as #305, which are in main.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed