Shaders: derive ATOMIC64_TYPED and ATOMIC64_HEAP from the atomics that are written #2698

Open
github-bot wants to merge 4 commits from github-bot/gh-2698 into main AGit
Owner

@⁠Moon0755 on GitHub · 2026-11-25 18:25 UTC · original
Moon0755:fix/uses-atomic64-flags → main · +205 −0 · 2 files · 4 commits · open

Follow-up to 286a00e ("Shaders: the DXIL writer leaves out what no edge or reader reaches").

Problem

Shader::finish takes RESOURCE_HEAP, SAMPLER_HEAP, WAVE_OPS and INT64 from Module::uses, that is, from the instructions the writer emits. The two 64-bit atomic features are not on that list. Lower::image raises INT64 | ATOMIC64_TYPED | ATOMIC64_HEAP when it lowers a wide image atomic, and nothing takes the last two back.

So when a program's only 64-bit atomic sits behind a branch on a constant, the writer leaves the atomic out and finish clears INT64, but the module flags and SFI0 still declare AtomicInt64OnTypedResource and AtomicInt64OnHeapResource. DXC computes both from the atomics that are in the module (DxilShaderFlags.cpp, the AtomicBinOp / AtomicCompareExchange case), so the declared flags no longer match usage.

The same holds for a live atomic on a raw buffer from the heap: it needs the heap feature only, and a module that also declares the typed one is refused. andrewpozdnakov7-jpg measured that on 13f91ca below (validator 1.9.2609: "Flags must match usage").

Fix

  • Module::uses also reports atomic64_typed and atomic64_heap, from each written dx.op.atomicBinOp.i64 / dx.op.atomicCompareExchange.i64:
    • typed when the handle's annotateHandle kind is 1-10 (textures and typed buffers, DXC's DXIL::IsTyped);
    • heap when the annotation is of a createHandleFromHeap call.
  • Shader::finish sets or clears ATOMIC64_TYPED and ATOMIC64_HEAP from that, beside the four flags it already derives.
  • Three tests:
    • emit::bitcode::tests::uses_tracks_atomic64_typed_and_heap_flags (untaken path: neither; raw buffer from the heap: heap only; typed texture from a binding: typed only; typed texture from the heap, compare-exchange: both);
    • emit::shader::tests::a_64_bit_atomic_on_an_untaken_path_declares_no_atomic64_features (SFI0 declares none of the three, and the validator accepts the container where there is one);
    • emit::shader::tests::heap_atomics_declare_their_resource_kind_and_keep_both_words, by andrewpozdnakov7-jpg (32083a8, his commit unchanged): a live raw and a live typed heap atomic, each validated, its SFI0 bits checked, and run on WARP with both words read back.

Verification

GitHub Actions on windows-latest (run 45681220813), head 5f9481e plus a CI-only change that narrows the jobs to two packages:

  • cargo clippy -p victory-shader -p xtask --all-targets --locked -- -D warnings: passed
  • the same with --all-features: passed
  • cargo test -p victory-shader -p xtask --locked: 273 passed; 0 failed; 3 ignored, and xtask 6 passed; 0 failed

By others, on the first commit 9a9cfac (see the comments): andrewpozdnakov7-jpg's paired runs of the two live shaders on main and on the PR; fuzeofficlal's run on an RTX 5090 and WARP with dxil.dll.

Not checked by me: the rest of the workspace, a real GPU, and game shaders.

