Ports from RYUKI-7900XT and Scarlett: root-view reach, d16 image bits, NaN guard, early depth, strict spills, alias source #329

Open
GiovanniFadanelli wants to merge 10 commits from upstream-pr/329 into main
GiovanniFadanelli commented 2026-11-26 17:21:33 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by GiovanniFadanelli on 2026-11-26T17:21:33Z.


Summary

Six fixes from other forks, ported onto main (c9c932c). The original authors stay on the ported commits. Five of the six have an off switch, and the four shader switches are part of the shader-cache key. TRANSLATOR_VERSION goes 1 → 2, so every program is translated again on the first run.

# Change Switch, default Source
1 A root view's window reaches the memory the title committed after its 4 MiB cell, instead of the cell alone (a device removal in the intro, RX 7900 XT, DRED) VICTORY_ROOT_WINDOW_MB, 32 (4 = the cell alone, as before) ryuki, YukiRyuu/RYUKI-7900XT
1b That reach (VirtualQuery) is cached for one second VICTORY_ROOT_REACH_MS, 1000 (0 = asked every time) ryuki
1c Window lookups that may take any window run under the read lock; the write lock only makes a window none ryuki
2 d16 image loads and gathers through an integer view keep its 16 bits instead of converting them as a float (0 or NaN before) VICTORY_D16_BITS, on (=0 as before) Op-lite/victory-scarlett via RYUKI-7900XT f6dc189
3 Float colour exports of pixel programs: NaN → 0, ±inf → ±65504 VICTORY_NAN_GUARD, on Neptune 25fbf69 via Scarlett
4 Pixel programs with DB_SHADER_CONTROL bit 12 and no depth/stencil/coverage export declare ForceEarlyDepthStencil VICTORY_EARLY_DEPTH, on myokex c3723f3 via Scarlett
5 Spilled SGPRs are followed only through plain lane moves inside the wave; s_bfm_b32 with 32-bit literals is resolved like inline constants VICTORY_SPILL_STRICT, on (the s_bfm part has no switch) cool_fox 8cc31ab via Scarlett
6 An aliased view is copied again when its card-written source changes within a list none fxceless/victory-fork 19a45d1 via Scarlett and RYUKI-7900XT

Not ported: Scarlett's block-scoped restored_lanes and NAN_GUARD_STORES.

Overlap with open work

  • #114 (open) changes integer_view for d16 buffer accesses through views in tables. #2 here touches only the image load/gather path (the legacyF32ToF16 "shortcut" in lower.rs). 9a6c829 on main already covers buffer loads and stores. These are different functions, with no textual conflict expected.
  • #184 (open) also bumps TRANSLATOR_VERSION 1 → 2. Whichever merges second should go to 3.
  • #268 / #308 (open) touch ir::build unspill and spill::build. #5 here changes only resource.rs's tracer.

Tests

Each switch has a test that fails with the switch off and passes by default (Windows 11, RX 9070 XT, release build):

Test Off Result off → on
shadow::window_tests::a_root_view_window_covers_the_memory_committed_after_its_cell VICTORY_ROOT_WINDOW_MB=4 left: (…, 4194304) right: (…, 12582912) → ok
shadow::window_tests::a_root_view_reach_is_used_again_within_its_time VICTORY_ROOT_REACH_MS=0 left: (…, 4194304) right: (…, 12582912) → ok
emit::picture_fix_tests::a_d16_image_load_keeps_an_integer_views_bits VICTORY_D16_BITS=0 "the d16 load's integer bits are converted as a float" → ok
emit::picture_fix_tests::a_float_colour_export_turns_nan_and_infinity_into_numbers VICTORY_NAN_GUARD=0 "no NaN guard on the colour export" → ok
emit::early_depth_tests::a_pixel_program_tested_before_it_runs_declares_early_depth (ported) VICTORY_EARLY_DEPTH=0 "the early-depth flag changed nothing" → ok
resource::tests::spilled_sgprs_are_not_followed_through_lanes_past_the_wave VICTORY_SPILL_STRICT=0 "followed through lane 40 of a wave32: Ok([…])" → ok
resource::tests::a_bit_mask_from_a_literal_width_is_a_constant main's copy_source left: Value(Value(0)) right: Const(4294963200) → ok

The DXIL tests read dxc -dumpbin text and are skipped when dxc is missing. dump_dxil now writes one temp file per call, because two dumps on parallel test threads were writing the same file.

