Skip to content

Shaders: 64-bit image atomics - #539

Closed
SAitken91 wants to merge 5 commits into
Marvisak:mainfrom
SAitken91:shader/64-bit-image-atomics
Closed

SAitken91 wants to merge 5 commits into
Marvisak:mainfrom
SAitken91:shader/64-bit-image-atomics

Conversation

@SAitken91

Copy link
Copy Markdown
Contributor

Image atomics with two data dwords per value (an R32G32 view) were refused as "a 64-bit image atomic". That was the largest single failure in translate: 653 programs in shaders.rpf, mostly fire, alpha-prepass and visibility passes.

Change

  • image_atomic_* with dmask 0x3 (0xF for cmpswap) now become dx.op.atomicBinOp.i64 / dx.op.atomicCompareExchange.i64 on the same texture UAV. Values are built from the VGPR pair (low dword first). With glc, the returned value is split back into the pair, and lanes the guard skips keep their registers.
  • New shader flags: ATOMIC_INT64_TYPED (bit 27) and ATOMIC_INT64_HEAP (bit 32, set when the descriptor comes from the heap). Their SFI0 bits are 0x400000 and 0x10000000.
  • The flags, SFI0 bits and handle properties match what DXC emits for the equivalent HLSL (RWTexture2D<uint64_t> from ResourceDescriptorHeap with InterlockedMax). DXC tags the handle U32 (0x105), and this does the same.

Results

victory translate --validate shaders.rpf, before → after:

validated
vertex/pixel 12172 → 12690
compute 1670 → 1672

The validator reports no new errors. The remaining 133 of the 653 now stop at other unsupported cases further in, mainly "a scalar memory read as data".

Testing

  • cargo test -p victory-shader: 69 passed. Clippy and rustfmt are clean on the changed files.
  • Host support checked on an RX 6950 XT: AtomicInt64OnTypedResourceSupported (OPTIONS9) and AtomicInt64OnDescriptorHeapResourceSupported (OPTIONS11) are both TRUE.
  • Not yet exercised at runtime in the world. Only validation has been checked. Hosts without these capabilities will fail to create these pipelines. No capability check is added here.

Written with the help of Claude (AI).

🤖 Generated with Claude Code

@jeremygold02

Copy link
Copy Markdown
Contributor

The SDK accepts these shaders on 55bac542, but I found a handle-annotation mismatch before the 64-bit unsigned max. Seven pixel shaders emitted 14 atomicBinOp.i64 UMax calls. At all 14 sites the call reused a RWTexture2D<float4> handle ({4098, 1033}) from a preceding getDimensions on the same heap index. All 14 queried values were unused.

I compiled a reference RWTexture2D<uint64_t> target = ResourceDescriptorHeap[1] with InterlockedMax using Windows SDK 10.0.26100.0 DXC, targeting cs_6_6. Its i64 UMax receives a handle with properties {4098, 261}, printed as RWTexture2D<U32>.

With #589 applied to this exact PR head, all 14 sites used the DXC reference annotation and the unused dimension queries disappeared. On Windows 11 with an RTX 5070 and an R32G32_UINT UAV, five bounded one-thread synthetic dispatches of the combined path returned the expected unsigned 64-bit maxima, including opposing high/low words and bit 63. Every fence completed, the device reported S_OK, and both the neighboring texel and a separate control descriptor retained their initial values. The stock mismatch was checked by SDK validation and disassembly only.

@KoLolX3

KoLolX3 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Check on Linux, not Windows: pass. Head 55bac542c merged onto main d2a4bae1f (clean merge).

  • Native tests of the seven crates that build on Linux (core, formats, game, loader, pe, pipeline, shader): PR 92 passed, 7 failed, main 92 passed, 7 failed.
  • Windows cross type-check of the whole workspace (cargo xwin check --workspace --target x86_64-pc-windows-msvc, covers victory-gpu, victory-hle and the app): PR ok, main ok.
  • Tests this PR adds: 0 (so the native result only shows the existing tests still pass; the change itself is not covered by a test here).
  • rustfmt: unformatted hunks, PR 168, main 168.
  • Failing on main here as well (not this PR): 7 tests in victory-loader and victory-pe that parse their own test binary as a PE image, which is an ELF file on Linux.
  • Not run: victory-gpu / victory-hle tests and the game itself.

