Shaders/structure: require masks in scc_some, active, and wave_any to vanish outside block reach #445

Open
github-bot wants to merge 1 commit from github-bot/gh-445 into main AGit
Owner

@⁠AscilCH on GitHub · 2026-11-25 00:52 UTC · original
AscilCH:fix/shader-structure-vccz-and-scc-some-active → main · +127 −9 · 1 files · 1 commits · open

Problem

In crates/victory-shader/src/structure.rs, three exported wave-mask invariants assumed that lanes not running block b (!cond[b]) hold 0 in the tested mask, without verifying implies(m, cond[b]) against the final block reachability cond[b]:

  1. Structured::scc_some: Exported every non-scc_every entry of self.scc_lane. Because Lower::scc_some computes waveAnyTrue(m) over only the lanes executing the defining block b, operations whose result has 1 bits in inactive lanes outside cond[b] (such as s_not_b32 s2, exec_lo or s_cmp_lg_u32 exec_lo, -1 inside a divergent branch) evaluated to false when hardware sets SCC = 1.
  2. Structured::active: Unconditionally inserted any r.exec write (e.g., s_or_saveexec_b32 s5, -1 widening EXEC to all lanes inside a divergent block) into active, even though lanes outside cond[b] do not participate in b's waveActiveBallot.
  3. Structured::wave_any[b]: Kept Some(any) even when a lane outside cond[b] could determine the branch (!implies(set_bit, cond[b])), which would cause Lower::wave_wide to evaluate waveAnyTrue/waveAllTrue over only cond[b] lanes.
  4. s_cbranch_vccz/s_cbranch_vccnz in branch(): Performed a dead self.b.and(vcc, exec) even though s_cbranch_vccz/vccnz tests VCC independently of EXEC.

Fix

  • In Builder::finish():
    • Export (&scc, &m) into scc_some only when !self.scc_every.contains(&scc) and either self.b.implies(m, cond[b]) or m's support is purely Atom::Uniform(_).
    • Prune self.active entries whose mask m does not imply cond[b] at their defining block b.
    • Clear self.wave_any[b] if a non-uniform wave-mask branch in a reachable block has !self.b.implies(set_bit, cond[b]).
  • Use vcc directly in branch() for s_cbranch_vccz/s_cbranch_vccnz.
  • Add synthetic unit test scc_some_and_active_require_mask_zero_outside_block_reach.

Verification

  • cargo test -p victory-shader --locked structure::tests: 13 passed, 0 failed
  • cargo test -p victory-shader --locked wave64_tests: 5 passed, 0 failed
  • cargo xtask policy: 169 files ok
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean
  • cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: clean

(AI-assisted; synthetic unit tests only, no game data.)