No test for 1c (read lock) or 6 (alias source). 1c changes only the locking; the existing window tests pass. 6 needs a HostList on a device, which the unit tests don't build.

Crate suites (Windows 11, release, this branch vs main c9c932c on the same machine)

  • cargo test -p victory-shader --release --lib: 306 passed, 0 failed, 4 ignored, with one test skipped: emit::size_tests::the_record_count_of_a_structured_buffer_read_by_index. It ends the test process with STATUS_ACCESS_VIOLATION, even when run alone, and it does the same on main.
  • cargo test -p victory-gpu --release --lib: 385 passed, 0 failed, 34 ignored on the first run. A later full run had one failure, watch::tests::a_block_just_written_rests, which passes 5/5 alone on both this branch and main. main had a similar one-off failure in watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view (assertion failed: published(two, two + BLOCK)), which also passes 5/5 alone. These are timing-dependent watch tests, not something these commits touch.
  • descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in and watch::many_askers_tests::holes_are_known_until_the_runtime_tells, which fail on our Proton build, pass on Windows on both this branch and main. That points to the Wine environment rather than these changes, but it was not checked under Proton here.

Not tested

  • Nothing was run in game. There are no in-game measurements of these fixes on this branch, and this PR claims no performance or image gain. The source commits quote their own numbers (e.g. ryuki: driving 17.8 → 18.9 fps median with the read lock, on an RX 7900 XT); those were not reproduced here.
  • Not run under Wine/Proton: these tests ran on Windows only.
  • VICTORY_D16_BITS checks the value at run time (≤ 0xFFFF or ≥ 0xFFFF8000), not the view's format. A float view returning such a bit pattern as a real denormal would also take the integer path. The source fork made the same choice.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5514435410 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/329). Originally posted by [GiovanniFadanelli](https://github.com/GiovanniFadanelli) on 2026-11-26T17:21:33Z. --- ## Summary Six fixes from other forks, ported onto `main` (c9c932c). The original authors stay on the ported commits. Five of the six have an off switch, and the four shader switches are part of the shader-cache key. `TRANSLATOR_VERSION` goes **1 → 2**, so every program is translated again on the first run. | # | Change | Switch, default | Source | |---|---|---|---| | 1 | A root view's window reaches the memory the title committed after its 4 MiB cell, instead of the cell alone (a device removal in the intro, RX 7900 XT, DRED) | `VICTORY_ROOT_WINDOW_MB`, **32** (4 = the cell alone, as before) | ryuki, YukiRyuu/RYUKI-7900XT | | 1b | That reach (`VirtualQuery`) is cached for one second | `VICTORY_ROOT_REACH_MS`, **1000** (0 = asked every time) | ryuki | | 1c | Window lookups that may take any window run under the read lock; the write lock only makes a window | none | ryuki | | 2 | d16 image **loads and gathers** through an integer view keep its 16 bits instead of converting them as a float (0 or NaN before) | `VICTORY_D16_BITS`, **on** (=0 as before) | Op-lite/victory-scarlett via RYUKI-7900XT f6dc189 | | 3 | Float colour exports of pixel programs: NaN → 0, ±inf → ±65504 | `VICTORY_NAN_GUARD`, **on** | Neptune 25fbf69 via Scarlett | | 4 | Pixel programs with `DB_SHADER_CONTROL` bit 12 and no depth/stencil/coverage export declare `ForceEarlyDepthStencil` | `VICTORY_EARLY_DEPTH`, **on** | myokex c3723f3 via Scarlett | | 5 | Spilled SGPRs are followed only through plain lane moves inside the wave; `s_bfm_b32` with 32-bit literals is resolved like inline constants | `VICTORY_SPILL_STRICT`, **on** (the `s_bfm` part has no switch) | cool_fox 8cc31ab via Scarlett | | 6 | An aliased view is copied again when its card-written source changes within a list | none | fxceless/victory-fork 19a45d1 via Scarlett and RYUKI-7900XT | Not ported: Scarlett's block-scoped `restored_lanes` and `NAN_GUARD_STORES`. ### Overlap with open work - **#114** (open) changes `integer_view` for d16 *buffer* accesses through views in tables. #2 here touches only the *image* load/gather path (the `legacyF32ToF16` "shortcut" in `lower.rs`). `9a6c829` on main already covers buffer loads and stores. These are different functions, with no textual conflict expected. - **#184** (open) also bumps `TRANSLATOR_VERSION` 1 → 2. Whichever merges second should go to 3. - **#268 / #308** (open) touch `ir::build` unspill and `spill::build`. #5 here changes only `resource.rs`'s tracer. ## Tests Each switch has a test that fails with the switch off and passes by default (Windows 11, RX 9070 XT, release build): | Test | Off | Result off → on | |---|---|---| | `shadow::window_tests::a_root_view_window_covers_the_memory_committed_after_its_cell` | `VICTORY_ROOT_WINDOW_MB=4` | `left: (…, 4194304) right: (…, 12582912)` → ok | | `shadow::window_tests::a_root_view_reach_is_used_again_within_its_time` | `VICTORY_ROOT_REACH_MS=0` | `left: (…, 4194304) right: (…, 12582912)` → ok | | `emit::picture_fix_tests::a_d16_image_load_keeps_an_integer_views_bits` | `VICTORY_D16_BITS=0` | "the d16 load's integer bits are converted as a float" → ok | | `emit::picture_fix_tests::a_float_colour_export_turns_nan_and_infinity_into_numbers` | `VICTORY_NAN_GUARD=0` | "no NaN guard on the colour export" → ok | | `emit::early_depth_tests::a_pixel_program_tested_before_it_runs_declares_early_depth` (ported) | `VICTORY_EARLY_DEPTH=0` | "the early-depth flag changed nothing" → ok | | `resource::tests::spilled_sgprs_are_not_followed_through_lanes_past_the_wave` | `VICTORY_SPILL_STRICT=0` | "followed through lane 40 of a wave32: Ok([…])" → ok | | `resource::tests::a_bit_mask_from_a_literal_width_is_a_constant` | main's `copy_source` | `left: Value(Value(0)) right: Const(4294963200)` → ok | The DXIL tests read `dxc -dumpbin` text and are skipped when dxc is missing. `dump_dxil` now writes one temp file per call, because two dumps on parallel test threads were writing the same file. **No test for 1c (read lock) or 6 (alias source).** 1c changes only the locking; the existing window tests pass. 6 needs a `HostList` on a device, which the unit tests don't build. ### Crate suites (Windows 11, release, this branch vs `main` c9c932c on the same machine) - `cargo test -p victory-shader --release --lib`: **306 passed, 0 failed, 4 ignored**, with one test skipped: `emit::size_tests::the_record_count_of_a_structured_buffer_read_by_index`. It ends the test process with `STATUS_ACCESS_VIOLATION`, even when run alone, and it does the same on `main`. - `cargo test -p victory-gpu --release --lib`: **385 passed, 0 failed, 34 ignored** on the first run. A later full run had one failure, `watch::tests::a_block_just_written_rests`, which passes 5/5 alone on both this branch and `main`. `main` had a similar one-off failure in `watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view` (`assertion failed: published(two, two + BLOCK)`), which also passes 5/5 alone. These are timing-dependent watch tests, not something these commits touch. - `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in` and `watch::many_askers_tests::holes_are_known_until_the_runtime_tells`, which fail on our Proton build, **pass on Windows on both this branch and `main`**. That points to the Wine environment rather than these changes, but it was not checked under Proton here. ## Not tested - **Nothing was run in game.** There are no in-game measurements of these fixes on this branch, and this PR claims no performance or image gain. The source commits quote their own numbers (e.g. ryuki: driving 17.8 → 18.9 fps median with the read lock, on an RX 7900 XT); those were not reproduced here. - Not run under Wine/Proton: these tests ran on Windows only. - `VICTORY_D16_BITS` checks the value at run time (≤ 0xFFFF or ≥ 0xFFFF8000), not the view's format. A float view returning such a bit pattern as a real denormal would also take the integer path. The source fork made the same choice. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