On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.

@ghost ghost mentioned this pull request Nov 24, 2026
SAitken91 added a commit to SAitken91/VIctory that referenced this pull request Nov 24, 2026
handle() keys its cache by resource kind only, so an image atomic that
followed a size query of the same view (getDimensions on a float4
handle) reused that handle: the i64 atomic ran on a RWTexture2D<float4>
annotation ({4098, 1033}) instead of DXC's {4098, 261}. Reported by
jeremygold02 on Marvisak#539. The 64-bit path now makes its own heap handle; the
general fix of the cache key is Marvisak#177.

translate --validate on shaders.rpf unchanged (vertex/pixel 12690,
compute 1672).

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

Copy link
Copy Markdown
Contributor Author

Thanks, good catch. Fixed in 29da300: the 64-bit path now makes its own heap handle ({4098, 261}) instead of going through the kind-only handle cache, so a preceding size query can't hand it the float4 annotation. #177 is the general fix of the cache key; with either one, #589's skip stays a separate improvement.

@slint6614-dev

Copy link
Copy Markdown

Measured on the full retail shader pack (26,503 containers) with victory translate --validate --pipelines (pipelines created on an AMD RX 9070, Adrenalin, Windows 11; dxil.dll from SDK 10.0.26100), against main 1f858b0. Counts are emitted / validated / pipelines.

VS/PS CS 64-bit image atomic refusals
main 12272 / 12172 / 12272 1693 / 1670 / 1693 653
#539 12790 / 12690 / 12790 1695 / 1672 / 1695 0
#305 12790 / 12172 / 12790 1695 / 1670 / 1695 0
#589 12272 / 12172 / 12272 1693 / 1670 / 1693 653

@justr4mzi

Copy link
Copy Markdown

Tested PR #539 (29da3005) merged cleanly on current main (02f404e) on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2), Rust 1.98.1 (x86_64-pc-windows-msvc), and dxil.dll from Windows SDK 10.0.26100.0, against main (02f404e) as negative control.

victory translate --validate (26,599 containers / 26,148 programs)