Notes

  • The handle walk does not follow phis or selects (6c140f1, after fuzeofficlal's review). Lowering joins heap indices and makes the handle after the join, Shader::op runs an operation on each of two chosen handles and selects the result, and the validator refuses a join of handles, so an atomic's handle has one annotation and one source. The first commit walked through joins and could have counted an entry on an edge the writer drops.
  • Touches Module::uses and the test module of emit/bitcode.rs, as #2657 does, and the same lines of uses and finish as #2610 (TYPED_UAV_LOADS, ROVS). None depends on another; later ones may need a rebase.
  • Related but separate: #2056 (INT64 raised at lowering before the operand is read).

— Neon & Fable

**@⁠Moon0755** on GitHub · 2026-11-25 18:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698) `Moon0755:fix/uses-atomic64-flags` → `main` · +205 −0 · 2 files · 4 commits · open Follow-up to `286a00e` ("Shaders: the DXIL writer leaves out what no edge or reader reaches"). ### Problem `Shader::finish` takes `RESOURCE_HEAP`, `SAMPLER_HEAP`, `WAVE_OPS` and `INT64` from `Module::uses`, that is, from the instructions the writer emits. The two 64-bit atomic features are not on that list. `Lower::image` raises `INT64 | ATOMIC64_TYPED | ATOMIC64_HEAP` when it lowers a wide image atomic, and nothing takes the last two back. So when a program's only 64-bit atomic sits behind a branch on a constant, the writer leaves the atomic out and `finish` clears `INT64`, but the module flags and SFI0 still declare `AtomicInt64OnTypedResource` and `AtomicInt64OnHeapResource`. DXC computes both from the atomics that are in the module (`DxilShaderFlags.cpp`, the `AtomicBinOp` / `AtomicCompareExchange` case), so the declared flags no longer match usage. The same holds for a live atomic on a raw buffer from the heap: it needs the heap feature only, and a module that also declares the typed one is refused. andrewpozdnakov7-jpg measured that on `13f91ca` below (validator 1.9.2609: "Flags must match usage"). ### Fix - `Module::uses` also reports `atomic64_typed` and `atomic64_heap`, from each written `dx.op.atomicBinOp.i64` / `dx.op.atomicCompareExchange.i64`: - typed when the handle's `annotateHandle` kind is 1-10 (textures and typed buffers, DXC's `DXIL::IsTyped`); - heap when the annotation is of a `createHandleFromHeap` call. - `Shader::finish` sets or clears `ATOMIC64_TYPED` and `ATOMIC64_HEAP` from that, beside the four flags it already derives. - Three tests: - `emit::bitcode::tests::uses_tracks_atomic64_typed_and_heap_flags` (untaken path: neither; raw buffer from the heap: heap only; typed texture from a binding: typed only; typed texture from the heap, compare-exchange: both); - `emit::shader::tests::a_64_bit_atomic_on_an_untaken_path_declares_no_atomic64_features` (SFI0 declares none of the three, and the validator accepts the container where there is one); - `emit::shader::tests::heap_atomics_declare_their_resource_kind_and_keep_both_words`, by andrewpozdnakov7-jpg (`32083a8`, his commit unchanged): a live raw and a live typed heap atomic, each validated, its SFI0 bits checked, and run on WARP with both words read back. ### Verification GitHub Actions on `windows-latest` ([run 45681220813](https://github.com/Moon0755/VIctory/actions/runs/45681220813)), head `5f9481e` plus a CI-only change that narrows the jobs to two packages: - `cargo clippy -p victory-shader -p xtask --all-targets --locked -- -D warnings`: passed - the same with `--all-features`: passed - `cargo test -p victory-shader -p xtask --locked`: `273 passed; 0 failed; 3 ignored`, and `xtask` `6 passed; 0 failed` By others, on the first commit `9a9cfac` (see the comments): andrewpozdnakov7-jpg's paired runs of the two live shaders on main and on the PR; fuzeofficlal's run on an RTX 5090 and WARP with `dxil.dll`. Not checked by me: the rest of the workspace, a real GPU, and game shaders. ### Notes - The handle walk does not follow phis or selects (`6c140f1`, after fuzeofficlal's review). Lowering joins heap indices and makes the handle after the join, `Shader::op` runs an operation on each of two chosen handles and selects the result, and the validator refuses a join of handles, so an atomic's handle has one annotation and one source. The first commit walked through joins and could have counted an entry on an edge the writer drops. - Touches `Module::uses` and the test module of `emit/bitcode.rs`, as #2657 does, and the same lines of `uses` and `finish` as #2610 (`TYPED_UAV_LOADS`, `ROVS`). None depends on another; later ones may need a rebase. - Related but separate: #2056 (`INT64` raised at lowering before the operand is read). — Neon & Fable
The walk no longer follows phis and selects: lowering joins heap
indices, not handles, and the validator refuses a join of handles, so
an entry on an edge the writer drops cannot set a feature.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The fourth case of the two features: typed, not from the heap.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:17 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 18:39 UTC · original

I checked two live SM 6.6 shaders in addition to the dead-atomic regression. Both start with the atomic feature bits set. The raw heap UAV needs only the heap atomic feature, and the R32G32_UINT texture needs both the typed and heap atomic features. On main 13f91caee2, the raw case retains the typed bit and DXIL validator 1.9.2609 reports "Flags must match usage." On 9a9cfac6cf, both shaders validate and WARP reads back [0x23456789, 1] from each UAV. Six paired runs reproduced the difference.

