Shaders, GPU: a root UAV a shader only reads is not written back #2948

Open
github-bot wants to merge 2 commits from github-bot/gh-2948 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 01:19 UTC · original
0xkn0wh3r3:gpu/read-only-root-uavs-are-not-written-back → main · +193 −9 · 15 files · 2 commits · open

What

A root UAV is bound for any shader that reads or writes it, and the host declared every bound one as written (Shadow::gpu_writes, up to 1 MiB of its copy). That means a snapshot before the list runs and a compare of the bytes afterwards, even for root UAVs a shader only loads from.

  • Translator: records which root UAVs an operation may write, as HostShader::written_root_uavs. In Shader::op, any operation on the handle except BufferLoad, GetDimensions and RawBufferLoad counts as a write, so stores and atomics do.
  • Host: declares writes only for those UAVs. That applies to root descriptors (root_view) and to root views a stage reads as title memory.
  • Typed root views made through heap slots keep declaring theirs. Their handles are the heap's, so the new tracking doesn't see them.
  • Shader cache: entries now carry the list (VSH2); a VSH1 entry is translated again.

Where it came from

From DexNom's fork, DexNom/VIctory@bc3cd4b ("track guest shader writes precisely": written_root_uavs and its test), built on this tree's root views. Credited with Co-authored-by: DexNom. The other half of that commit, writes through the guest page directory, is already on main as memory_writes plus write marks. DexNom measured the whole commit at 3,469 → 969 ms per frame on their Radeon build, with guest memory compared per frame dropping from 12.8 GB to 2.7 GB. Most of that is the half main already has, so I'm not claiming that number here.