GiovanniFadanelli commented 2026-11-27 12:29:07 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by GiovanniFadanelli on 2026-11-27T12:29:07Z.


Updated with what came out of the review of these same ports in Victory-Native (Sr-0w/Victory-Native#150, #193 and #194). There are four new commits on top; the six original ones are unchanged.

dd650c4, NaN guard off by default. VICTORY_NAN_GUARD now acts only with =1 and prints one line when it is on. It masked a wrong value and differs from RDNA's own export. TRANSLATOR_VERSION goes 2 → 3.

be5f660, alias-source borrows. Drops two needless borrows that clippy -D warnings rejects. No change in behaviour.

142d74c, d16 by the view's format. A d16 image load or gather no longer guesses an integer view from the value it read: 0xFFFF8000 is both -32768 from an R16_SINT view and a NaN from a float one. The host now marks integer image views in its per-slot table, and the load reads that word through a new root SRV, SLOT_KINDS. TRANSLATOR_VERSION goes 3 → 4. The test emit::d16_tests::a_d16_image_load_converts_by_the_views_kind_not_its_value dispatches on the hardware GPU and WARP with the same texel bits through an integer view and a float view. It fails with the old rule.

f146ed8, no reach cache. This reverts dad08cf. The one-second cache of the committed reach could go stale after a remap at the same address, and Victory-Native dropped it (Sr-0w 884dec4, fb459c8). VICTORY_ROOT_REACH_MS is gone. Three tests cover it: a decommit with no notice, a same-address remap, and a commit that grows the window. The cost is that every root-view window queries Windows again, which the cache had saved; I haven't measured that here.

Checks on Windows 11, RX 9070 XT, release build:
victory-shader tests: 306 passed (the structured-buffer size test that crashes the process on main too was skipped).
victory-gpu tests: 388 passed.
cargo xtask policy: 266 files ok.
Clippy is clean for victory-gpu and victory-shader apart from unnecessary_mut_passed at watch.rs:3626. With --workspace it also stops on the transmute lint in victory-loader/src/descriptor_sites.rs:277. Both lints are already on main, in files this branch doesn't change.

Not checked: nothing was run in game, nothing under Wine/Proton, and the commits are not signed.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7218297776 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/329#issuecomment-7218297776). Originally posted by [GiovanniFadanelli](https://github.com/GiovanniFadanelli) on 2026-11-27T12:29:07Z. --- Updated with what came out of the review of these same ports in Victory-Native (Sr-0w/Victory-Native#150, #193 and #194). There are four new commits on top; the six original ones are unchanged. **dd650c4, NaN guard off by default.** `VICTORY_NAN_GUARD` now acts only with `=1` and prints one line when it is on. It masked a wrong value and differs from RDNA's own export. `TRANSLATOR_VERSION` goes 2 → 3. **be5f660, alias-source borrows.** Drops two needless borrows that `clippy -D warnings` rejects. No change in behaviour. **142d74c, d16 by the view's format.** A d16 image load or gather no longer guesses an integer view from the value it read: `0xFFFF8000` is both -32768 from an `R16_SINT` view and a NaN from a float one. The host now marks integer image views in its per-slot table, and the load reads that word through a new root SRV, `SLOT_KINDS`. `TRANSLATOR_VERSION` goes 3 → 4. The test `emit::d16_tests::a_d16_image_load_converts_by_the_views_kind_not_its_value` dispatches on the hardware GPU and WARP with the same texel bits through an integer view and a float view. It fails with the old rule. **f146ed8, no reach cache.** This reverts dad08cf. The one-second cache of the committed reach could go stale after a remap at the same address, and Victory-Native dropped it (Sr-0w 884dec4, fb459c8). `VICTORY_ROOT_REACH_MS` is gone. Three tests cover it: a decommit with no notice, a same-address remap, and a commit that grows the window. The cost is that every root-view window queries Windows again, which the cache had saved; I haven't measured that here. Checks on Windows 11, RX 9070 XT, release build: victory-shader tests: 306 passed (the structured-buffer size test that crashes the process on main too was skipped). victory-gpu tests: 388 passed. `cargo xtask policy`: 266 files ok. Clippy is clean for victory-gpu and victory-shader apart from `unnecessary_mut_passed` at watch.rs:3626. With `--workspace` it also stops on the transmute lint in victory-loader/src/descriptor_sites.rs:277. Both lints are already on main, in files this branch doesn't change. Not checked: nothing was run in game, nothing under Wine/Proton, and the commits are not signed.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/329:upstream-pr/329'
git switch 'upstream-pr/329'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/329'
git switch 'upstream-pr/329'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/329'
git switch 'upstream-pr/329'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/329'
git switch 'main'
git merge --squash 'upstream-pr/329'
git switch 'main'
git merge --ff-only 'upstream-pr/329'
git switch 'main'
git merge 'upstream-pr/329'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
avatarmanz/VIctory-7900XTX!329
No description provided.