Repository navigation
Conversation
|
The SDK accepts these shaders on I compiled a reference 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 |
|
Check on Linux, not Windows: pass. Head
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. |
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>
|
Thanks, good catch. Fixed in 29da300: the 64-bit path now makes its own heap handle ( |
|
Measured on the full retail shader pack (26,503 containers) with
|
|
Tested PR #539 (
|
| 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 atomicrefusals are cleared, and all 520 newly emitted programs (+518 VS/PS, +2 CS) passdxil.dllvalidation with zeroFlags must match usage.failures (in contrast to#705on the samemain02f404e, 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 data604 -> 708,barycentrics read directly13 -> 36,lane mask read as data248 -> 253,descriptor read only as data388 -> 389).
Build and checks
- Clean merge onto
02f404e(2 files changed invictory-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
left a comment
There was a problem hiding this comment.
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), Rust1.98.1(x86_64-pc-windows-msvc), Windows SDK10.0.26100.0dxil.dll. - CI checks:
cargo clippy --workspace --all-targets --locked -- -D warnings: passcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passcargo 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):
Source::PhimissesATOMIC_INT64_HEAP.lower.rs:469only setsflags::ATOMIC_INT64_HEAPformatches!(src, Source::Loaded { .. }), buthandle()(lower.rs:3349-3371) also emitsself.s.heap_handle(...)forSource::Phi { .. }. MatchingSource::Loaded { .. } | Source::Phi { .. }avoids aFlags must match usagevalidator error if a 64-bit atomic uses a phi-joined heap descriptor.- Guarded
cmpswapmixes blocks inpair.paircaptureslet c = self.curbeforeself.begin_guarded(guard), andcmpswapcallspair(self, reg + 2)afterbegin_guardedmovesself.curinto the guardedthenblock.i32_ofemits intol.cur(then) forVal::Bit, whilepairemitszext/shl/orintoc(head), which would violate SSA dominance if a compare word comes fromVal::Bit. Usingl.curinsidepair(or computingcmpbeforebegin_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.
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>
29da300 to
909393a
Compare
…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>
|
@alexander-src both confirmed and fixed in 719079f:
Also rebased onto |
|
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 How measured: 339 shader containers from my own 1.0.2.1 copy, the distinct programs that logged |
|
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 ( 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
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 Merge note: on top of #453 there is a small conflict in |
|
Head-to-head synthetic Environment: Windows 11, Rust Build & Suite
Synthetic 64-bit Image Atomic GPU Probe (both PRs)Ran four synthetic wave32 shaders on both PRs against
Summary
Between the two, #539 ( AI-assisted; all builds, DXIL validations, and GPU dispatches were executed locally on my RTX 3050 + WARP. |
|
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 |
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>
|
Neither 64-bit image atomics PR had a GPU test, so I wrote one:
It is a synthetic RDNA2 compute shader. It first runs
The test checks the texels. It skips devices without On AMD RX 9070 (RDNA4) and WARP, merged onto
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>
|
@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: |
|
Verified the new head |
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>
|
Translation census with this PR merged alone onto Setup: release build,
In game (diag build, two runs, stopped after 180 s): 1038 / 852 ms per world frame, against 981 / 976 on 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. |
|
RTX 5080 validation and D3D12 pipeline-creation result for head 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 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). |
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 becomedx.op.atomicBinOp.i64/dx.op.atomicCompareExchange.i64on 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.ATOMIC_INT64_TYPED(bit 27) andATOMIC_INT64_HEAP(bit 32, set when the descriptor comes from the heap). Their SFI0 bits are 0x400000 and 0x10000000.RWTexture2D<uint64_t>fromResourceDescriptorHeapwithInterlockedMax). DXC tags the handle U32 (0x105), and this does the same.Results
victory translate --validate shaders.rpf, before → after: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.AtomicInt64OnTypedResourceSupported(OPTIONS9) andAtomicInt64OnDescriptorHeapResourceSupported(OPTIONS11) are both TRUE.Written with the help of Claude (AI).
🤖 Generated with Claude Code