Build VS/PS (emitted / validated) CS (emitted / validated) MS (emitted / validated) 64-bit image atomic refusals Flags must match usage. errors
main (02f404e, negative control) 12,236 / 12,160 1,440 / 1,417 8,163 / 8,101 653 0
PR #539 (29da300 on 02f404e) 12,754 / 12,678 1,442 / 1,419 8,163 / 8,101 0 0
  • All 653 emit: a 64-bit image atomic refusals are cleared, and all 520 newly emitted programs (+518 VS/PS, +2 CS) pass dxil.dll validation with zero Flags must match usage. failures (in contrast to #705 on the same main 02f404e, where all 520 emitted shaders failed DXIL validation on the missing heap atomic flag).
  • The remaining 133 unlocked programs advance cleanly to downstream refusals (scalar memory read as data 604 -> 708, barycentrics read directly 13 -> 36, lane mask read as data 248 -> 253, descriptor read only as data 388 -> 389).

Build and checks

  • Clean merge onto 02f404e (2 files changed in victory-shader: emit/lower.rs, emit/shader.rs).
  • cargo clippy -p victory-shader --lib: clean.
  • cargo xtask policy: 152 files ok.
  • cargo build --release -p victory: succeeded.
  • No game data included; the title itself was not launched.

AI-assisted test execution and comparison (reviewed locally).

@alexander-src alexander-src left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVIDIA Blackwell (--validate --pipelines) verification and code review for 29da300 merged cleanly onto main 8e79c80:

  • Setup: Windows 11 26200, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.98.1 (x86_64-pc-windows-msvc), Windows SDK 10.0.26100.0 dxil.dll.
  • CI checks:
    • cargo clippy --workspace --all-targets --locked -- -D warnings: pass
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: pass
    • cargo test -p victory-shader --locked -- --test-threads=1: 89 passed, 0 failed, 1 ignored
  • Full retail corpus (victory translate --validate --pipelines, 26,599 containers / 26,148 programs):
Build VS/PS (emit / val / PSO) CS (emit / val / PSO) MS (emit / val / PSO) 64-bit image atomic refusals
main 8e79c80 12,236 / 12,160 / 12,236 1,440 / 1,417 / 1,121 8,163 / 8,101 / 8,163 653
main + #539 (29da300) 12,754 / 12,678 / 12,754 (+518) 1,442 / 1,419 / 1,123 (+2) 8,163 / 8,101 / 8,163 0

All 520 newly emitted programs pass dxil.dll validation and create D3D12 PSOs cleanly on RTX 5090 with zero regressions.

Two small edge-case bugs spotted in image_atomic64 (crates/victory-shader/src/emit/lower.rs):

  1. Source::Phi misses ATOMIC_INT64_HEAP. lower.rs:469 only sets flags::ATOMIC_INT64_HEAP for matches!(src, Source::Loaded { .. }), but handle() (lower.rs:3349-3371) also emits self.s.heap_handle(...) for Source::Phi { .. }. Matching Source::Loaded { .. } | Source::Phi { .. } avoids a Flags must match usage validator error if a 64-bit atomic uses a phi-joined heap descriptor.
  2. Guarded cmpswap mixes blocks in pair. pair captures let c = self.cur before self.begin_guarded(guard), and cmpswap calls pair(self, reg + 2) after begin_guarded moves self.cur into the guarded then block. i32_of emits into l.cur (then) for Val::Bit, while pair emits zext/shl/or into c (head), which would violate SSA dominance if a compare word comes from Val::Bit. Using l.cur inside pair (or computing cmp before begin_guarded) fixes it cleanly.

Adding a synthetic unit test covering a 64-bit atomic (including guarded cmpswap) with dxil.dll validation would also lock in both paths.

AI-assisted code review and local verification on this machine; no game data.

SAitken91 and others added 2 commits November 24, 2026 04:01
Image atomics with two data dwords per value (an R32G32 view) were
refused as "a 64-bit image atomic", stopping 653 programs of the
title's shaders.rpf. They now become DXIL's i64 atomicBinOp and
atomicCompareExchange on the same texture UAV, with the shader flags
and SFI0 bits for 64-bit atomics on typed and on heap resources (the
bits DXC sets for the same HLSL). Returned values (glc) are split back
into the VGPR pair.

translate --validate on shaders.rpf: vertex/pixel 12172 -> 12690
validated, compute 1670 -> 1672; no new validator errors. The rest of
the 653 now stop at other unsupported cases further in.

Hosts need AtomicInt64OnTypedResourceSupported (OPTIONS9) and
AtomicInt64OnDescriptorHeapResourceSupported (OPTIONS11); checked on an
RX 6950 XT. Not yet exercised in the world at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
handle() keys its cache by resource kind only, so an image atomic that
followed a size query of the same view (getDimensions on a float4
handle) reused that handle: the i64 atomic ran on a RWTexture2D<float4>
annotation ({4098, 1033}) instead of DXC's {4098, 261}. Reported by
jeremygold02 on Marvisak#539. The 64-bit path now makes its own heap handle; the
general fix of the cache key is Marvisak#177.

translate --validate on shaders.rpf unchanged (vertex/pixel 12690,
compute 1672).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SAitken91
SAitken91 force-pushed the shader/64-bit-image-atomics branch from 29da300 to 909393a Compare November 24, 2026 10:05
…loops

Main's heap_handle now takes whether the index may differ between lanes
(Marvisak#566, waterfall loops over per-lane descriptors). The 64-bit atomic
path builds its own heap handle, so it passes the same answer handle()
does: per lane when the descriptor load belongs to a waterfall loop.

translate --validate on shaders.rpf against main ffe310e: VS/PS
12155 -> 12673, CS 1417 -> 1419; no 64-bit image atomic refusals or
"Flags must match usage" errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e the guard

Two edge cases alexander-src found in image_atomic64 (Marvisak#539 review):

- ATOMIC_INT64_HEAP was set only for Source::Loaded, but handle() makes
  heap handles for Phi, Select, Fetched, Lanes and LanePhi sources too;
  an atomic through one of those would fail "Flags must match usage".
  The flag is now set for every source but a root view (Built).
- A guarded cmpswap built its compare pair after begin_guarded, while
  `pair` writes into the block it captured before the guard: a compare
  word that needs code in the guarded block would be used before it is
  defined. The compare is now built before the guard, like the value.

translate --validate on shaders.rpf unchanged (VS/PS 12673, CS 1419 on
main ffe310e); no 64-bit image atomic or "Flags must match" errors.

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

Copy link
Copy Markdown
Contributor Author

@alexander-src both confirmed and fixed in 719079f:

  1. ATOMIC_INT64_HEAP is now set for every source except a root view (Source::Built) — handle() makes heap handles for Phi, Select, Fetched, Lanes and LanePhi too, not just Phi.
  2. The cmpswap compare pair is built before begin_guarded, in the same block as the value.

Also rebased onto ffe310e earlier (909393a): heap_handle gained the nonuniform argument with #566, and the 64-bit path now passes the waterfall per-lane answer like handle() does. On shaders.rpf against ffe310e: VS/PS 12155 -> 12673, CS 1417 -> 1419, no 64-bit atomic refusals or "Flags must match usage" errors. A synthetic guarded-cmpswap test is still missing — fair point.

@MrCloudy2

Copy link
Copy Markdown

Tester result: +7 of 339 previously failing world programs now emit, all vertex/pixel (0 → 7 of 25). That is more than the three pixel programs that logged a 64-bit image atomic is not supported. Merged together with #160 and #571 the gains add up exactly: vertex/pixel 11, compute 41.

How measured: 339 shader containers from my own 1.0.2.1 copy, the distinct programs that logged shader does not translate in two world runs, each matched to its container by the BLAKE3 VIctory logs. Each PR was merged on its own onto one base: main 8e79c80 + #151 #190 #454 #493 #579 + #177's key fix + the wave64 stack via #439. I then ran victory translate <folder> (diag build, CPU only) and compared DXIL emitted per stage against the base (vertex/pixel 0 of 25, compute 32 of 272, mesh 0 of 13). Linux, Proton-CachyOS wine, cross-built with xwin, RTX 3060 host (only matters for the wave64 part of the base). Translation counts only, not image correctness. AI-assisted (Claude Code).

@pablogonz12

Copy link
Copy Markdown
Contributor

Measured this on Linux against the world's shaders: it translates 4 more pixel programs, but under vkd3d-proton those 4 only come out valid together with #177.

Setup: RX 9070 XT, RADV (Mesa 26.3.1), CachyOS, vkd3d-proton master (30b0eb9, dxil-spirv 34f0ff8).

What I ran: I dumped every console shader container the title translated in a run from boot into the world (751 programs, 139 of them pixel) and re-translated them offline with victory_shader::emit::translate. Each DXIL went through dxil-spirv and spirv-val --target-env vulkan1.3.

programs translated pixel programs invalid as SPIR-V
main ffe310e 666 / 751 5
main + this PR 670 / 751 (+4 pixel, none lost) 9: the 4 new ones too, all OpAtomicUMin/UMax/IAdd with a non-integer result type
main + this PR + #177's handle-key change 670 / 751 0

The cause is the one #177 fixes: an image that is both read as float and updated atomically gets the cached float handle for its atomic, and dxil-spirv then emits a float OpAtomic*. The 64-bit atomics here hit it as well. So on Linux this PR needs #177 (or its two-line core, props.1 in the handles key) to land with it or before it.

Merge note: on top of #453 there is a small conflict in emit/shader.rs (BARYCENTRICS and ATOMIC_INT64_TYPED flags added at the same place); keeping both resolves it.

@WALID1618Y

Copy link
Copy Markdown

Head-to-head synthetic dxil.dll + GPU execution comparison of #539 (719079f) vs #305 (78dae83) on main (ffe310e) — synthetic compute shaders only, no game data.

Environment: Windows 11, Rust 1.98.1, dxil.dll validation enabled (VICTORY_DXIL), NVIDIA GeForce RTX 3050 (driver 32.0.16.2124; AtomicInt64OnTypedResourceSupported=true, AtomicInt64OnDescriptorHeapResourceSupported=true) + Microsoft WARP (10.0.26100.9818; both caps true).

Build & Suite

PR Head clippy (default & --all-features) victory-shader tests (RTX 3050 + WARP + dxil.dll)
#539 719079f clean 120 passed, 0 failed, 1 ignored (38.51s)
#305 78dae83 clean 121 passed, 0 failed, 1 ignored (38.02s)

Synthetic 64-bit Image Atomic GPU Probe (both PRs)

Ran four synthetic wave32 shaders on both PRs against dxil.dll, RTX 3050, and WARP:

  1. add64_glc (real GPU dispatch on a 1x1 R32G32_UINT texture UAV): two image_atomic_add (dmask=3, glc=1 bit 13) calls adding 0x0000_0001_8000_0005 then 0x0000_0002_8000_0003 (exercising 32→64-bit carry and glc return readback to a raw UAV):
    • Shaders: 64-bit image atomics #539 (comp=0x105): dxil.dll valid, PSO OK on RTX 3050 & WARP; readback texel = [0x00000008, 0x00000004], returned old values = [0x00000000, 0x00000000] and [0x80000005, 0x00000001] on both RTX 3050 and WARP (removed=Ok(())).
    • Shaders: lower 64-bit image atomics #305 (comp=0x107): identical dxil.dll valid, PSO OK, and exact [0x00000008, 0x00000004] / old-value readback on both RTX 3050 and WARP.
  2. cmpswap64_glc (dmask=0xF, glc=1, unguarded): dxil.dll valid + PSO OK on RTX 3050 & WARP on both PRs.
  3. cmpswap64_guarded (dmask=0xF, glc=1, inside v_cmpx_eq_u32 divergent guard): dxil.dll valid + PSO OK on RTX 3050 & WARP on both PRs.
  4. resinfo_then_umax64 (image_get_resinfo followed by 64-bit image_atomic_umax on the same 2D UAV descriptor):
    • Both pass dxil.dll and Windows D3D12 PSO creation, but Shaders: lower 64-bit image atomics #305 still routes through self.handle(...), which caches handles by (block, load, first, sampler, props.0) without props.1 (lower.rs:3311), so image_atomic_* after image_get_resinfo reuses the cached float4 (0x409) handle — the exact mismatch that Shaders: 64-bit image atomics #539 (29da300/719079f) avoids for Source::Loaded via a dedicated heap_handle.

Summary

  • Shaders: 64-bit image atomics #539 is smaller (+110/-6), gates ATOMIC_INT64_HEAP on !matches!(src, Source::Built { .. }), and avoids the Source::Loaded handle-cache collision (it just lacks a unit/GPU test of its own).
  • Shaders: lower 64-bit image atomics #305 includes a unit test, but its MIMG words (0xF044_1388 / 0xF040_1F88) set bit 7 (dlc=1) instead of bit 13 (glc=1), so the test does not exercise the if cache.glc { split64 } return path or call Validator::validate.

Between the two, #539 (719079f) is the stronger merge candidate.

AI-assisted; all builds, DXIL validations, and GPU dispatches were executed locally on my RTX 3050 + WARP.

@adamdotpy

Copy link
Copy Markdown

Thanks for the head-to-head @WALID1618Y — independent dxil.dll + RTX 3050 + WARP runs agreeing with the earlier review that #539 is the stronger of the two: noted. One correction to the handle-cache point, checked against the trees: the (block, load, first, sampler, props.0) key without props.1 is not just #305 — it is also current main (lower.rs:3311 on ffe310e); the fix (key includes props.1) is carried by #1127 at f89a9d7, not merged yet. So #305's image_get_resinfo-then-atomic collision is a main bug too, fixed on #1127's branch, not something #305 introduced.

simnJS pushed a commit to MiamiGame/XTP that referenced this pull request Nov 24, 2026
Image atomics with two data dwords per value (an R32G32 view: dmask 3,
cmpswap 0xF) were refused as "a 64-bit image atomic". They now become
DXIL's i64 atomicBinOp and atomicCompareExchange on the same texture
UAV, with the shader flags and SFI0 bits for 64-bit integers and for
64-bit atomics on typed and on descriptor-heap resources (the bits DXC
sets for the same HLSL). A returned value (glc) is split back into the
VGPR pair. Any other data mask is refused with its own reason.

The 64-bit path makes its own heap handle (per lane in a waterfall
loop, as `handle` makes it): `handle` caches by the annotation's first
word only, so a float4 handle of the same view (a size query) would
come back with the wrong element type. The compare of a cmpswap is
built before the lane guard, with the value.

XTP adaptation: the upstream hunks in emit/lower.rs went to
emit/lower/image.rs (S0b), the arguments into a struct instead of
`#[allow(clippy::too_many_arguments)]`. The upstream PR has no tests;
emit/image_tests.rs (new) checks that both forms declare the features
and pass the validator, refuses other data masks, and runs both on the
test GPU (WARP here): an add whose low dwords carry into the high ones
(eight lanes per texel), and an add then cmpswap returning the old
values (the compare and the new value in the console's order). The test
host (emit/host.rs) gains an R32G32_UINT texture UAV and the device
query for 64-bit atomics on heap typed resources.

Survey (shaders.rpf, any host, every translation validated): 22,508 ->
23,034 translated, all 526 new ones accepted by dxil.dll; none lost,
no translation that existed changed. 133 programs past this blocker
stop at the next one (104 scalar memory read as data, 23 barycentrics
read directly).

The GPU side is not in this commit: hosts need
AtomicInt64OnTypedResourceSupported (options 9) and
AtomicInt64OnDescriptorHeapResourceSupported (options 11), and the
views these atomics use must be R32G32_UINT typed UAVs.

Ported from Marvisak/VIctory#539 (head 719079f2b73831a51d5dbe4218948eeaa9c447db) by SAitken91
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@alexdeliu

Copy link
Copy Markdown
Contributor

Neither 64-bit image atomics PR had a GPU test, so I wrote one: alexdeliu/VIctory@5f5ce1f (branch atomic64-test, on main @ ffe310eb). It is test-only:

  • emit/image_atomic64_tests.rs.
  • A View::Uint64TextureUav (R32G32_UINT) in the test host.

It is a synthetic RDNA2 compute shader. It first runs image_get_resinfo on the same view, so a handle with another element type already exists in that block. Then it runs 64-bit atomics on a 4×1 texture:

  • add twice, for the carry into the high dword;
  • cmpswap;
  • umax;
  • add then sub, for the borrow.

The test checks the texels. It skips devices without AtomicInt64OnTypedResourceSupported / AtomicInt64OnDescriptorHeapResourceSupported.

On AMD RX 9070 (RDNA4) and WARP, merged onto ffe310eb:

64-bit atomic test cargo test --workspace clippy ×2
main fails in lowering: a 64-bit image atomic
#539 @ 719079f2 pass (hardware + WARP) 343 pass clean
#305 @ 78dae836 pass (hardware + WARP) 344 pass clean

So both produce correct results on real hardware. The handle-cache concern I raised about #305 (no element type in the key) does not show up with a size query before the atomic in one block. Feel free to cherry-pick the test into either PR.

A synthetic RDNA2 compute shader queries a texture UAV's size and then
runs 64-bit add (carry into the high dword), sub (borrow from it),
cmpswap and umax on it, on an R32G32_UINT view through the host's 64-bit
typed atomics. Skipped on devices without 64-bit atomics on typed heap
views.

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

SAitken91 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@alexdeliu thank you — cherry-picked your test into this PR as 404dbd9 (your authorship kept). On an RX 6950 XT (RDNA2) it runs (both 64-bit atomic caps reported) and passes: image_atomics_64_bit_add_sub_cmpswap_umax ... ok; cargo test -p victory-shader 121 passed, clippy clean. That covers the missing 64-bit fixture from the reviews above (add with carry, cmpswap, umax, add/sub with borrow, after a size query on the same view).

@adamdotpy

Copy link
Copy Markdown

Verified the new head 404dbd9 here (worktree on the PR head, isolated target dir, Windows 11 / Rust 1.98.1): the gap @WALID1618Y noted is closed — image_atomic64_tests.rs adds image_atomics_64_bit_add_sub_cmpswap_umax, which runs the 64-bit add/sub/cmpswap/umax probes on hardware and WARP through ONE_AT_A_TIME and really dispatched here (no "skipped" output under --nocapture). cargo test -p victory-shader --lib image_atomic 1 passed / 0 failed; full lib 121 passed / 0 failed / 1 ignored; clippy --all-targets --all-features --locked -D warnings clean; release build ok. The ATOMIC_INT64_HEAP gating on !Source::Built and the heap_handle path are unchanged from the version I reviewed, so the earlier findings stand: this remains the stronger of #539/#305, now with its own GPU evidence.

suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
handle() keys its cache by resource kind only, so an image atomic that
followed a size query of the same view (getDimensions on a float4
handle) reused that handle: the i64 atomic ran on a RWTexture2D<float4>
annotation ({4098, 1033}) instead of DXC's {4098, 261}. Reported by
jeremygold02 on #539. The 64-bit path now makes its own heap handle; the
general fix of the cache key is #177.

translate --validate on shaders.rpf unchanged (vertex/pixel 12690,
compute 1672).

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

Copy link
Copy Markdown

Translation census with this PR merged alone onto main ffe310e, plus a note that #305 gives the same numbers.

Setup: release build, victory translate <dump>/shaders.rpf --list (26,084 programs, no --validate, no --pipelines), Windows 11, RX 7900 XTX. This PR's head is 404dbd9; #305's head is 78dae83.

vertex/pixel compute mesh
main 12,231 of 14,027 1,441 of 2,582 8,214 of 8,713
#539 12,749 (+518) 1,443 (+2) 8,214
#305 12,749 (+518) 1,443 (+2) 8,214

In game (diag build, two runs, stopped after 180 s): 1038 / 852 ms per world frame, against 981 / 976 on main. Both runs end in a page fault, one of them inside a freed texture, after 78 s and 128 s. That is the failure #431 addresses, so these runs cannot show whether the atomics render correctly.

AI use: Claude Code (Claude Opus 5.5) merged and built the commits, ran the census and the title, compared the outputs and wrote this comment. The numbers come from the runs above.

@Marvisak Marvisak closed this Nov 24, 2026
@iGoldenNinja

Copy link
Copy Markdown

RTX 5080 validation and D3D12 pipeline-creation result for head 404dbd9 applied to ffe310e, on Windows 11 build 26200, NVIDIA 617.14, DXIL validator 1.9.2609.5.

I selected 169 records from the 1.0.2.1 build whose native programs contained a two-word 2D image UMAX. After deduplication, all 168 distinct pixel containers hit the 64-bit image atomic refusal on the baseline. With this patch, 162 passed DXIL validation and all 162 created real D3D12 graphics pipelines using VIctory's signature-matched stand-in vertex shaders. The other six reached the separate barycentrics read directly refusal. Counting the duplicate record gives 163/169. This sample was selected for the instruction and is not a full-pack coverage estimate.

For one of the recovered programs, the disassembled host module contains an i64 atomic unsigned maximum built from both source words. The patch's synthetic GPU readback test also passed on this card. These are offline translation, pipeline-creation and isolated GPU results; no in-game image or frame-time claim from this test.

AI-assisted testing with OpenAI Codex (GPT-6).

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.