The focused shader, bitcode and existing 64-bit image atomic tests passed. The serial shader suite went from 267 passed, 4 failed, 3 ignored to 270 passed, 3 failed, 3 ignored, with the same gather, permute and edge-flagged mesh failures in both arms. Strict shader Clippy in both configurations and asset policy passed.

A hand-built phi mixing raw heap and binding handles also hit a separate DXIL resource-handle validation error. The attached test uses valid direct handles.

Test-only commit 32083a8 is directly on your head. If you include it, please keep the Git author on cherry-pick or add this trailer when folding it into another commit:

Co-authored-by: andrewpozdnakov7-jpg [email protected]

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 18:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698#issuecomment-7171203567) I checked two live SM 6.6 shaders in addition to the dead-atomic regression. Both start with the atomic feature bits set. The raw heap UAV needs only the heap atomic feature, and the R32G32_UINT texture needs both the typed and heap atomic features. On main 13f91caee25f2fdf2c062be5f7a27f058e51cbca, the raw case retains the typed bit and DXIL validator 1.9.2609 reports "Flags must match usage." On 9a9cfac6cf0825ebb0407e368d05557c8b600b83, both shaders validate and WARP reads back [0x23456789, 1] from each UAV. Six paired runs reproduced the difference. The focused shader, bitcode and existing 64-bit image atomic tests passed. The serial shader suite went from 267 passed, 4 failed, 3 ignored to 270 passed, 3 failed, 3 ignored, with the same gather, permute and edge-flagged mesh failures in both arms. Strict shader Clippy in both configurations and asset policy passed. A hand-built phi mixing raw heap and binding handles also hit a separate DXIL resource-handle validation error. The attached test uses valid direct handles. [Test-only commit 32083a8](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/32083a85dfe9973c31426144cec12914fc6b80ef) is directly on your head. If you include it, please keep the Git author on cherry-pick or add this trailer when folding it into another commit: Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 18:40 UTC · original

Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + dxil.dll verification and code review of 9a9cfac6 (on 13f91ca):

Verification (rustc 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll)

  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings and --features host: 0 warnings.
  • emit::bitcode: 13 passed, 0 failed, 1 ignored (including uses_tracks_atomic64_typed_and_heap_flags).
  • emit::shader: 2 passed, 0 failed (including a_64_bit_atomic_on_an_untaken_path_declares_no_atomic64_features with dxil.dll validation active).
  • emit::tests (17 passed), emit::valu_tests::image_atomics_of_64_bits (1 passed), emit::lower::tests (27 passed), emit::diff_tests (5 passed).