Tested

  • New test emit::shader::tests::only_root_uavs_stored_to_or_reached_by_atomics_are_written: of three root UAVs, the one only loaded from isn't written; the one stored to and the one an atomic reaches are.
  • cargo test -p victory-gpu: 229 passed, plus the 2 known NVIDIA failures (#2121).
  • cargo test -p victory-shader (with VICTORY_DXIL set): 299 passed. The same four tests fail on main on this machine.
  • cargo test -p victory-game: passes.
  • cargo build --workspace --tests: builds.
  • cargo clippy --all-targets -- -D warnings on victory-shader, victory-gpu (with and without diagnostics) and victory-game: clean.

Not tested

  • There's no lowering test of a console program with a read-only root UAV; the mechanism is tested at Shader::op.
  • I haven't measured the saving with the title.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 01:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2948) `0xkn0wh3r3:gpu/read-only-root-uavs-are-not-written-back` → `main` · +193 −9 · 15 files · 2 commits · open ## What A root UAV is bound for any shader that reads or writes it, and the host declared every bound one as written (`Shadow::gpu_writes`, up to 1 MiB of its copy). That means a snapshot before the list runs and a compare of the bytes afterwards, even for root UAVs a shader only loads from. - **Translator:** records which root UAVs an operation may write, as `HostShader::written_root_uavs`. In `Shader::op`, any operation on the handle except BufferLoad, GetDimensions and RawBufferLoad counts as a write, so stores and atomics do. - **Host:** declares writes only for those UAVs. That applies to root descriptors (`root_view`) and to root views a stage reads as title memory. - **Typed root views made through heap slots** keep declaring theirs. Their handles are the heap's, so the new tracking doesn't see them. - **Shader cache:** entries now carry the list (`VSH2`); a `VSH1` entry is translated again. ## Where it came from From DexNom's fork, [DexNom/VIctory@bc3cd4b](https://github.com/DexNom/VIctory/commit/bc3cd4b045ff63c52972d29c1bef7e897b94abc7) ("track guest shader writes precisely": `written_root_uavs` and its test), built on this tree's root views. Credited with `Co-authored-by: DexNom`. The other half of that commit, writes through the guest page directory, is already on main as `memory_writes` plus write marks. DexNom measured the whole commit at 3,469 → 969 ms per frame on their Radeon build, with guest memory compared per frame dropping from 12.8 GB to 2.7 GB. Most of that is the half main already has, so I'm not claiming that number here. ## Tested - New test `emit::shader::tests::only_root_uavs_stored_to_or_reached_by_atomics_are_written`: of three root UAVs, the one only loaded from isn't written; the one stored to and the one an atomic reaches are. - `cargo test -p victory-gpu`: 229 passed, plus the 2 known NVIDIA failures (#2121). - `cargo test -p victory-shader` (with `VICTORY_DXIL` set): 299 passed. The same four tests fail on main on this machine. - `cargo test -p victory-game`: passes. - `cargo build --workspace --tests`: builds. - `cargo clippy --all-targets -- -D warnings` on victory-shader, victory-gpu (with and without `diagnostics`) and victory-game: clean. ## Not tested - There's no lowering test of a console program with a read-only root UAV; the mechanism is tested at `Shader::op`. - I haven't measured the saving with the title.
A root UAV is bound for a shader that reads or writes it, and the host
declared every bound one written (Shadow::gpu_writes, up to 1 MiB of its
copy): a snapshot before the list runs and a compare of the bytes after,
for root UAVs shaders only load from too.

The translator now records which root UAVs an operation may write
(Shader::op: any operation on the handle but BufferLoad, GetDimensions
and RawBufferLoad; stores and atomics write), as
HostShader::written_root_uavs. The host declares writes only for those:
for root descriptors (root_view) and for root views a stage reads as
title memory. Typed root views made through heap slots keep declaring
theirs (their handles are the heap's). The shader cache's entries carry
the list (VSH2; a VSH1 entry is translated again).

Test: only_root_uavs_stored_to_or_reached_by_atomics_are_written (of
three root UAVs, the loaded one is not written; the stored and the
atomic one are).

From DexNom/VIctory@bc3cd4b045
(written_root_uavs and its test), on this tree's root views.

Co-authored-by: DexNom <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:18:17 +00:00
In a program that reads title memory (root_memory), a root UAV is
reached at its address: buffer stores through a descriptor built around
it go through Lower::raw_view to Lower::memory, and global stores and
atomics at it through Lower::memory directly. No operation on a root UAV
handle happens, so Shader::op never recorded the slot, and the host
dropped Shadow::gpu_writes and the precise map for root UAVs those
programs store to.

Lower::root_written now records the root UAV's slot when raw_view
resolves a root address for a write, and for global stores and atomics
at a root address.

Tests: root_uavs_stored_to_as_title_memory_are_written (a root_memory
program storing through a descriptor built around root UAV 2 and only
loading from root UAV 3: [2] is written), and
title_memory_is_read_and_written_at_computed_addresses now checks its
global store marks its root UAV written. Both fail without the change.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 01:29 UTC · original

Independent Windows WARP verification

Tested PR head 95110f370b83a5e705dfc281e7a25502604626d9 on Windows 11 Pro build 26200 with Rust 1.98.1. AI assistance used Codex (gpt-6.2-sol). The run used synthetic fixtures and the CPU software adapter. Coordination claim

$env:CARGO_TARGET_DIR = 'D:\victory-2948-warp-target'
$env:VICTORY_D3D12_WARP = '1'
$env:VICTORY_WARP = '1'
$env:VICTORY_DXIL = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxil.dll'

cargo test -j 4 -p victory-shader --lib emit::shader::tests::only_root_uavs_stored_to_or_reached_by_atomics_are_written -- --exact --nocapture
cargo test -j 4 -p victory-gpu --lib shader_cache::tests:: -- --nocapture
cargo test -j 4 -p victory-shader --lib emit::memory_tests::title_memory_is_read_and_written_at_computed_addresses -- --exact --nocapture
Focus Passed Failed Skipped
Root UAV classification on clean PR head 1 0 0
Shader cache on clean PR head 4 0 0
Additional valid VSH1 replacement probe, added locally 1 0 0
Synthetic compute with temporary WARP and DXIL assertions 1 0 0

The classification test recorded slots [2, 3] for the store and atomic, excluding the load-only slot. The VSH2 tests preserved the written-root-UAV list across disk round-trip. The additional probe reconstructed the parent's VSH1 layout, placed it under the current key to exercise the format check, and observed a cache miss, VSH2 replacement, then a disk hit.

The compute case validated DXIL and checked readback of a root UAV load and store through the emulated memory path, separate float min/max atomics, and page marks. Before device creation, the harness verified the adapter returned by EnumWarpAdapter had the software flag. It matched the created device's LUID to that adapter and independently queried the device by LUID again before each of the two dispatches. That LUID identifies Microsoft Basic Render Driver, vendor 0x1414, device 0x008c, flags 0x02 (DXGI_ADAPTER_FLAG_SOFTWARE), LUID 0x0:0x16406, and zero dedicated video memory. The x64 SDK validator DLL has file version 1.8.2502.11 with SHA-256 39DBD950F39F75F5C37BCD224C524ACCBA76686ADAA372B8287FACFC46892B1C.

Coverage is limited to the selected tests. The compute fixture exercises the shader harness, so production draw binding, shadow snapshot and copy-back behavior, physical adapters, and game performance remain unmeasured. Temporary test code and the dedicated Cargo target were removed.

**@⁠oni-swr** on GitHub · 2026-11-26 01:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2948#issuecomment-7179818331) ## Independent Windows WARP verification Tested PR head `95110f370b83a5e705dfc281e7a25502604626d9` on Windows 11 Pro build 26200 with Rust 1.98.1. AI assistance used Codex (gpt-6.2-sol). The run used synthetic fixtures and the CPU software adapter. [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) ```powershell $env:CARGO_TARGET_DIR = 'D:\victory-2948-warp-target' $env:VICTORY_D3D12_WARP = '1' $env:VICTORY_WARP = '1' $env:VICTORY_DXIL = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxil.dll' cargo test -j 4 -p victory-shader --lib emit::shader::tests::only_root_uavs_stored_to_or_reached_by_atomics_are_written -- --exact --nocapture cargo test -j 4 -p victory-gpu --lib shader_cache::tests:: -- --nocapture cargo test -j 4 -p victory-shader --lib emit::memory_tests::title_memory_is_read_and_written_at_computed_addresses -- --exact --nocapture ``` | Focus | Passed | Failed | Skipped | | --- | ---: | ---: | ---: | | Root UAV classification on clean PR head | 1 | 0 | 0 | | Shader cache on clean PR head | 4 | 0 | 0 | | Additional valid VSH1 replacement probe, added locally | 1 | 0 | 0 | | Synthetic compute with temporary WARP and DXIL assertions | 1 | 0 | 0 | The classification test recorded slots `[2, 3]` for the store and atomic, excluding the load-only slot. The VSH2 tests preserved the written-root-UAV list across disk round-trip. The additional probe reconstructed the parent's VSH1 layout, placed it under the current key to exercise the format check, and observed a cache miss, VSH2 replacement, then a disk hit. The compute case validated DXIL and checked readback of a root UAV load and store through the emulated memory path, separate float min/max atomics, and page marks. Before device creation, the harness verified the adapter returned by `EnumWarpAdapter` had the software flag. It matched the created device's LUID to that adapter and independently queried the device by LUID again before each of the two dispatches. That LUID identifies **Microsoft Basic Render Driver**, vendor `0x1414`, device `0x008c`, flags `0x02` (`DXGI_ADAPTER_FLAG_SOFTWARE`), LUID `0x0:0x16406`, and zero dedicated video memory. The x64 SDK validator DLL has file version `1.8.2502.11` with SHA-256 `39DBD950F39F75F5C37BCD224C524ACCBA76686ADAA372B8287FACFC46892B1C`. Coverage is limited to the selected tests. The compute fixture exercises the shader harness, so production draw binding, shadow snapshot and copy-back behavior, physical adapters, and game performance remain unmeasured. Temporary test code and the dedicated Cargo target were removed.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:31 UTC · original

Code review and RTX 5090 + WARP + DXIL verification at head 95110f370b83 on main (63bcca43c6a0; emit/lower.rs = 520,724 B, 3,564 B under the 512 KiB cap):

  • What looks solid: Excluding only read-only opcodes (68 | 72 | 139) in Shader::op (shader.rs:245-251) is conservatively fail-safe for all bufferStore/rawBufferStore/atomicBinOp/atomicCompareExchange paths through root_uav_handle, and bumping shader_cache.rs:179 from VSH1 to VSH2 cleanly invalidates older cached shaders.
  • Subtle regression path found when self.root_memory == true + raw_view writes (lower.rs:1790-1813, draw.rs:763, 886-893):
    • When a shader enables self.root_memory == true (e.g. due to computed pointers), raw root UAV writes go through raw_view -> root_address -> self.memory (MEMORY page table + memory_dirty bitmap) without calling root_uav_handle(rp.slot) (lower.rs:5461 only fires on structured/typed buffers going through handle()).
    • As a result, t.host.written_root_uavs omits rp.slot even though raw_view(..., write=true) writes to that root UAV. draw.rs:763 (written_root_uavs.contains(&u.slot)) then evaluates false, skipping shadow.gpu_writes + map.precise byte-level copyback (draw.rs:886-893) and falling back to 4 KiB whole-page memory_dirty copyback — which per memory.rs:79-85 risks clobbering concurrent CPU/DirectStorage writes sharing the same 4 KiB page.
    • Recording rp.slot in written_root_uavs when raw_view hits a root_address with write == true closes that gap cleanly.
    • (Side observation: when !self.root_memory, lower.rs:5455 routes through ROOT_UAV_VIEW -> draw.rs:948-953 rather than stage.root_uavs, so read-only root UAVs on that path still keep the existing shadow.gpu_writes(..., true) snapshot path if unmarked.)
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, dxil.dll 10.0.26100.0, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-shader -p victory-gpu --tests -- -D warnings: 0 warnings
    • emit::shader: 2/2 (including only_root_uavs_stored_to_or_reached_by_atomics_are_written); shader_cache: 4/4; draw::tests: 20/20 on both RTX 5090 and WARP; WARP memory_tests: 5/5.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2948#issuecomment-7179864305) Code review and RTX 5090 + WARP + DXIL verification at head `95110f370b83` on `main` (`63bcca43c6a0`; `emit/lower.rs` = `520,724` B, `3,564` B under the 512 KiB cap): - **What looks solid**: Excluding only read-only opcodes (`68 | 72 | 139`) in `Shader::op` (`shader.rs:245-251`) is conservatively fail-safe for all `bufferStore`/`rawBufferStore`/`atomicBinOp`/`atomicCompareExchange` paths through `root_uav_handle`, and bumping `shader_cache.rs:179` from `VSH1` to `VSH2` cleanly invalidates older cached shaders. - **Subtle regression path found when `self.root_memory == true` + `raw_view` writes (`lower.rs:1790-1813`, `draw.rs:763, 886-893`)**: - When a shader enables `self.root_memory == true` (e.g. due to computed pointers), raw root UAV writes go through `raw_view` -> `root_address` -> `self.memory` (`MEMORY` page table + `memory_dirty` bitmap) without calling `root_uav_handle(rp.slot)` (`lower.rs:5461` only fires on structured/typed buffers going through `handle()`). - As a result, `t.host.written_root_uavs` omits `rp.slot` even though `raw_view(..., write=true)` writes to that root UAV. `draw.rs:763` (`written_root_uavs.contains(&u.slot)`) then evaluates `false`, skipping `shadow.gpu_writes` + `map.precise` byte-level copyback (`draw.rs:886-893`) and falling back to 4 KiB whole-page `memory_dirty` copyback — which per `memory.rs:79-85` risks clobbering concurrent CPU/DirectStorage writes sharing the same 4 KiB page. - Recording `rp.slot` in `written_root_uavs` when `raw_view` hits a `root_address` with `write == true` closes that gap cleanly. - (Side observation: when `!self.root_memory`, `lower.rs:5455` routes through `ROOT_UAV_VIEW` -> `draw.rs:948-953` rather than `stage.root_uavs`, so read-only root UAVs on that path still keep the existing `shadow.gpu_writes(..., true)` snapshot path if unmarked.) - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `dxil.dll` 10.0.26100.0, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-shader -p victory-gpu --tests -- -D warnings`: 0 warnings - `emit::shader`: 2/2 (including `only_root_uavs_stored_to_or_reached_by_atomics_are_written`); `shader_cache`: 4/4; `draw::tests`: 20/20 on both RTX 5090 and WARP; WARP `memory_tests`: 5/5.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 04:29 UTC · original · edited 2026-11-26 07:18 UTC

Automated triage for the maintainers.

Merge candidate (recommending a look, not approving). Thanks for the fix in 9f392ad: Lower::root_written (emit/lower.rs) now records the slot when raw_view resolves a root address with write == true, and in the global store/atomic path when root_address resolves. That closes the gap we raised, where in root_memory programs written_root_uavs stayed empty and the roots loop in draw.rs dropped shadow.gpu_writes/map.precise. The rest is unchanged: Shader::op counts any op on a root UAV handle except the three reads as a write (the safe default), root_view skips snapshot/compare only for read-only root UAVs, the ROOT_UAV_VIEW heap-view path still marks writes, and the cache tag moves to VSH2. root_uavs_stored_to_as_title_memory_are_written checks a store through a built descriptor against a load-only UAV, and the existing memory test now asserts its global store is recorded.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 04:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2948#issuecomment-7182639982) · edited 2026-11-26 07:18 UTC <!-- victory-triage v1 head=9f392adc0e19735d55fbdd8aca3078eda1ee4d57 verdict=merge-candidate at=2026-11-26T07:18:53Z --> Automated triage for the maintainers. **Merge candidate** (recommending a look, not approving). Thanks for the fix in 9f392ad: `Lower::root_written` (`emit/lower.rs`) now records the slot when `raw_view` resolves a root address with `write == true`, and in the global store/atomic path when `root_address` resolves. That closes the gap we raised, where in `root_memory` programs `written_root_uavs` stayed empty and the `roots` loop in `draw.rs` dropped `shadow.gpu_writes`/`map.precise`. The rest is unchanged: `Shader::op` counts any op on a root UAV handle except the three reads as a write (the safe default), `root_view` skips snapshot/compare only for read-only root UAVs, the `ROOT_UAV_VIEW` heap-view path still marks writes, and the cache tag moves to `VSH2`. `root_uavs_stored_to_as_title_memory_are_written` checks a store through a built descriptor against a load-only UAV, and the existing memory test now asserts its global store is recorded. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 06:57 UTC · original

Good catch, fixed in 9f392ad. Lower::root_written now records the root UAV's slot in two cases: when raw_view resolves a root address with write == true, and for global stores and atomics at a root address. Those reach Lower::memory without going through raw_view, so they had the same gap.

Tests:

  • New: root_uavs_stored_to_as_title_memory_are_written. It's a root_memory program that stores through a descriptor built around root UAV 2 and only loads from root UAV 3; only slot 2 is recorded.
  • title_memory_is_read_and_written_at_computed_addresses now also asserts that its global store to the root UAV marks it written.

Both fail without the change and pass with it. Clippy is clean.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 06:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2948#issuecomment-7184958239) Good catch, fixed in 9f392ad. `Lower::root_written` now records the root UAV's slot in two cases: when `raw_view` resolves a root address with `write == true`, and for global stores and atomics at a root address. Those reach `Lower::memory` without going through `raw_view`, so they had the same gap. Tests: - New: `root_uavs_stored_to_as_title_memory_are_written`. It's a `root_memory` program that stores through a descriptor built around root UAV 2 and only loads from root UAV 3; only slot 2 is recorded. - `title_memory_is_read_and_written_at_computed_addresses` now also asserts that its global store to the root UAV marks it written. Both fail without the change and pass with it. Clippy is clean.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 02:04 UTC · original · approved these changes

Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):

  • cargo test -p victory-shader --lib emit::shader::tests: 2 passed, 0 failed (including new only_root_uavs_stored_to_or_reached_by_atomics_are_written).
  • cargo test -p victory-gpu --lib shader_cache::: 4 passed, 0 failed (VSH2 cache round-trip and validation).
  • cargo test -p victory-gpu --lib draw::: 20 passed, 0 failed on RTX 5090 hardware.
  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Tracking written_root_uavs in Shader::op by treating every opcode other than read-only bufferLoad (68) / getDimensions (72) / rawBufferLoad (139) as a potential write is conservative and sound, and bumping the shader cache magic from VSH1 to VSH2 cleanly invalidates stale cache entries.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 02:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2948#pullrequestreview-6067580908) · **approved these changes** Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090): - `cargo test -p victory-shader --lib emit::shader::tests`: **2 passed, 0 failed** (including new `only_root_uavs_stored_to_or_reached_by_atomics_are_written`). - `cargo test -p victory-gpu --lib shader_cache::`: **4 passed, 0 failed** (`VSH2` cache round-trip and validation). - `cargo test -p victory-gpu --lib draw::`: **20 passed, 0 failed** on RTX 5090 hardware. - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Tracking `written_root_uavs` in `Shader::op` by treating every opcode other than read-only `bufferLoad` (68) / `getDimensions` (72) / `rawBufferLoad` (139) as a potential write is conservative and sound, and bumping the shader cache magic from `VSH1` to `VSH2` cleanly invalidates stale cache entries. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 02:29 UTC · original · reviewed

Verified: a root UAV the shader only reads still gets shadow.refresh (host needs fresh data) but skips gpu_writes, so no snapshot/compare write-back after submission. Both the dispatch path and the graphics root path gate on written_root_uavs, and the VSH1->VSH2 cache bump makes stale entries re-translate instead of silently missing the new field.

**@⁠kotekompotek** on GitHub · 2026-11-26 02:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2948#pullrequestreview-6067764445) · **reviewed** Verified: a root UAV the shader only reads still gets shadow.refresh (host needs fresh data) but skips gpu_writes, so no snapshot/compare write-back after submission. Both the dispatch path and the graphics root path gate on written_root_uavs, and the VSH1->VSH2 cache bump makes stale entries re-translate instead of silently missing the new field.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 11:47 UTC · original · approved these changes

Reviewed and verified 9f392adc against origin/main (63bcca43; crates/victory-shader/src/emit/lower.rs is 521,409 bytes both at PR head and merged onto main, staying 2,879 bytes below the 512 KiB limit).

  • Audited every write and atomic path in victory-shader:
    • Shader::op (crates/victory-shader/src/emit/shader.rs:242-251) conservatively marks any operation on a root_uavs handle as a write except the three read-only opcodes (68 bufferLoad, 72 getDimensions, 139 rawBufferLoad), and root_uav_handle pushes the handle only after createHandleFromBinding + annotateHandle.
    • 9f392adc closes the root_memory gap via Lower::root_written (crates/victory-shader/src/emit/lower.rs:1822-1832), called on both the global_store_*/global_atomic_* path (lower.rs:995) and raw_view(..., write=true) (lower.rs:1809-1811, covering buffer_atomic_*, sub-dword stores, and buffer_store_*). All remaining raw_view and bvh.rs paths are read-only, and non-root_memory shaders using ROOT_UAV_VIEW keep the existing write-marked shadow.gpu_writes path.
  • draw.rs:762-770 and draw.rs:841-843 gate write-back on written_root_uavs while still refreshing read-only root UAVs, and shader_cache.rs:179 bumps VSH1 to VSH2 (in addition to ENCODING hashing shader_cache.rs) so stale cache entries re-translate cleanly.

Verification on Windows 11 (RTX 5090 + WARP + VICTORY_D3D12_DEBUG=1 + Windows 11 SDK dxil.dll):

  • cargo xtask policy (191 files ok) and cargo clippy -p victory-shader -p victory-gpu --tests -- -D warnings (default and --all-features): clean.
  • victory-shader: emit::shader::tests 2/2 and emit::memory_tests 5/5 passed (including root_uavs_stored_to_as_title_memory_are_written and title_memory_is_read_and_written_at_computed_addresses; skipping the unrelated pre-existing NVIDIA baseline heap_direct_texture_reads_mark_their_heap_index).
  • victory-gpu: shader_cache::tests 4/4 and draw::tests 20/20 passed on RTX 5090 (default and Debug Layer) and on WARP + Debug Layer.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2948#pullrequestreview-6073610302) · **approved these changes** Reviewed and verified `9f392adc` against `origin/main` (`63bcca43`; `crates/victory-shader/src/emit/lower.rs` is `521,409` bytes both at PR head and merged onto `main`, staying `2,879` bytes below the 512 KiB limit). - Audited every write and atomic path in `victory-shader`: - `Shader::op` (`crates/victory-shader/src/emit/shader.rs:242-251`) conservatively marks any operation on a `root_uavs` handle as a write except the three read-only opcodes (`68` `bufferLoad`, `72` `getDimensions`, `139` `rawBufferLoad`), and `root_uav_handle` pushes the handle only after `createHandleFromBinding` + `annotateHandle`. - `9f392adc` closes the `root_memory` gap via `Lower::root_written` (`crates/victory-shader/src/emit/lower.rs:1822-1832`), called on both the `global_store_*`/`global_atomic_*` path (`lower.rs:995`) and `raw_view(..., write=true)` (`lower.rs:1809-1811`, covering `buffer_atomic_*`, sub-dword stores, and `buffer_store_*`). All remaining `raw_view` and `bvh.rs` paths are read-only, and non-`root_memory` shaders using `ROOT_UAV_VIEW` keep the existing write-marked `shadow.gpu_writes` path. - `draw.rs:762-770` and `draw.rs:841-843` gate write-back on `written_root_uavs` while still refreshing read-only root UAVs, and `shader_cache.rs:179` bumps `VSH1` to `VSH2` (in addition to `ENCODING` hashing `shader_cache.rs`) so stale cache entries re-translate cleanly. Verification on Windows 11 (RTX 5090 + WARP + `VICTORY_D3D12_DEBUG=1` + Windows 11 SDK `dxil.dll`): - `cargo xtask policy` (`191 files ok`) and `cargo clippy -p victory-shader -p victory-gpu --tests -- -D warnings` (default and `--all-features`): clean. - `victory-shader`: `emit::shader::tests` 2/2 and `emit::memory_tests` 5/5 passed (including `root_uavs_stored_to_as_title_memory_are_written` and `title_memory_is_read_and_written_at_computed_addresses`; skipping the unrelated pre-existing NVIDIA baseline `heap_direct_texture_reads_mark_their_heap_index`). - `victory-gpu`: `shader_cache::tests` 4/4 and `draw::tests` 20/20 passed on RTX 5090 (default and Debug Layer) and on WARP + Debug Layer.
This pull request can be merged automatically.
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/2948/head:github-bot/gh-2948'
git switch 'github-bot/gh-2948'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2948'
git switch 'github-bot/gh-2948'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2948'
git switch 'github-bot/gh-2948'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2948'
git switch 'main'
git merge --squash 'github-bot/gh-2948'
git switch 'main'
git merge --ff-only 'github-bot/gh-2948'
git switch 'main'
git merge 'github-bot/gh-2948'
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!2948
No description provided.