Fix/typed image atomic int64 #705
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!705
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/705/head"
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?
@Abhishek-Sood on GitHub · 2026-11-24 07:08 UTC · original
Abhishek-Sood:fix/typed-image-atomic-int64→main· +176 −26 · 2 files · 7 commits · closed without mergingNo description provided.
@Abhishek-Sood on GitHub · 2026-11-24 07:15 UTC · original
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.
@justr4mzi on GitHub · 2026-11-24 09:06 UTC · original
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).
@dcastell1 on GitHub · 2026-11-24 10:16 UTC · original
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).
@pablogonz12 on GitHub · 2026-11-24 11:01 UTC · original
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.@ErRusso on GitHub · 2026-11-24 11:19 UTC · original
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.
@h0useadv on GitHub · 2026-11-24 12:36 UTC · original
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: #293AI-assisted (Claude Code). Counts only, no game data.
@bittertea0323 on GitHub · 2026-11-24 14:24 UTC · original
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.
@dpalacios69 on GitHub · 2026-11-24 15:07 UTC · original
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.
@bittertea0323 on GitHub · 2026-11-24 15:11 UTC · original
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.@Abhishek-Sood on GitHub · 2026-11-24 15:16 UTC · original
can anyone tell whats the final benchmarks or the bottlenecks that we are currently encountering or at ? i need some clear info
@dpalacios69 on GitHub · 2026-11-24 15:20 UTC · original
@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.
@muhammed-aksoy on GitHub · 2026-11-24 17:16 UTC · original
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.@alexdeliu on GitHub · 2026-11-24 17:24 UTC · original
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/ef9ef0ebc1776ff104b5aa8eaea18e87@Marvisak on GitHub · 2026-11-25 00:27 UTC · original
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