**@⁠AscilCH** on GitHub · 2026-11-25 00:52 UTC · [original](https://github.com/fxceless/victory-fork/pull/445) `AscilCH:fix/shader-structure-vccz-and-scc-some-active` → `main` · +127 −9 · 1 files · 1 commits · open ## Problem In `crates/victory-shader/src/structure.rs`, three exported wave-mask invariants assumed that lanes not running block `b` (`!cond[b]`) hold `0` in the tested mask, without verifying `implies(m, cond[b])` against the final block reachability `cond[b]`: 1. **`Structured::scc_some`**: Exported every non-`scc_every` entry of `self.scc_lane`. Because `Lower::scc_some` computes `waveAnyTrue(m)` over only the lanes executing the defining block `b`, operations whose result has `1` bits in inactive lanes outside `cond[b]` (such as `s_not_b32 s2, exec_lo` or `s_cmp_lg_u32 exec_lo, -1` inside a divergent branch) evaluated to `false` when hardware sets `SCC = 1`. 2. **`Structured::active`**: Unconditionally inserted any `r.exec` write (e.g., `s_or_saveexec_b32 s5, -1` widening `EXEC` to all lanes inside a divergent block) into `active`, even though lanes outside `cond[b]` do not participate in `b`'s `waveActiveBallot`. 3. **`Structured::wave_any[b]`**: Kept `Some(any)` even when a lane outside `cond[b]` could determine the branch (`!implies(set_bit, cond[b])`), which would cause `Lower::wave_wide` to evaluate `waveAnyTrue`/`waveAllTrue` over only `cond[b]` lanes. 4. **`s_cbranch_vccz`/`s_cbranch_vccnz` in `branch()`**: Performed a dead `self.b.and(vcc, exec)` even though `s_cbranch_vccz`/`vccnz` tests `VCC` independently of `EXEC`. ## Fix - In `Builder::finish()`: - Export `(&scc, &m)` into `scc_some` only when `!self.scc_every.contains(&scc)` and either `self.b.implies(m, cond[b])` or `m`'s support is purely `Atom::Uniform(_)`. - Prune `self.active` entries whose mask `m` does not imply `cond[b]` at their defining block `b`. - Clear `self.wave_any[b]` if a non-uniform wave-mask branch in a reachable block has `!self.b.implies(set_bit, cond[b])`. - Use `vcc` directly in `branch()` for `s_cbranch_vccz`/`s_cbranch_vccnz`. - Add synthetic unit test `scc_some_and_active_require_mask_zero_outside_block_reach`. ## Verification - `cargo test -p victory-shader --locked structure::tests`: 13 passed, 0 failed - `cargo test -p victory-shader --locked wave64_tests`: 5 passed, 0 failed - `cargo xtask policy`: 169 files ok - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: clean - `cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings`: clean *(AI-assisted; synthetic unit tests only, no game data.)*
In `structure::Builder::finish`:
1. `scc_some` exported every non-`scc_every` entry of `scc_lane` without checking that the mask is 0 in lanes not reaching its defining block `b` (`cond[b]`). Because `Lower::scc_some` evaluates `waveAnyTrue` over only the lanes running `b`, masks with set bits in inactive lanes (such as `s_not_b32 s2, exec_lo`, `s_cmp_lg_u32 exec_lo, -1`, or `s_andn2_b32 s2, s_outer, exec_lo` inside a divergent branch) returned `false` instead of hardware `SCC = 1`.
2. `active` could retain a widened `EXEC` (e.g. `s_or_saveexec_b32 s5, -1`) written inside a divergent block even though lanes outside `cond[b]` do not participate in `b`'s `waveActiveBallot`.
3. `wave_any[b]` advertised wave-wide `waveAnyTrue`/`waveAllTrue` lowering even when a lane outside `cond[b]` could decide the branch.
4. `branch()` needlessly ANDed `vcc` with `exec` on `s_cbranch_vccz`/`s_cbranch_vccnz` (only a no-op because `s_cbranch_vccz` omits `EXEC` from `inst.reads`).

Enforce `implies(m, cond[b])` (or uniform support) when populating `scc_some`, pruning `active`, and validating `wave_any[b]`, simplify `s_cbranch_vccz`/`vccnz`, and add synthetic unit tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:43:28 +00:00
Author
Owner

@⁠avt0m4t48 on GitHub · 2026-11-25 02:12 UTC · original

I verified 308efd726e621e564115b120522849979b7df6a8 with independent synthetic GFX10 instructions on Linux. I also applied the single PR commit to current main (c96b4f2b8365bf43d54ab074940923ef8267f4c6) and ran the same checks there.

  • In wave32 and wave64, I restricted EXEC to the complement of VCC before testing both VCC branch senses. The parent and unpatched main still advertised wave-wide reduction when only the absent lanes could decide the branch. Both patched trees dropped it. When I restricted EXEC to VCC itself, both branch senses retained their reduction.
  • I tested both SCC branch senses after XORing narrowed EXEC with -1. The parent and unpatched main advertised both scc_some and wave-wide reduction. Both patched trees dropped them. The AND control (EXEC & VCC) retained scc_some, active, and the corresponding wave-wide reduction in both widths.

The parent and unpatched main each passed the two controls and failed the two absent-lane tests. The PR head and patched main passed all four tests (16 total cases). The shader library suite also passed at the PR head (171 passed, 2 ignored) and on patched main (172 passed, 2 ignored).

Synthetic instruction words

The words below are passed little-endian to ir::build, with the corresponding wave64 setting, then checked through structure::structure.

VCC: 7D840680 RESTRICT BF880002 BRANCH 7E020281 BF810000
  RESTRICT inside:  877E6A7E (wave32), 87FE6A7E (wave64)
  RESTRICT outside: 8A7E6A7E (wave32), 8AFE6A7E (wave64)
  BRANCH: BF860001 (VCCZ) or BF870001 (VCCNZ)

SCC: 7D840680 RESTRICT BF880003 MASK_OP BRANCH 7E020281 BF810000
  RESTRICT inside: 877E6A7E (wave32), 87FE6A7E (wave64)
  MASK_OP AND: 87086A7E (wave32), 87886A7E (wave64)
  MASK_OP XOR: 8908C17E (wave32), 8988C17E (wave64)
  BRANCH: BF840001 (SCC0) or BF850001 (SCC1)

cargo check --locked --target x86_64-pc-windows-msvc -p victory-shader --tests passed for both patched trees. These were Windows-target type checks from Linux. The fixture checks the structuring decisions and was run without a D3D12 dispatch.

AI-assisted using Codex.

**@⁠avt0m4t48** on GitHub · 2026-11-25 02:12 UTC · [original](https://github.com/fxceless/victory-fork/pull/445#issuecomment-7150438144) I verified `308efd726e621e564115b120522849979b7df6a8` with independent synthetic GFX10 instructions on Linux. I also applied the single PR commit to current `main` (`c96b4f2b8365bf43d54ab074940923ef8267f4c6`) and ran the same checks there. - In wave32 and wave64, I restricted EXEC to the complement of VCC before testing both VCC branch senses. The parent and unpatched main still advertised wave-wide reduction when only the absent lanes could decide the branch. Both patched trees dropped it. When I restricted EXEC to VCC itself, both branch senses retained their reduction. - I tested both SCC branch senses after XORing narrowed EXEC with `-1`. The parent and unpatched main advertised both `scc_some` and wave-wide reduction. Both patched trees dropped them. The AND control (`EXEC & VCC`) retained `scc_some`, `active`, and the corresponding wave-wide reduction in both widths. The parent and unpatched main each passed the two controls and failed the two absent-lane tests. The PR head and patched main passed all four tests (16 total cases). The shader library suite also passed at the PR head (171 passed, 2 ignored) and on patched main (172 passed, 2 ignored). <details> <summary>Synthetic instruction words</summary> The words below are passed little-endian to `ir::build`, with the corresponding `wave64` setting, then checked through `structure::structure`. ```text VCC: 7D840680 RESTRICT BF880002 BRANCH 7E020281 BF810000 RESTRICT inside: 877E6A7E (wave32), 87FE6A7E (wave64) RESTRICT outside: 8A7E6A7E (wave32), 8AFE6A7E (wave64) BRANCH: BF860001 (VCCZ) or BF870001 (VCCNZ) SCC: 7D840680 RESTRICT BF880003 MASK_OP BRANCH 7E020281 BF810000 RESTRICT inside: 877E6A7E (wave32), 87FE6A7E (wave64) MASK_OP AND: 87086A7E (wave32), 87886A7E (wave64) MASK_OP XOR: 8908C17E (wave32), 8988C17E (wave64) BRANCH: BF840001 (SCC0) or BF850001 (SCC1) ``` </details> `cargo check --locked --target x86_64-pc-windows-msvc -p victory-shader --tests` passed for both patched trees. These were Windows-target type checks from Linux. The fixture checks the structuring decisions and was run without a D3D12 dispatch. AI-assisted using Codex.
Author
Owner

@⁠deepdev237 on GitHub · 2026-11-25 04:26 UTC · original · edited 2026-11-25 05:11 UTC

🤖 AI-generated. This comment was written by Claude Opus 5.5 (Anthropic, model claude-opus-5-5), running as an autonomous agent in Claude Code. The AI did the work it reports: it merged the branches, built, ran the commands, tests and game runs, and read the logs. A person asked for this testing; this text was not reviewed by them before posting. Please verify anything you rely on.

Full test environment
  • OS: Windows 11 Pro, version 10.0.26300 (build 26300)
  • CPU: AMD Ryzen 9 5950X, 16 cores / 32 threads
  • RAM: 24 GB DDR4 at 2666 MT/s; page file 32 GiB on the system drive, Windows commit limit 55.92 GiB
  • GPU: AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32015.7029 (dated 2026-10-18); D3D12 reports host wave lanes min 32 / max 64; DXGI local video memory budget 15,419 MB; mesh shaders and shader model 6.6 available
  • Also installed: a virtual display adapter (Parsec Virtual Display Adapter 0.45). VIctory ran on the RX 9060 XT.
  • Toolchain: rustc 1.98.1 (48a229cea 2026-09-01), cargo 1.98.1 (797e8a9bc 2026-08-05), LLVM 22.1.8, host x86_64-pc-windows-msvc
  • Build: cargo build --profile diag -p victory --features diagnostics (diag = release + debug info)
  • Base: victory-fork main 310c6eb6c16822ab95076aad61fce19bba86bb98
  • Game files: Series X build 1.0.2.1. This copy has zero-filled holes in 11 archives (about 338 MiB in all: levels.rpf, audio.rpf, pack/story000/story000.rpf, navmeshes.rpf and six data/ttdb/*.ttpf), so failures that depend on those bytes are not emulator bugs.
  • Full logs (local paths shortened): https://gist.github.com/deepdev237/785e05b02d0dcece7aac1303f7fe4ba8

Regression report: with this PR, about 1,300 more shader programs are refused (emit: a lane mask holding lanes elsewhere read as data).

I measured it with victory translate --jobs 16 shaders.rpf (diagnostics build, cargo build --profile diag -p victory --features diagnostics). The same game files were used for every build (Series X, 26,503 containers, 614 duplicates skipped, 26,084 programs).

build VS/PS emitted compute emitted mesh emitted refused in total lane mask holding lanes elsewhere read as data
main 310c6eb 14,164 / 14,247 2,672 / 2,682 8,762 / 8,765 96 2
main 310c6eb + this PR (head merged alone) 13,778 / 14,247 1,777 / 2,682 8,738 / 8,765 1,401 1,306
310c6eb + about 110 other open PRs, with this PR 13,813 / 14,247 1,780 / 2,682 8,738 / 8,765 1,547 1,311
the same integration, with only this PR reverted 14,199 / 14,247 2,679 / 2,682 8,762 / 8,765 54 3

Compute takes the biggest hit: 895 compute programs that translate on main are refused with this PR. Examples of programs that translate on main and are refused with it:

  • MSNC_VS_PropFoliageSkinDeferredFire_4352f5e1_Wrapped #e9b286358963f668 ~4623c785 Ms at 0x2624
  • MS_VS_PropFoliageDeferredFire_7cf79608_Wrapped #3e3a42eff1581db4 ~ae28707a Ms at 0x7830

Reproduce in under a second, with no full-pack run:

VICTORY_TRANSLATE_ONLY=e9b286358963f668 victory translate --jobs 4 shaders.rpf

On main it gives 1 emitted of 1 mesh programs; with this PR, 0 emitted and the reason above.

Where it comes from, as far as I can tell: Lower::mask_dword (emit/lower.rs) refuses with MASK_ELSEWHERE when the mask's value is not in self.x.st.active and the "whole" exception does not apply. This PR makes active stricter ("vanish outside block reach"), so many more masks read as data leave active and hit that return Err(MASK_ELSEWHERE). The stricter active may well be more correct for scc_some / wave_any. If so, mask_dword, or what feeds its "whole" exception, probably needs a matching change so these masks are still turned into ballots instead of refused. Otherwise this trades a theoretical miscompile for about 1,300 shaders the game simply goes without (foliage, fire and a large part of the compute work).

Machine: AMD Radeon RX 9060 XT (RDNA4, host wave lanes min 32 / max 64, driver 32.0.32015.7029), Ryzen 9 5950X, 24 GB RAM, Windows 11 build 26300, rustc 1.98.1. I have reverted this PR in my integration build for now.

Full victory translate summaries of the four builds

main 310c6eb

containers   26503 (614 duplicates skipped)
programs     26084 translated of 26084 (40597693 IR instructions)
structured   26084 of 26084 (32535818 vector instructions, 791463 guarded, 28075 on opaque masks; branches 795624 per lane, 360833 uniform)
resources    25889 of 26084 tracked (descriptors 2596542 loaded, 126843 built, 174561 constant; 1269812 scalar accesses; 218896 with a computed term)
  used-resource entries 437642: 187 not traced {"Cbv via Constants": 17, "Cbv via Table": 33, "Sampler via ImmediateSampler": 22, "Srv via Table": 115}; 0 traced parameters not listed
I/O          14247 of 14247 vertex and pixel programs raised (178564 interpolations, 6888 vertex values; exports {"color": 29217, "depth": 1170, "null": 6476, "param": 9143, "position": 2222, "unread param": 154}, 0 still f16 pairs)
DXIL         14164 emitted of 14247 vertex and pixel programs; 0 validated, 0 pipelines
             2672 emitted of 2682 compute programs; 0 validated, 0 pipelines
             8762 emitted of 8765 mesh programs; 0 validated, 0 pipelines
      195  resources: an address in an SGPR that is no root parameter  (e.g. E:\GTA 6\shaders.rpf@0xbd9854e GS_VoxelizeGeneric_912dfba0_Wrapped #4bd913bd11d2201b ~6175b5b6 Gs at 0x44)
       40  emit: a descriptor chosen by control flow  (e.g. E:\GTA 6\shaders.rpf@0xaf0ac48 PS_TexturedLit_ReflectionMap_7c954400_Wrapped #36fcfa1f850bdcf1 ~9b12ca82 Ps at 0x2c8)
       40  emit: a descriptor read only as data  (e.g. E:\GTA 6\shaders.rpf@0x9a6eae6 PS_PuddleDetect_799735bb_Wrapped #94eb41dd5c3930e7 ~8b80389f Ps at 0x4af0)
       10  emit: a hardware SGPR input  (e.g. E:\GTA 6\shaders.rpf@0x5502f06 PS_PedTexturedCutOutTint_Zero_8aeae56d_Wrapped #aafcf40b30b9df18 ~7a72866a Ps at 0x2dbc)
        2  emit: a lane mask holding lanes elsewhere read as data  (e.g. E:\GTA 6\shaders.rpf@0xf6d2c02 water_shading:CS_TransmissionVolumetricsSubmerged_bbfb2953_Wrapped #926c46bab3b86bd6 ~58d713c6 Cs at 0x13c8)
        2  emit: a wave sum of 16-bit floats where not every lane runs  (e.g. E:\GTA 6\shaders.rpf@0xbf966a5 compute_graph_ops:CS_TransposeVecMatMulOperation_5b98b712_Wrapped #a26a38d61f256901 ~8cc5b006 Cs at 0x360)
        1  emit: a descriptor's address or format read as data  (e.g. E:\GTA 6\shaders.rpf@0xd4aeee4 ShallowWaterSim:CS_MinTimestepReduce_5447091c_Wrapped #ceb5eb68cd99cb07 ~d7ad3b49 Cs at 0x38)
        1  emit: an opaque lane mask  (e.g. E:\GTA 6\shaders.rpf@0xbac5bbe PS_VoxelizeVisiblity_f406ea93_Wrapped #405bfb31f54125ae ~9d10a8b4 Ps at 0x1020)

main 310c6eb + this PR (head 308efd726e621e564115b120522849979b7df6a8) merged alone

containers   26503 (614 duplicates skipped)
programs     26084 translated of 26084 (40597693 IR instructions)
structured   26084 of 26084 (32535818 vector instructions, 791463 guarded, 28075 on opaque masks; branches 795624 per lane, 360833 uniform)
resources    25889 of 26084 tracked (descriptors 2596542 loaded, 126843 built, 174561 constant; 1269812 scalar accesses; 218896 with a computed term)
  used-resource entries 437642: 187 not traced {"Cbv via Constants": 17, "Cbv via Table": 33, "Sampler via ImmediateSampler": 22, "Srv via Table": 115}; 0 traced parameters not listed
I/O          14247 of 14247 vertex and pixel programs raised (178564 interpolations, 6888 vertex values; exports {"color": 29217, "depth": 1170, "null": 6476, "param": 9143, "position": 2222, "unread param": 154}, 0 still f16 pairs)
DXIL         13778 emitted of 14247 vertex and pixel programs; 0 validated, 0 pipelines
             1777 emitted of 2682 compute programs; 0 validated, 0 pipelines
             8738 emitted of 8765 mesh programs; 0 validated, 0 pipelines
     1306  emit: a lane mask holding lanes elsewhere read as data  (e.g. E:\GTA 6\shaders.rpf@0x47b744a MS_VS_PropFoliageDeferredFire_7cf79608_Wrapped #3e3a42eff1581db4 ~ae28707a Ms at 0x7830)
      195  resources: an address in an SGPR that is no root parameter  (e.g. E:\GTA 6\shaders.rpf@0xbd87673 GS_VoxelizeGeneric_912dfba0_Wrapped #25d0d8a77d89a6bf ~9fa26232 Gs at 0x44)
       40  emit: a descriptor chosen by control flow  (e.g. E:\GTA 6\shaders.rpf@0x46110dd MST_DS_CascadeShadows_PNTriTexture_f20f9e0d_Wrapped #925d917ce78662eb ~feab4e73 Ms at 0x1bec)
       40  emit: a descriptor read only as data  (e.g. E:\GTA 6\shaders.rpf@0x9ae93c7 PS_PuddleDetect_2dd9cfaa_Wrapped #dbe05c1e82f10e1a ~5a68da6f Ps at 0x4d28)
       10  emit: a hardware SGPR input  (e.g. E:\GTA 6\shaders.rpf@0x5506e5a PS_PedTexturedCutOutTint_Zero_d215f36c_Wrapped #a76619e2dcb45652 ~9305cb8b Ps at 0x2dbc)
        2  emit: a wave sum of 16-bit floats where not every lane runs  (e.g. E:\GTA 6\shaders.rpf@0xbf966a5 compute_graph_ops:CS_TransposeVecMatMulOperation_5b98b712_Wrapped #a26a38d61f256901 ~8cc5b006 Cs at 0x360)
        1  emit: a descriptor's address or format read as data  (e.g. E:\GTA 6\shaders.rpf@0xd4aeee4 ShallowWaterSim:CS_MinTimestepReduce_5447091c_Wrapped #ceb5eb68cd99cb07 ~d7ad3b49 Cs at 0x38)
        1  emit: a select on an untracked mask  (e.g. E:\GTA 6\shaders.rpf@0xf6c0e2e water_shading:CS_TransmissionVolumetrics_bd25dcd5_Wrapped #6871d6e4b3ac9a10 ~66f0a564 Cs at 0x24cc)
        1  emit: an opaque lane mask  (e.g. E:\GTA 6\shaders.rpf@0xbac5bbe PS_VoxelizeVisiblity_f406ea93_Wrapped #405bfb31f54125ae ~9d10a8b4 Ps at 0x1020)

integration (310c6eb + about 110 open PRs) with this PR

containers   26503 (614 duplicates skipped)
programs     26084 translated of 26084 (40597693 IR instructions)
structured   26084 of 26084 (32535818 vector instructions, 791463 guarded, 28075 on opaque masks; branches 795624 per lane, 360833 uniform)
resources    25889 of 26084 tracked (descriptors 2596542 loaded, 126843 built, 174561 constant; 1269812 scalar accesses; 218896 with a computed term)
  used-resource entries 437642: 187 not traced {"Cbv via Constants": 17, "Cbv via Table": 33, "Sampler via ImmediateSampler": 22, "Srv via Table": 115}; 0 traced parameters not listed
I/O          14247 of 14247 vertex and pixel programs raised (178564 interpolations, 6888 vertex values; exports {"color": 29217, "depth": 1170, "null": 6476, "param": 9143, "position": 2222, "unread param": 154}, 0 still f16 pairs)
DXIL         13813 emitted of 14247 vertex and pixel programs; 0 validated, 0 pipelines
             1780 emitted of 2682 compute programs; 0 validated, 0 pipelines
             8738 emitted of 8765 mesh programs; 0 validated, 0 pipelines
     1311  emit: a lane mask holding lanes elsewhere read as data  (e.g. E:\GTA 6\shaders.rpf@0x4753554 MSNC_VS_PropFoliageSkinDeferredFire_4352f5e1_Wrapped #e9b286358963f668 ~4623c785 Ms at 0x2624)
      195  resources: an address in an SGPR that is no root parameter  (e.g. E:\GTA 6\shaders.rpf@0xbdd5af4 GS_VoxelizeGeneric_fc3c3220_Wrapped #f99bdc027b733ed9 ~7c49f161 Gs at 0x44)
       40  emit: a descriptor chosen by control flow  (e.g. E:\GTA 6\shaders.rpf@0x460d2d5 MST_DS_TerrainTransform_bf04fd13_Wrapped #efce39ec51c443c0 ~990fd0d9 Ms at 0x1b04)
       10  emit: a hardware SGPR input  (e.g. E:\GTA 6\shaders.rpf@0x54811f2 PS_PedTexturedCutOutTint_Zero_8aeae56d_Wrapped #f0296ce9fbe481cb ~245f60ab Ps at 0x2dbc)
        1  emit: a select on an untracked mask  (e.g. E:\GTA 6\shaders.rpf@0xf6c0e2e water_shading:CS_TransmissionVolumetrics_bd25dcd5_Wrapped #6871d6e4b3ac9a10 ~66f0a564 Cs at 0x24cc)
        1  emit: an opaque lane mask  (e.g. E:\GTA 6\shaders.rpf@0xbac5bbe PS_VoxelizeVisiblity_f406ea93_Wrapped #405bfb31f54125ae ~9d10a8b4 Ps at 0x1020)

the same integration with only this PR reverted

containers   26503 (614 duplicates skipped)
programs     26084 translated of 26084 (40597693 IR instructions)
structured   26084 of 26084 (32535818 vector instructions, 791463 guarded, 28075 on opaque masks; branches 795624 per lane, 360833 uniform)
resources    25889 of 26084 tracked (descriptors 2596542 loaded, 126843 built, 174561 constant; 1269812 scalar accesses; 218896 with a computed term)
  used-resource entries 437642: 187 not traced {"Cbv via Constants": 17, "Cbv via Table": 33, "Sampler via ImmediateSampler": 22, "Srv via Table": 115}; 0 traced parameters not listed
I/O          14247 of 14247 vertex and pixel programs raised (178564 interpolations, 6888 vertex values; exports {"color": 29217, "depth": 1170, "null": 6476, "param": 9143, "position": 2222, "unread param": 154}, 0 still f16 pairs)
DXIL         14199 emitted of 14247 vertex and pixel programs; 0 validated, 0 pipelines
             2679 emitted of 2682 compute programs; 0 validated, 0 pipelines
             8762 emitted of 8765 mesh programs; 0 validated, 0 pipelines
      195  resources: an address in an SGPR that is no root parameter  (e.g. E:\GTA 6\shaders.rpf@0xbda1062 GS_VoxelizeGeneric_f406ea93_Wrapped #fada957fadee229b ~6d6a93de Gs at 0x44)
       40  emit: a descriptor chosen by control flow  (e.g. E:\GTA 6\shaders.rpf@0xaf19cdc PS_TexturedDeferred_b939d3e0_Wrapped #103ee468bb36e9f7 ~0c5a2706 Ps at 0x79c)
       10  emit: a hardware SGPR input  (e.g. E:\GTA 6\shaders.rpf@0x54811f2 PS_PedTexturedCutOutTint_Zero_8aeae56d_Wrapped #f0296ce9fbe481cb ~245f60ab Ps at 0x2dbc)
        3  emit: a lane mask holding lanes elsewhere read as data  (e.g. E:\GTA 6\shaders.rpf@0xf6d2c02 water_shading:CS_TransmissionVolumetricsSubmerged_bbfb2953_Wrapped #926c46bab3b86bd6 ~58d713c6 Cs at 0x13c8)
        1  emit: an opaque lane mask  (e.g. E:\GTA 6\shaders.rpf@0xbac5bbe PS_VoxelizeVisiblity_f406ea93_Wrapped #405bfb31f54125ae ~9d10a8b4 Ps at 0x1020)

Command for each: victory translate --jobs 16 shaders.rpf with that build's diagnostics executable (main's executable SHA-256 f435e71eed706b620cbaff0f513e83e4506a56bdd2225ea24dd9b2d6b97d80bd). Every build used the same game files and the same machine. The single-shader reproduction runs in 0.3 s.

**@⁠deepdev237** on GitHub · 2026-11-25 04:26 UTC · [original](https://github.com/fxceless/victory-fork/pull/445#issuecomment-7152838640) · edited 2026-11-25 05:11 UTC > 🤖 **AI-generated.** This comment was written by **Claude Opus 5.5** (Anthropic, model `claude-opus-5-5`), running as an autonomous agent in **Claude Code**. The AI did the work it reports: it merged the branches, built, ran the commands, tests and game runs, and read the logs. A person asked for this testing; this text was not reviewed by them before posting. Please verify anything you rely on. <details><summary>Full test environment</summary> - OS: Windows 11 Pro, version 10.0.26300 (build 26300) - CPU: AMD Ryzen 9 5950X, 16 cores / 32 threads - RAM: 24 GB DDR4 at 2666 MT/s; page file 32 GiB on the system drive, Windows commit limit 55.92 GiB - GPU: AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32015.7029 (dated 2026-10-18); D3D12 reports host wave lanes min 32 / max 64; DXGI local video memory budget 15,419 MB; mesh shaders and shader model 6.6 available - Also installed: a virtual display adapter (Parsec Virtual Display Adapter 0.45). VIctory ran on the RX 9060 XT. - Toolchain: rustc 1.98.1 (48a229cea 2026-09-01), cargo 1.98.1 (797e8a9bc 2026-08-05), LLVM 22.1.8, host `x86_64-pc-windows-msvc` - Build: `cargo build --profile diag -p victory --features diagnostics` (`diag` = release + debug info) - Base: victory-fork `main` `310c6eb6c16822ab95076aad61fce19bba86bb98` - Game files: Series X build 1.0.2.1. This copy has zero-filled holes in 11 archives (about 338 MiB in all: `levels.rpf`, `audio.rpf`, `pack/story000/story000.rpf`, `navmeshes.rpf` and six `data/ttdb/*.ttpf`), so failures that depend on those bytes are not emulator bugs. - Full logs (local paths shortened): https://gist.github.com/deepdev237/785e05b02d0dcece7aac1303f7fe4ba8 </details> **Regression report: with this PR, about 1,300 more shader programs are refused (`emit: a lane mask holding lanes elsewhere read as data`).** I measured it with `victory translate --jobs 16 shaders.rpf` (diagnostics build, `cargo build --profile diag -p victory --features diagnostics`). The same game files were used for every build (Series X, 26,503 containers, 614 duplicates skipped, 26,084 programs). | build | VS/PS emitted | compute emitted | mesh emitted | refused in total | `lane mask holding lanes elsewhere read as data` | |---|---|---|---|---|---| | `main` `310c6eb` | 14,164 / 14,247 | 2,672 / 2,682 | 8,762 / 8,765 | **96** | 2 | | `main` `310c6eb` + this PR (head merged alone) | 13,778 / 14,247 | 1,777 / 2,682 | 8,738 / 8,765 | **1,401** | **1,306** | | `310c6eb` + about 110 other open PRs, with this PR | 13,813 / 14,247 | 1,780 / 2,682 | 8,738 / 8,765 | 1,547 | 1,311 | | the same integration, with only this PR reverted | 14,199 / 14,247 | 2,679 / 2,682 | 8,762 / 8,765 | 54 | 3 | Compute takes the biggest hit: 895 compute programs that translate on `main` are refused with this PR. Examples of programs that translate on `main` and are refused with it: - `MSNC_VS_PropFoliageSkinDeferredFire_4352f5e1_Wrapped #e9b286358963f668 ~4623c785 Ms at 0x2624` - `MS_VS_PropFoliageDeferredFire_7cf79608_Wrapped #3e3a42eff1581db4 ~ae28707a Ms at 0x7830` Reproduce in under a second, with no full-pack run: ``` VICTORY_TRANSLATE_ONLY=e9b286358963f668 victory translate --jobs 4 shaders.rpf ``` On `main` it gives `1 emitted of 1 mesh programs`; with this PR, `0 emitted` and the reason above. Where it comes from, as far as I can tell: `Lower::mask_dword` (`emit/lower.rs`) refuses with `MASK_ELSEWHERE` when the mask's value is not in `self.x.st.active` and the "whole" exception does not apply. This PR makes `active` stricter ("vanish outside block reach"), so many more masks read as data leave `active` and hit that `return Err(MASK_ELSEWHERE)`. The stricter `active` may well be more correct for `scc_some` / `wave_any`. If so, `mask_dword`, or what feeds its "whole" exception, probably needs a matching change so these masks are still turned into ballots instead of refused. Otherwise this trades a theoretical miscompile for about 1,300 shaders the game simply goes without (foliage, fire and a large part of the compute work). Machine: AMD Radeon RX 9060 XT (RDNA4, host wave lanes min 32 / max 64, driver 32.0.32015.7029), Ryzen 9 5950X, 24 GB RAM, Windows 11 build 26300, rustc 1.98.1. I have reverted this PR in my integration build for now. <details><summary>Full <code>victory translate</code> summaries of the four builds</summary> **`main` `310c6eb`** ``` containers 26503 (614 duplicates skipped) programs 26084 translated of 26084 (40597693 IR instructions) structured 26084 of 26084 (32535818 vector instructions, 791463 guarded, 28075 on opaque masks; branches 795624 per lane, 360833 uniform) resources 25889 of 26084 tracked (descriptors 2596542 loaded, 126843 built, 174561 constant; 1269812 scalar accesses; 218896 with a computed term) used-resource entries 437642: 187 not traced {"Cbv via Constants": 17, "Cbv via Table": 33, "Sampler via ImmediateSampler": 22, "Srv via Table": 115}; 0 traced parameters not listed I/O 14247 of 14247 vertex and pixel programs raised (178564 interpolations, 6888 vertex values; exports {"color": 29217, "depth": 1170, "null": 6476, "param": 9143, "position": 2222, "unread param": 154}, 0 still f16 pairs) DXIL 14164 emitted of 14247 vertex and pixel programs; 0 validated, 0 pipelines 2672 emitted of 2682 compute programs; 0 validated, 0 pipelines 8762 emitted of 8765 mesh programs; 0 validated, 0 pipelines 195 resources: an address in an SGPR that is no root parameter (e.g. E:\GTA 6\shaders.rpf@0xbd9854e GS_VoxelizeGeneric_912dfba0_Wrapped #4bd913bd11d2201b ~6175b5b6 Gs at 0x44) 40 emit: a descriptor chosen by control flow (e.g. E:\GTA 6\shaders.rpf@0xaf0ac48 PS_TexturedLit_ReflectionMap_7c954400_Wrapped #36fcfa1f850bdcf1 ~9b12ca82 Ps at 0x2c8) 40 emit: a descriptor read only as data (e.g. E:\GTA 6\shaders.rpf@0x9a6eae6 PS_PuddleDetect_799735bb_Wrapped #94eb41dd5c3930e7 ~8b80389f Ps at 0x4af0) 10 emit: a hardware SGPR input (e.g. E:\GTA 6\shaders.rpf@0x5502f06 PS_PedTexturedCutOutTint_Zero_8aeae56d_Wrapped #aafcf40b30b9df18 ~7a72866a Ps at 0x2dbc) 2 emit: a lane mask holding lanes elsewhere read as data (e.g. E:\GTA 6\shaders.rpf@0xf6d2c02 water_shading:CS_TransmissionVolumetricsSubmerged_bbfb2953_Wrapped #926c46bab3b86bd6 ~58d713c6 Cs at 0x13c8) 2 emit: a wave sum of 16-bit floats where not every lane runs (e.g. E:\GTA 6\shaders.rpf@0xbf966a5 compute_graph_ops:CS_TransposeVecMatMulOperation_5b98b712_Wrapped #a26a38d61f256901 ~8cc5b006 Cs at 0x360) 1 emit: a descriptor's address or format read as data (e.g. E:\GTA 6\shaders.rpf@0xd4aeee4 ShallowWaterSim:CS_MinTimestepReduce_5447091c_Wrapped #ceb5eb68cd99cb07 ~d7ad3b49 Cs at 0x38) 1 emit: an opaque lane mask (e.g. E:\GTA 6\shaders.rpf@0xbac5bbe PS_VoxelizeVisiblity_f406ea93_Wrapped #405bfb31f54125ae ~9d10a8b4 Ps at 0x1020) ``` **`main` `310c6eb` + this PR (head `308efd726e621e564115b120522849979b7df6a8`) merged alone** ``` containers 26503 (614 duplicates skipped) programs 26084 translated of 26084 (40597693 IR instructions) structured 26084 of 26084 (32535818 vector instructions, 791463 guarded, 28075 on opaque masks; branches 795624 per lane, 360833 uniform) resources 25889 of 26084 tracked (descriptors 2596542 loaded, 126843 built, 174561 constant; 1269812 scalar accesses; 218896 with a computed term) used-resource entries 437642: 187 not traced {"Cbv via Constants": 17, "Cbv via Table": 33, "Sampler via ImmediateSampler": 22, "Srv via Table": 115}; 0 traced parameters not listed I/O 14247 of 14247 vertex and pixel programs raised (178564 interpolations, 6888 vertex values; exports {"color": 29217, "depth": 1170, "null": 6476, "param": 9143, "position": 2222, "unread param": 154}, 0 still f16 pairs) DXIL 13778 emitted of 14247 vertex and pixel programs; 0 validated, 0 pipelines 1777 emitted of 2682 compute programs; 0 validated, 0 pipelines 8738 emitted of 8765 mesh programs; 0 validated, 0 pipelines 1306 emit: a lane mask holding lanes elsewhere read as data (e.g. E:\GTA 6\shaders.rpf@0x47b744a MS_VS_PropFoliageDeferredFire_7cf79608_Wrapped #3e3a42eff1581db4 ~ae28707a Ms at 0x7830) 195 resources: an address in an SGPR that is no root parameter (e.g. E:\GTA 6\shaders.rpf@0xbd87673 GS_VoxelizeGeneric_912dfba0_Wrapped #25d0d8a77d89a6bf ~9fa26232 Gs at 0x44) 40 emit: a descriptor chosen by control flow (e.g. E:\GTA 6\shaders.rpf@0x46110dd MST_DS_CascadeShadows_PNTriTexture_f20f9e0d_Wrapped #925d917ce78662eb ~feab4e73 Ms at 0x1bec) 40 emit: a descriptor read only as data (e.g. E:\GTA 6\shaders.rpf@0x9ae93c7 PS_PuddleDetect_2dd9cfaa_Wrapped #dbe05c1e82f10e1a ~5a68da6f Ps at 0x4d28) 10 emit: a hardware SGPR input (e.g. E:\GTA 6\shaders.rpf@0x5506e5a PS_PedTexturedCutOutTint_Zero_d215f36c_Wrapped #a76619e2dcb45652 ~9305cb8b Ps at 0x2dbc) 2 emit: a wave sum of 16-bit floats where not every lane runs (e.g. E:\GTA 6\shaders.rpf@0xbf966a5 compute_graph_ops:CS_TransposeVecMatMulOperation_5b98b712_Wrapped #a26a38d61f256901 ~8cc5b006 Cs at 0x360) 1 emit: a descriptor's address or format read as data (e.g. E:\GTA 6\shaders.rpf@0xd4aeee4 ShallowWaterSim:CS_MinTimestepReduce_5447091c_Wrapped #ceb5eb68cd99cb07 ~d7ad3b49 Cs at 0x38) 1 emit: a select on an untracked mask (e.g. E:\GTA 6\shaders.rpf@0xf6c0e2e water_shading:CS_TransmissionVolumetrics_bd25dcd5_Wrapped #6871d6e4b3ac9a10 ~66f0a564 Cs at 0x24cc) 1 emit: an opaque lane mask (e.g. E:\GTA 6\shaders.rpf@0xbac5bbe PS_VoxelizeVisiblity_f406ea93_Wrapped #405bfb31f54125ae ~9d10a8b4 Ps at 0x1020) ``` **integration (`310c6eb` + about 110 open PRs) with this PR** ``` containers 26503 (614 duplicates skipped) programs 26084 translated of 26084 (40597693 IR instructions) structured 26084 of 26084 (32535818 vector instructions, 791463 guarded, 28075 on opaque masks; branches 795624 per lane, 360833 uniform) resources 25889 of 26084 tracked (descriptors 2596542 loaded, 126843 built, 174561 constant; 1269812 scalar accesses; 218896 with a computed term) used-resource entries 437642: 187 not traced {"Cbv via Constants": 17, "Cbv via Table": 33, "Sampler via ImmediateSampler": 22, "Srv via Table": 115}; 0 traced parameters not listed I/O 14247 of 14247 vertex and pixel programs raised (178564 interpolations, 6888 vertex values; exports {"color": 29217, "depth": 1170, "null": 6476, "param": 9143, "position": 2222, "unread param": 154}, 0 still f16 pairs) DXIL 13813 emitted of 14247 vertex and pixel programs; 0 validated, 0 pipelines 1780 emitted of 2682 compute programs; 0 validated, 0 pipelines 8738 emitted of 8765 mesh programs; 0 validated, 0 pipelines 1311 emit: a lane mask holding lanes elsewhere read as data (e.g. E:\GTA 6\shaders.rpf@0x4753554 MSNC_VS_PropFoliageSkinDeferredFire_4352f5e1_Wrapped #e9b286358963f668 ~4623c785 Ms at 0x2624) 195 resources: an address in an SGPR that is no root parameter (e.g. E:\GTA 6\shaders.rpf@0xbdd5af4 GS_VoxelizeGeneric_fc3c3220_Wrapped #f99bdc027b733ed9 ~7c49f161 Gs at 0x44) 40 emit: a descriptor chosen by control flow (e.g. E:\GTA 6\shaders.rpf@0x460d2d5 MST_DS_TerrainTransform_bf04fd13_Wrapped #efce39ec51c443c0 ~990fd0d9 Ms at 0x1b04) 10 emit: a hardware SGPR input (e.g. E:\GTA 6\shaders.rpf@0x54811f2 PS_PedTexturedCutOutTint_Zero_8aeae56d_Wrapped #f0296ce9fbe481cb ~245f60ab Ps at 0x2dbc) 1 emit: a select on an untracked mask (e.g. E:\GTA 6\shaders.rpf@0xf6c0e2e water_shading:CS_TransmissionVolumetrics_bd25dcd5_Wrapped #6871d6e4b3ac9a10 ~66f0a564 Cs at 0x24cc) 1 emit: an opaque lane mask (e.g. E:\GTA 6\shaders.rpf@0xbac5bbe PS_VoxelizeVisiblity_f406ea93_Wrapped #405bfb31f54125ae ~9d10a8b4 Ps at 0x1020) ``` **the same integration with only this PR reverted** ``` containers 26503 (614 duplicates skipped) programs 26084 translated of 26084 (40597693 IR instructions) structured 26084 of 26084 (32535818 vector instructions, 791463 guarded, 28075 on opaque masks; branches 795624 per lane, 360833 uniform) resources 25889 of 26084 tracked (descriptors 2596542 loaded, 126843 built, 174561 constant; 1269812 scalar accesses; 218896 with a computed term) used-resource entries 437642: 187 not traced {"Cbv via Constants": 17, "Cbv via Table": 33, "Sampler via ImmediateSampler": 22, "Srv via Table": 115}; 0 traced parameters not listed I/O 14247 of 14247 vertex and pixel programs raised (178564 interpolations, 6888 vertex values; exports {"color": 29217, "depth": 1170, "null": 6476, "param": 9143, "position": 2222, "unread param": 154}, 0 still f16 pairs) DXIL 14199 emitted of 14247 vertex and pixel programs; 0 validated, 0 pipelines 2679 emitted of 2682 compute programs; 0 validated, 0 pipelines 8762 emitted of 8765 mesh programs; 0 validated, 0 pipelines 195 resources: an address in an SGPR that is no root parameter (e.g. E:\GTA 6\shaders.rpf@0xbda1062 GS_VoxelizeGeneric_f406ea93_Wrapped #fada957fadee229b ~6d6a93de Gs at 0x44) 40 emit: a descriptor chosen by control flow (e.g. E:\GTA 6\shaders.rpf@0xaf19cdc PS_TexturedDeferred_b939d3e0_Wrapped #103ee468bb36e9f7 ~0c5a2706 Ps at 0x79c) 10 emit: a hardware SGPR input (e.g. E:\GTA 6\shaders.rpf@0x54811f2 PS_PedTexturedCutOutTint_Zero_8aeae56d_Wrapped #f0296ce9fbe481cb ~245f60ab Ps at 0x2dbc) 3 emit: a lane mask holding lanes elsewhere read as data (e.g. E:\GTA 6\shaders.rpf@0xf6d2c02 water_shading:CS_TransmissionVolumetricsSubmerged_bbfb2953_Wrapped #926c46bab3b86bd6 ~58d713c6 Cs at 0x13c8) 1 emit: an opaque lane mask (e.g. E:\GTA 6\shaders.rpf@0xbac5bbe PS_VoxelizeVisiblity_f406ea93_Wrapped #405bfb31f54125ae ~9d10a8b4 Ps at 0x1020) ``` Command for each: `victory translate --jobs 16 shaders.rpf` with that build's diagnostics executable (`main`'s executable SHA-256 `f435e71eed706b620cbaff0f513e83e4506a56bdd2225ea24dd9b2d6b97d80bd`). Every build used the same game files and the same machine. The single-shader reproduction runs in 0.3 s. </details>
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/445/head:github-bot/gh-445'
git switch 'github-bot/gh-445'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-445'
git switch 'github-bot/gh-445'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-445'
git switch 'github-bot/gh-445'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-445'
git switch 'main'
git merge --squash 'github-bot/gh-445'
git switch 'main'
git merge --ff-only 'github-bot/gh-445'
git switch 'main'
git merge 'github-bot/gh-445'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.