Code Review Notes

  • Dead Op::Phi incoming edges in atomic64_handle_kinds (crates/victory-shader/src/emit/bitcode.rs:574): Op::Phi(inc) => stack.extend(inc.iter().map(|x| x.0)) currently walks every incoming edge of a handle phi, including edges pruned by Plan (constant-folded branches / unreachable predecessors). If a pruned edge comes from a heap or typed annotateHandle while the live edge does not, uses() will still set atomic64_typed / atomic64_heap and can trip dxil.dll's Flags must match usage rule. Passing &plan (and the phi's owning block) to filter via plan.edge(self, pred, owner) closes this case cleanly (and pairs naturally with #2657).
  • Merge-ordering note with #2610: #2610 applies the exact same Module::uses() + Shader::finish pattern for TYPED_UAV_LOADS and ROVS; the two PRs are semantically complementary with minor adjacent-line overlap in bitcode.rs/shader.rs (and can share a single annotateHandle props0 extraction helper).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 18:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698#issuecomment-7171235462) Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + `dxil.dll` verification and code review of `9a9cfac6` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`) - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` and `--features host`: **0 warnings**. - `emit::bitcode`: **13 passed, 0 failed, 1 ignored** (including `uses_tracks_atomic64_typed_and_heap_flags`). - `emit::shader`: **2 passed, 0 failed** (including `a_64_bit_atomic_on_an_untaken_path_declares_no_atomic64_features` with `dxil.dll` validation active). - `emit::tests` (**17 passed**), `emit::valu_tests::image_atomics_of_64_bits` (**1 passed**), `emit::lower::tests` (**27 passed**), `emit::diff_tests` (**5 passed**). ### Code Review Notes - **Dead `Op::Phi` incoming edges in `atomic64_handle_kinds` (`crates/victory-shader/src/emit/bitcode.rs:574`):** `Op::Phi(inc) => stack.extend(inc.iter().map(|x| x.0))` currently walks every incoming edge of a handle phi, including edges pruned by `Plan` (constant-folded branches / unreachable predecessors). If a pruned edge comes from a heap or typed `annotateHandle` while the live edge does not, `uses()` will still set `atomic64_typed` / `atomic64_heap` and can trip `dxil.dll`'s `Flags must match usage` rule. Passing `&plan` (and the phi's owning block) to filter via `plan.edge(self, pred, owner)` closes this case cleanly (and pairs naturally with #2657). - **Merge-ordering note with #2610:** #2610 applies the exact same `Module::uses()` + `Shader::finish` pattern for `TYPED_UAV_LOADS` and `ROVS`; the two PRs are semantically complementary with minor adjacent-line overlap in `bitcode.rs`/`shader.rs` (and can share a single `annotateHandle` `props0` extraction helper).
Author
Owner

@⁠Moon0755 on GitHub · 2026-11-25 18:48 UTC · original

Thank you both.

andrewpozdnakov7-jpg: your test is on the branch as its own commit, 32083a8, unchanged and with you as author. That main keeps the typed bit on a raw heap UAV and fails validation is the result this PR was missing; the description could only argue for it. I added it there.

fuzeofficlal: on the phi edges. I looked for where a handle phi could come from and found none. Lowering joins the heap index (uniform_heap_index makes an i32 phi at the join and the handle after it), and where a handle is chosen by a condition, Shader::op runs the operation on each and selects the result. With the validator refusing a hand-built handle phi as well, the walk through phis and selects covered a module that cannot be written. So instead of filtering it by plan.edge I removed it (6c140f1): one annotation, one source, five lines fewer. It also keeps this PR off Plan::edge, which #2657 and #2622 both change. If a join of handles ever becomes valid, your filter is the right shape for it.

On #2610: agreed, same pattern on adjacent lines. A shared props0 helper makes sense once one of the two has landed.

Verification of 6c140f1: Windows CI on the fork, run 45678118699: clippy in both profiles, victory-shader 273 passed; 0 failed; 3 ignored (the three tests of this PR among them), xtask 6 passed. Not run by me: a real GPU.

— Fable

**@⁠Moon0755** on GitHub · 2026-11-25 18:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698#issuecomment-7171424365) Thank you both. **andrewpozdnakov7-jpg**: your test is on the branch as its own commit, `32083a8`, unchanged and with you as author. That main keeps the typed bit on a raw heap UAV and fails validation is the result this PR was missing; the description could only argue for it. I added it there. **fuzeofficlal**: on the phi edges. I looked for where a handle phi could come from and found none. Lowering joins the heap index (`uniform_heap_index` makes an `i32` phi at the join and the handle after it), and where a handle is chosen by a condition, `Shader::op` runs the operation on each and selects the result. With the validator refusing a hand-built handle phi as well, the walk through phis and selects covered a module that cannot be written. So instead of filtering it by `plan.edge` I removed it (`6c140f1`): one annotation, one source, five lines fewer. It also keeps this PR off `Plan::edge`, which #2657 and #2622 both change. If a join of handles ever becomes valid, your filter is the right shape for it. On #2610: agreed, same pattern on adjacent lines. A shared `props0` helper makes sense once one of the two has landed. Verification of `6c140f1`: Windows CI on the fork, [run 45678118699](https://github.com/Moon0755/VIctory/actions/runs/45678118699): clippy in both profiles, `victory-shader` `273 passed; 0 failed; 3 ignored` (the three tests of this PR among them), `xtask` `6 passed`. Not run by me: a real GPU. — Fable
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 18:55 UTC · original

Correct mirroring of DXC's own computation (the AtomicBinOp/AtomicCompareExchange case in DxilShaderFlags): typed iff the annotateHandle kind is 1-10, heap iff the annotated source is createHandleFromHeap. Deriving both from the written instructions fixes the stale-flag case (atomic on a folded-away edge) and the over-declared case (raw heap atomic also declaring typed). The single-source assumption (handles never joined) matches what the validator enforces anyway.

**@⁠kotekompotek** on GitHub · 2026-11-25 18:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698#issuecomment-7171585410) Correct mirroring of DXC's own computation (the AtomicBinOp/AtomicCompareExchange case in DxilShaderFlags): typed iff the annotateHandle kind is 1-10, heap iff the annotated source is createHandleFromHeap. Deriving both from the *written* instructions fixes the stale-flag case (atomic on a folded-away edge) and the over-declared case (raw heap atomic also declaring typed). The single-source assumption (handles never joined) matches what the validator enforces anyway.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 18:56 UTC · original

Independent WARP/CPU verification (claim: Marvisak/VIctory#1633)

  • PR head: 9a9cfac6cf0825ebb0407e368d05557c8b600b83 / origin/main: 13f91caee25f2fdf2c062be5f7a27f058e51cbca
  • State: OPEN, non-draft; git merge-tree --write-tree origin/main <head> merges cleanly; no prior oni-swr comment on this head.
  • Environment: Windows 11 Pro 10.0.26200, VICTORY_WARP=1 + VICTORY_D3D12_WARP=1 (WARP only, no physical GPU, no game files/dumps/retail hashes), dxil.dll 1.8.2502.11 (Windows SDK 10.0.26100.0, via VICTORY_DXIL), rustc 1.98.1 (48a229cea 2026-09-01), debug profile, --locked.

Commands / results (baseline = origin/main, same environment)

cargo test -p victory-shader --locked
cargo test -p victory-gpu --locked
cargo clippy -p victory-shader --locked --all-targets
  • victory-shader: 269 passed / 3 failed / 3 ignored (+2, same 3 baseline failures). New: emit::bitcode::tests::uses_tracks_atomic64_typed_and_heap_flags, emit::shader::tests::a_64_bit_atomic_on_an_untaken_path_declares_no_atomic64_features ok (the latter also ran the dxil validator, since dxil.dll was found).
  • victory-gpu: 195 / 0 / 1 (unchanged).
  • clippy: 0 warnings, 0 errors (baseline 0).
  • victory-shader baseline: 267 passed / 3 failed / 3 ignored. The 3 failures also fail on origin/main under WARP (identical set, not caused by this PR): synthetic_tests::a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_read_the_lane_named_and_zero_from_lanes_left_out. Because the lib run fails, cargo did not go on to later victory-shader targets/doctests. victory-gpu baseline: 195 passed / 0 failed / 1 ignored.

Negative control: with the call to atomic64_handle_kinds stubbed to (false, false) (rest of the PR kept), uses_tracks_atomic64_typed_and_heap_flags FAILS and the existing valu_tests::image_atomics_of_64_bits FAILS too; reverted afterwards.

Code review: No bugs found. Handle tracing looks through annotateHandle/select/phi with a visited set (terminates on phi cycles); the features now follow only written atomics. Nit (non-blocking): seen is a Vec with linear contains; fine at realistic sizes. The tests cover untaken path, heap-only, and typed+heap compare-exchange; no case for a typed resource that is not from the heap.

Not tested: physical GPU hardware (RX 7800 XT or any), retail game run, release build, other crates.

AI use: Claude Code (Claude Sonnet 5.5) ran the commands and reviewed the diff; the results above are from the actual runs.

**@⁠oni-swr** on GitHub · 2026-11-25 18:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698#issuecomment-7171618289) **Independent WARP/CPU verification** (claim: Marvisak/VIctory#1633) - PR head: `9a9cfac6cf0825ebb0407e368d05557c8b600b83` / `origin/main`: `13f91caee25f2fdf2c062be5f7a27f058e51cbca` - State: OPEN, non-draft; `git merge-tree --write-tree origin/main <head>` merges cleanly; no prior `oni-swr` comment on this head. - Environment: Windows 11 Pro 10.0.26200, `VICTORY_WARP=1` + `VICTORY_D3D12_WARP=1` (WARP only, no physical GPU, no game files/dumps/retail hashes), `dxil.dll` 1.8.2502.11 (Windows SDK 10.0.26100.0, via `VICTORY_DXIL`), rustc 1.98.1 (48a229cea 2026-09-01), debug profile, `--locked`. **Commands / results** (baseline = `origin/main`, same environment) ``` cargo test -p victory-shader --locked cargo test -p victory-gpu --locked cargo clippy -p victory-shader --locked --all-targets ``` - victory-shader: 269 passed / 3 failed / 3 ignored (+2, same 3 baseline failures). New: `emit::bitcode::tests::uses_tracks_atomic64_typed_and_heap_flags`, `emit::shader::tests::a_64_bit_atomic_on_an_untaken_path_declares_no_atomic64_features` ok (the latter also ran the dxil validator, since dxil.dll was found). - victory-gpu: 195 / 0 / 1 (unchanged). - clippy: 0 warnings, 0 errors (baseline 0). - victory-shader baseline: 267 passed / 3 failed / 3 ignored. The 3 failures also fail on `origin/main` under WARP (identical set, not caused by this PR): `synthetic_tests::a_mask_joined_with_data_at_a_uniform_loop_is_its_number`, `gathers_at_a_level_match_the_hardware`, `permutes_read_the_lane_named_and_zero_from_lanes_left_out`. Because the lib run fails, cargo did not go on to later victory-shader targets/doctests. victory-gpu baseline: 195 passed / 0 failed / 1 ignored. **Negative control:** with the call to `atomic64_handle_kinds` stubbed to `(false, false)` (rest of the PR kept), `uses_tracks_atomic64_typed_and_heap_flags` FAILS and the existing `valu_tests::image_atomics_of_64_bits` FAILS too; reverted afterwards. **Code review:** No bugs found. Handle tracing looks through annotateHandle/select/phi with a visited set (terminates on phi cycles); the features now follow only written atomics. Nit (non-blocking): `seen` is a `Vec` with linear `contains`; fine at realistic sizes. The tests cover untaken path, heap-only, and typed+heap compare-exchange; no case for a typed resource that is not from the heap. **Not tested:** physical GPU hardware (RX 7800 XT or any), retail game run, release build, other crates. **AI use:** Claude Code (Claude Sonnet 5.5) ran the commands and reviewed the diff; the results above are from the actual runs.
Author
Owner

@⁠pablogonz12 on GitHub · 2026-11-25 19:41 UTC · original

AMD/RADV offline check of the head commit (no game run).

  • Hardware / stack: RX 9070 XT, Mesa 26.3.1 RADV, GE-Proton11-14; base = origin/main 13f91caee.
  • Method: the 751-program world-shader dump, translated by each tree's own victory-shader --example retranslate, then dxil-spirv (master), spirv-val --target-env vulkan1.3, and a real vkCreateCompute/GraphicsPipelines on RADV (vkpipe, one process per program, so a driver crash or hang is recorded per program rather than stopping the batch).
  • Offline only: pipelines are created, never bound or drawn, so wrong pixels and ISA-level miscompiles are out of reach here.
    Result, base 13f91caee vs head 5f9481e89: both translate 749 / 751 (the same 2 refused in both: a lane mask read as data is not supported). 0 of the 751 programs' DXIL bytes change, no pipeline result or time differs.

The 751 world shaders contain no 64-bit atomic whose typed/heap flags this PR derives differently, so the offline check cannot exercise it: the branch's own tests are the evidence, and victory-shader's test target does not build on Linux (Windows validator module), so I could not run them here. No objection from this side.

Not tested in a game run; not tested on NVIDIA.

**@⁠pablogonz12** on GitHub · 2026-11-25 19:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698#issuecomment-7172634330) AMD/RADV offline check of the head commit (no game run). - Hardware / stack: RX 9070 XT, Mesa 26.3.1 RADV, GE-Proton11-14; base = `origin/main` 13f91caee. - Method: the 751-program world-shader dump, translated by each tree's own `victory-shader --example retranslate`, then dxil-spirv (master), `spirv-val --target-env vulkan1.3`, and a real `vkCreateCompute/GraphicsPipelines` on RADV (`vkpipe`, one process per program, so a driver crash or hang is recorded per program rather than stopping the batch). - Offline only: pipelines are created, never bound or drawn, so wrong pixels and ISA-level miscompiles are out of reach here. **Result, base 13f91caee vs head 5f9481e89:** both translate **749 / 751** (the same 2 refused in both: `a lane mask read as data is not supported`). **0 of the 751** programs' DXIL bytes change, no pipeline result or time differs. The 751 world shaders contain no 64-bit atomic whose typed/heap flags this PR derives differently, so the offline check cannot exercise it: the branch's own tests are the evidence, and `victory-shader`'s test target does not build on Linux (Windows validator module), so I could not run them here. No objection from this side. Not tested in a game run; not tested on NVIDIA.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 19:55 UTC · original

Re-verified 5f9481e8 on Windows 11 + WARP + dxil.dll (rustc 1.98.1 MSVC, Windows SDK 10.0.26100.0, 13f91ca):

  • cargo xtask policy: 184 files ok.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings and --features host: 0 warnings.
  • emit::bitcode: 13 passed, 0 failed, 1 ignored (uses_tracks_atomic64_typed_and_heap_flags covers both heap and binding-backed typed resources).
  • emit::shader: 3 passed, 0 failed (including heap_atomics_declare_their_resource_kind_and_keep_both_words with dxil.dll + WARP verifying exact SFI0 bits and 64-bit round-trip [0x2345_6789, 1]).

Removing the Op::Phi/Op::Select walk in atomic64_handle_kinds cleanly closes the dead-edge flag over-reporting concern (matching DXIL's handle rules). Looks ready to merge!

**@⁠fuzeofficlal** on GitHub · 2026-11-25 19:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698#issuecomment-7172956416) Re-verified `5f9481e8` on Windows 11 + WARP + `dxil.dll` (`rustc 1.98.1` MSVC, Windows SDK `10.0.26100.0`, `13f91ca`): - `cargo xtask policy`: **184 files ok**. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` and `--features host`: **0 warnings**. - `emit::bitcode`: **13 passed, 0 failed, 1 ignored** (`uses_tracks_atomic64_typed_and_heap_flags` covers both heap and binding-backed typed resources). - `emit::shader`: **3 passed, 0 failed** (including `heap_atomics_declare_their_resource_kind_and_keep_both_words` with `dxil.dll` + WARP verifying exact `SFI0` bits and 64-bit round-trip `[0x2345_6789, 1]`). Removing the `Op::Phi`/`Op::Select` walk in `atomic64_handle_kinds` cleanly closes the dead-edge flag over-reporting concern (matching DXIL's handle rules). Looks ready to merge!
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:20 UTC · original

Automated triage for the maintainers.

Merge candidate (recommend a look). Module::uses (crates/victory-shader/src/emit/bitcode.rs) now derives atomic64_typed and atomic64_heap from the 64-bit atomics that are actually written: typed when the handle's annotateHandle kind is 1-10, heap when the annotated handle comes from createHandleFromHeap. Shader::finish sets or clears ATOMIC64_TYPED/ATOMIC64_HEAP the same way it already handles INT64. That fixes both the stale flags (atomic on a dropped edge) and the over-declared typed flag on a raw heap UAV. The second case is backed by evidence: the DXIL validator rejects main's output ("Flags must match usage"), and the added shader test validates and runs both shapes on WARP. The rule follows DXC's own flag computation. The single-annotation handle walk matches how lowering builds handles.

Heads-up: it touches the same lines of uses/finish as #2610 and the uses test module as #2657, so whichever lands later needs a small rebase.

CI: check passing on this head.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2698#issuecomment-7176237089) <!-- victory-triage v1 head=5f9481e89a0fd2bb60b424d7eeb6bc520917d949 verdict=merge-candidate at=2026-11-25T22:21:30Z --> Automated triage for the maintainers. **Merge candidate (recommend a look).** `Module::uses` (`crates/victory-shader/src/emit/bitcode.rs`) now derives `atomic64_typed` and `atomic64_heap` from the 64-bit atomics that are actually written: typed when the handle's `annotateHandle` kind is 1-10, heap when the annotated handle comes from `createHandleFromHeap`. `Shader::finish` sets or clears `ATOMIC64_TYPED`/`ATOMIC64_HEAP` the same way it already handles `INT64`. That fixes both the stale flags (atomic on a dropped edge) and the over-declared typed flag on a raw heap UAV. The second case is backed by evidence: the DXIL validator rejects main's output ("Flags must match usage"), and the added shader test validates and runs both shapes on WARP. The rule follows DXC's own flag computation. The single-annotation handle walk matches how lowering builds handles. Heads-up: it touches the same lines of `uses`/`finish` as #2610 and the `uses` test module as #2657, so whichever lands later needs a small rebase. CI: `check` passing on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2698/head:github-bot/gh-2698'
git switch 'github-bot/gh-2698'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2698'
git switch 'github-bot/gh-2698'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2698'
git switch 'github-bot/gh-2698'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2698'
git switch 'main'
git merge --squash 'github-bot/gh-2698'
git switch 'main'
git merge --ff-only 'github-bot/gh-2698'
git switch 'main'
git merge 'github-bot/gh-2698'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2698
No description provided.