Shaders: track every incoming edge of a lane-mask phi #385

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

@⁠nathanbzrr on GitHub · 2026-11-24 02:50 UTC · original
nathanbzrr:shaders/lane-mask-phi-joins → main · +1175 −133 · 4 files · 1 commits · open

Addresses the a lane-mask join of an untracked mask translation failure category listed in #293 (3 shaders / ~66 dropped draws and dispatches per frame, including compute 2561af9577c47289 and pixel b37565055f2f7d3b).

Problem

When a lane-mask Phi merges a tracked mask with a constant or scalar-built mask (for example an exit-mask or accumulator phi initialized to 0 before a branch/loop, or reset to a constant on a back edge), structure previously failed with a lane-mask join of an untracked mask instead of tracking every incoming edge of the phi.

What changed

  • crates/victory-shader/src/structure.rs:
    • Export per-edge incoming masks for lane-mask phis in Structured::phi_masks via PhiJoin and Lanes::{derived_phis, phi_joins, phi_join_ids}.
    • Check every incoming edge across both joins and phi_joins in Lanes::check_joins, propagating derived status until fixpoint before building phi_masks in finish().
  • crates/victory-shader/src/emit/lower.rs:
    • Resolve pending_masks before data_phis in Lower::fill_phis using Structured::phi_masks.
    • Transitively expand console_lanes through phi_masks (including v_cndmask_b32 and v_*_co_ci_u32 selects) when an incoming edge needs lane-bit extraction of a constant/scalar mask.
    • Set flags::WAVE_OPS in Lower::lane_bit.

Relation to other PRs

  • #320 closes a similar gap inside the wave64-on-wave32 compute console flow, leaving the standard per-lane path and vertex/pixel/mesh stages unchanged. This PR tracks lane-mask phi edges directly in structure and emit::lower across shader stages and both Wave32 and Wave64.

Tests (synthetic GFX10 only, no game files)

  • crates/victory-shader/src/structure.rs:
    • mask_phi_joining_constant_and_compare_records_edge_bools
    • loop_mask_accumulator_from_zero_tracks_phi_and_edges
    • loop_mask_phi_reset_to_constant_on_back_edge
  • crates/victory-shader/src/emit/lower.rs:
    • lane_mask_phi_joining_zero_and_compare_lowers
    • wave64_loop_mask_accumulator_from_zero_lowers
    • lane_mask_phi_with_partial_constant_enables_console_lanes
  • crates/victory-shader/src/emit/valu_tests.rs:
    • lane_mask_phi_joins_execute_correctly (via build_wave32_cs / dispatch_wave32), testing branch join with zero, partial constant mask enabling console_lanes, and loop mask accumulation - validated with dxil.dll and executed on both hardware GPU and WARP.
  • Local checks on commit a345127:
    • rustfmt --edition 2024 --check clean
    • cargo clippy -p victory-shader --all-targets clean (0 warnings)
    • cargo test --workspace (271 passed, 0 failed, 4 ignored)
    • Asset policy hook (151 files ok)

Not verified

  • No game files were used, so in-game shader translation and runtime impact were not measured directly.

No game files. AI-assisted; reviewed and verified with the tests above.

**@⁠nathanbzrr** on GitHub · 2026-11-24 02:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/385) `nathanbzrr:shaders/lane-mask-phi-joins` → `main` · +1175 −133 · 4 files · 1 commits · open Addresses the `a lane-mask join of an untracked mask` translation failure category listed in #293 (3 shaders / ~66 dropped draws and dispatches per frame, including compute `2561af9577c47289` and pixel `b37565055f2f7d3b`). ### Problem When a lane-mask `Phi` merges a tracked mask with a constant or scalar-built mask (for example an exit-mask or accumulator phi initialized to `0` before a branch/loop, or reset to a constant on a back edge), `structure` previously failed with `a lane-mask join of an untracked mask` instead of tracking every incoming edge of the phi. ### What changed - `crates/victory-shader/src/structure.rs`: - Export per-edge incoming masks for lane-mask phis in `Structured::phi_masks` via `PhiJoin` and `Lanes::{derived_phis, phi_joins, phi_join_ids}`. - Check every incoming edge across both `joins` and `phi_joins` in `Lanes::check_joins`, propagating derived status until fixpoint before building `phi_masks` in `finish()`. - `crates/victory-shader/src/emit/lower.rs`: - Resolve `pending_masks` before `data_phis` in `Lower::fill_phis` using `Structured::phi_masks`. - Transitively expand `console_lanes` through `phi_masks` (including `v_cndmask_b32` and `v_*_co_ci_u32` selects) when an incoming edge needs lane-bit extraction of a constant/scalar mask. - Set `flags::WAVE_OPS` in `Lower::lane_bit`. ### Relation to other PRs - #320 closes a similar gap inside the wave64-on-wave32 compute console flow, leaving the standard per-lane path and vertex/pixel/mesh stages unchanged. This PR tracks lane-mask phi edges directly in `structure` and `emit::lower` across shader stages and both Wave32 and Wave64. ### Tests (synthetic GFX10 only, no game files) - `crates/victory-shader/src/structure.rs`: - `mask_phi_joining_constant_and_compare_records_edge_bools` - `loop_mask_accumulator_from_zero_tracks_phi_and_edges` - `loop_mask_phi_reset_to_constant_on_back_edge` - `crates/victory-shader/src/emit/lower.rs`: - `lane_mask_phi_joining_zero_and_compare_lowers` - `wave64_loop_mask_accumulator_from_zero_lowers` - `lane_mask_phi_with_partial_constant_enables_console_lanes` - `crates/victory-shader/src/emit/valu_tests.rs`: - `lane_mask_phi_joins_execute_correctly` (via `build_wave32_cs` / `dispatch_wave32`), testing branch join with zero, partial constant mask enabling `console_lanes`, and loop mask accumulation - validated with `dxil.dll` and executed on both hardware GPU and WARP. - Local checks on commit `a345127`: - `rustfmt --edition 2024 --check` clean - `cargo clippy -p victory-shader --all-targets` clean (0 warnings) - `cargo test --workspace` (271 passed, 0 failed, 4 ignored) - Asset policy hook (`151 files ok`) ### Not verified - No game files were used, so in-game shader translation and runtime impact were not measured directly. No game files. AI-assisted; reviewed and verified with the tests above.
Rebased onto main, reconciled with uniform/per-lane mask-data joins, and
turned `fill_phis` into a fixpoint loop (`fill_mask_phis` +
`fill_data_phis`) so a loop mask phi materialized later by a uniform data
join is always populated instead of emitting an empty `phi i1` (thanks to
@tyr0nsur for identifying this bug).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:02:05 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:23 UTC · original

Thanks @⁠nathanbzrr for this lane-mask phi fix. I tested head a34512768a10ab8996e36f583d6b33f9129b17bd with:

cargo test --locked -p victory-shader --lib lane_mask_phi_joins_execute_correctly -- --test-threads=1

Result: 1 passed, 0 failed (75 filtered out). The synthetic shader test exercises a lane-mask phi join with multiple incoming edges and checks the resulting values. It validates the translator’s modeled case, not execution in a title.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7121973098) Thanks @⁠nathanbzrr for this lane-mask phi fix. I tested head `a34512768a10ab8996e36f583d6b33f9129b17bd` with: ``` cargo test --locked -p victory-shader --lib lane_mask_phi_joins_execute_correctly -- --test-threads=1 ``` Result: 1 passed, 0 failed (75 filtered out). The synthetic shader test exercises a lane-mask phi join with multiple incoming edges and checks the resulting values. It validates the translator’s modeled case, not execution in a title.
Author
Owner

@⁠ghost on GitHub · 2026-11-24 04:30 UTC · original

Tested a345127 with the title on an RX 9060 XT (RDNA4), Windows 11.

Offline, victory translate --list on shaders.rpf, main d2a4bae vs this PR alone (#320 alone for comparison):

refusal main + #385 + #320
a lane-mask join of an untracked mask 39 0 17
an opaque lane mask 29 99 29
compute emitted (of 2,581) 1,693 1,717 1,715

Every join refusal is gone. 24 more compute programs translate; 70 programs now stop at an opaque lane mask.

In the world, pixel shader b37565055f2f7d3b still fails at the same offset (0x5340), now with an opaque lane mask is not supported. In a traced baseline world frame its pipeline dropped 284 mesh dispatches writing a 2560x1440 RGBA16F target that stays all zero, so that case would be worth covering next.

AI-assisted (Claude Code, Claude Opus 5.5); no game data.

**@⁠ghost** on GitHub · 2026-11-24 04:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7122079753) Tested `a345127` with the title on an RX 9060 XT (RDNA4), Windows 11. Offline, `victory translate --list` on `shaders.rpf`, `main` `d2a4bae` vs this PR alone (#320 alone for comparison): | refusal | `main` | + #385 | + #320 | |---|---|---|---| | `a lane-mask join of an untracked mask` | 39 | 0 | 17 | | `an opaque lane mask` | 29 | 99 | 29 | | compute emitted (of 2,581) | 1,693 | 1,717 | 1,715 | Every join refusal is gone. 24 more compute programs translate; 70 programs now stop at `an opaque lane mask`. In the world, pixel shader `b37565055f2f7d3b` still fails at the same offset (`0x5340`), now with `an opaque lane mask is not supported`. In a traced baseline world frame its pipeline dropped 284 mesh dispatches writing a 2560x1440 RGBA16F target that stays all zero, so that case would be worth covering next. AI-assisted (Claude Code, Claude Opus 5.5); no game data.
Author
Owner

@⁠iurysf on GitHub · 2026-11-24 04:55 UTC · original

Tested offline against main d2a4bae with victory translate --list --validate over the title's shaders.rpf + executable (26,096 programs), dxil.dll 1.9.2602.17 (DXC v1.9.2602):

  • Translation failures: 3,733 on main → 3,709 with this PR (−24). "a lane-mask join of an untracked mask" disappears.
  • 22 compute programs that failed to emit on main with "a lane-mask join of an untracked mask" now emit but fail DXIL validation with Entry function performs some operation that is incompatible with the shader stage or other entry properties. No program that validated on main fails now.
  • Merges cleanly with #309: 3,572 failures together (−161), and that validation error goes from 24 to 55 modules.
**@⁠iurysf** on GitHub · 2026-11-24 04:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7122461052) Tested offline against main `d2a4bae` with `victory translate --list --validate` over the title's `shaders.rpf` + executable (26,096 programs), dxil.dll 1.9.2602.17 (DXC v1.9.2602): - Translation failures: 3,733 on main → 3,709 with this PR (−24). "a lane-mask join of an untracked mask" disappears. - 22 compute programs that failed to emit on main with "a lane-mask join of an untracked mask" now emit but fail DXIL validation with `Entry function performs some operation that is incompatible with the shader stage or other entry properties`. No program that validated on main fails now. - Merges cleanly with #309: 3,572 failures together (−161), and that validation error goes from 24 to 55 modules.
github-bot force-pushed github-bot/gh-385 from a3defece8d to 90997428f5 2026-11-26 06:28:25 +00:00 Compare
Author
Owner

@⁠slint6614-dev on GitHub · 2026-11-24 09:24 UTC · original

Measured on the full retail shader pack (26,503 containers) with victory translate --validate --pipelines (pipelines created on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. This PR conflicts with current main (lower.rs), so it was measured on its own base, against main 1f858b0 before #612 (VS/PS 12272 / 12172, CS 1693 / 1670, MS 8191 / 8129).

  • CS 1717 / 1672: +24 emitted but only +2 validated; the validator's "Entry function performs some operation that is incompatible with the shader stage" goes 23 → 45.
  • "a lane-mask join of an untracked mask" 39 → 0 and "scalar memory read as data" 573 → 521, but "an opaque lane mask" 29 → 99.
  • VS/PS and MS unchanged.
**@⁠slint6614-dev** on GitHub · 2026-11-24 09:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7127372529) Measured on the full retail shader pack (26,503 containers) with `victory translate --validate --pipelines` (pipelines created on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. This PR conflicts with current main (`lower.rs`), so it was measured on its own base, against main 1f858b0 before #612 (VS/PS 12272 / 12172, CS 1693 / 1670, MS 8191 / 8129). - CS 1717 / 1672: +24 emitted but only +2 validated; the validator's "Entry function performs some operation that is incompatible with the shader stage" goes 23 → 45. - "a lane-mask join of an untracked mask" 39 → 0 and "scalar memory read as data" 573 → 521, but "an opaque lane mask" 29 → 99. - VS/PS and MS unchanged.
Author
Owner

@⁠walterwallaceson on GitHub · 2026-11-24 10:56 UTC · original

In-game data on where the pixel program named in this PR's description sits in a frame, from a run on Windows 10 with an RTX 3070. The short version: it draws into the HDR scene target the final image is built from, and that target is empty.

Setup: main 8e79c80 + #175, #55, #89, #439 (1ca87f7), #334, #493, #483, #688, #581, #704. Diagnostics build with VICTORY_SHADER_LOOP_LIMIT=4096. Player control is reached at about 1 fps, and the world is black (#392 has the run).

What I captured: I saved every render target of one frame in the world with VICTORY_CAPTURE + VICTORY_DUMP_TARGETS, and traced its draws with victory_gpu::draw=debug.

  • The geometry is drawn: two full-resolution colour targets show the whole scene, and a mask target has the right silhouettes.
  • The last full-screen pass that feeds the 4K output reads, among other inputs, a full-resolution R16G16B16A16_FLOAT target. All four full-resolution targets of that format are a single flat value at the end of the frame, so the output is black with only the UI on top.
  • 154 draws write that HDR target. 34 of them, from one mesh + pixel pipeline, are dropped because this PR's pixel program fails with a lane-mask join of an untracked mask. The other 120 run and still leave the target flat, so this program is probably one of several things missing there, not the only one.

About merging with #439's stack: the pixel program still fails with that reason on the stack above. #439's stack has its own handling for masks that start as a constant (Structured::others, "a loop's exit mask starts as a constant 0"), but it doesn't cover this program. I tried merging this PR on top and it conflicts in structure.rs (2 hunks), emit/lower.rs (7) and valu_tests.rs (1), mostly where the two approaches touch the same code (phi_masks/PhiJoin here, others/pairs/console masks there). I didn't hand-merge two designs, since a wrong merge would make an in-game result meaningless.

@⁠nathanbzrr @⁠r4tedx if a version of this fix lands on top of #439's stack (or #439 takes this case), I can run the same capture and say whether that HDR target fills.

I'm testing with Claude's help, and Claude drafted this comment.

**@⁠walterwallaceson** on GitHub · 2026-11-24 10:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7129437026) In-game data on where the pixel program named in this PR's description sits in a frame, from a run on Windows 10 with an RTX 3070. The short version: it draws into the HDR scene target the final image is built from, and that target is empty. **Setup:** `main` `8e79c80` + #175, #55, #89, #439 (`1ca87f7`), #334, #493, #483, #688, #581, #704. Diagnostics build with `VICTORY_SHADER_LOOP_LIMIT=4096`. Player control is reached at about 1 fps, and the world is black (#392 has the run). **What I captured:** I saved every render target of one frame in the world with `VICTORY_CAPTURE` + `VICTORY_DUMP_TARGETS`, and traced its draws with `victory_gpu::draw=debug`. - The geometry is drawn: two full-resolution colour targets show the whole scene, and a mask target has the right silhouettes. - The last full-screen pass that feeds the 4K output reads, among other inputs, a full-resolution `R16G16B16A16_FLOAT` target. All four full-resolution targets of that format are a single flat value at the end of the frame, so the output is black with only the UI on top. - 154 draws write that HDR target. 34 of them, from one mesh + pixel pipeline, are dropped because this PR's pixel program fails with `a lane-mask join of an untracked mask`. The other 120 run and still leave the target flat, so this program is probably one of several things missing there, not the only one. **About merging with #439's stack:** the pixel program still fails with that reason on the stack above. #439's stack has its own handling for masks that start as a constant (`Structured::others`, "a loop's exit mask starts as a constant 0"), but it doesn't cover this program. I tried merging this PR on top and it conflicts in `structure.rs` (2 hunks), `emit/lower.rs` (7) and `valu_tests.rs` (1), mostly where the two approaches touch the same code (`phi_masks`/`PhiJoin` here, `others`/`pairs`/console masks there). I didn't hand-merge two designs, since a wrong merge would make an in-game result meaningless. @⁠nathanbzrr @⁠r4tedx if a version of this fix lands on top of #439's stack (or #439 takes this case), I can run the same capture and say whether that HDR target fills. I'm testing with Claude's help, and Claude drafted this comment.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 11:07 UTC · original

@⁠walterwallaceson, the 34 dropped draws give us a specific way to check an integration: first see whether the pipeline for b37565055f2f7d3b is created and those draws execute, then compare the HDR target. The other 120 draws make the target contents a separate result. I checked #439 at ac6ab70; its update brings in #566’s descriptor waterfall handling. It does not integrate #385’s per-edge mask tracking. I don’t have a combined head verified for that capture.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 11:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7129695601) @⁠walterwallaceson, the 34 dropped draws give us a specific way to check an integration: first see whether the pipeline for `b37565055f2f7d3b` is created and those draws execute, then compare the HDR target. The other 120 draws make the target contents a separate result. I checked #439 at `ac6ab70`; its update brings in #566’s descriptor waterfall handling. It does not integrate #385’s per-edge mask tracking. I don’t have a combined head verified for that capture. AI-assisted (Codex).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 11:37 UTC · original

@⁠walterwallaceson @⁠nullmarsh, one detail changes what’s worth testing next. The RX 9060 XT report already follows b37565055f2f7d3b past the join refusal on #385 alone. At the same offset (0x5340) it stops on an opaque lane mask. A second frame capture would be most informative after that pixel shader emits, validates, and creates a pipeline on the combined stack.

If either of you has the local shader inspection handy, could you report the opcode at 0x5340 and how its mask is produced on each incoming path (for example, a constant, a compare, or a saved EXEC value)? Mnemonics and a description of the register flow are enough to start a synthetic regression case. No shader binary or game files needed.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 11:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7130337878) @⁠walterwallaceson @⁠nullmarsh, one detail changes what’s worth testing next. The [RX 9060 XT report](https://git.gtahub.st/github/Marvisak--VIctory/pulls/385) already follows `b37565055f2f7d3b` past the join refusal on #385 alone. At the same offset (`0x5340`) it stops on `an opaque lane mask`. A second frame capture would be most informative after that pixel shader emits, validates, and creates a pipeline on the combined stack. If either of you has the local shader inspection handy, could you report the opcode at `0x5340` and how its mask is produced on each incoming path (for example, a constant, a compare, or a saved EXEC value)? Mnemonics and a description of the register flow are enough to start a synthetic regression case. No shader binary or game files needed. AI-assisted (Codex).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 12:43 UTC · original

@⁠walterwallaceson @⁠nullmarsh, I traced the failing pixel shader locally. At the join reported at 0x5340, two edges carry the same tracked mask. The third reloads that very mask from the same VGPR lane where it was saved. That makes #298’s spill handling sufficient for this shader.

I pushed a capture branch at bb099d9 on top of #439 c153b21, integrated with @⁠permadiego’s #298 54f97db. Stock #439 refused b37565055f2f7d3b at 0x5340. On the combined branch, the exact pixel shader passed the SDK DXIL validator. Mesh shader ba8d52f4ea1a1bac also validated, and the RTX 5070 (616.92) created a mesh pipeline using the two actual shaders together. The workspace suite passed (378 passed, 6 ignored). The branch also serializes the console-wave GPU tests with the other device tests after an access violation in the local NVIDIA driver during parallel testing.

That gets us to the capture you offered: on the same scene and the rest of your original stack, do the formerly dropped draws now execute, and does the RGBA16F target change? I have checked pipeline creation here. I haven’t measured writes to the title’s HDR target. No game data attached.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 12:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7131842114) @⁠walterwallaceson @⁠nullmarsh, I traced the failing pixel shader locally. At the join reported at `0x5340`, two edges carry the same tracked mask. The third reloads that very mask from the same VGPR lane where it was saved. That makes #298’s spill handling sufficient for this shader. I pushed a [capture branch at `bb099d9`](https://github.com/r4tedx/VIctory/tree/bb099d940dcb187e5512ac657c82d175604cc4b8) on top of #439 `c153b21`, integrated with @⁠permadiego’s #298 `54f97db`. Stock #439 refused `b37565055f2f7d3b` at `0x5340`. On the combined branch, the exact pixel shader passed the SDK DXIL validator. Mesh shader `ba8d52f4ea1a1bac` also validated, and the RTX 5070 (616.92) created a mesh pipeline using the two actual shaders together. The workspace suite passed (378 passed, 6 ignored). The branch also serializes the console-wave GPU tests with the other device tests after an access violation in the local NVIDIA driver during parallel testing. That gets us to the capture you offered: on the same scene and the rest of your original stack, do the formerly dropped draws now execute, and does the RGBA16F target change? I have checked pipeline creation here. I haven’t measured writes to the title’s HDR target. No game data attached. AI-assisted (Codex).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 13:19 UTC · original

Follow-up on the capture branch at bb099d9: I compared it with stock #439 c153b21 over the local shaders.rpf. Both ran victory translate --validate --host-lanes 32-32 with the SDK dxil.dll validator, offline and without creating pipelines.

build vertex + pixel validated compute validated mesh validated total
#439 c153b21 12,155 1,385 8,152 21,692
+ #298 (bb099d9) 12,182 1,385 8,152 21,719

All 27 gains are pixel programs. Matching programs by source container hash, none that validated on #439 fails on the branch. Refusals fell by 27 in total. The largest drops were an opaque lane mask (−29), an SCC the emitter did not compute (−27), a lane mask read as data (−16) and a lane-mask join of an untracked mask (−15). Some programs now get further and stop on a later reason instead, most often a program the console structure cannot hold (+144). Compute and mesh counts did not change.

Local title data was used for this comparison; only counts, refusal reasons and hashes are reported here. This doesn't answer the HDR-target question. That still needs the in-game capture.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 13:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7132675363) Follow-up on the [capture branch at `bb099d9`](https://github.com/r4tedx/VIctory/tree/bb099d940dcb187e5512ac657c82d175604cc4b8): I compared it with stock #439 `c153b21` over the local `shaders.rpf`. Both ran `victory translate --validate --host-lanes 32-32` with the SDK `dxil.dll` validator, offline and without creating pipelines. | build | vertex + pixel validated | compute validated | mesh validated | total | |---|---|---|---|---| | #439 `c153b21` | 12,155 | 1,385 | 8,152 | 21,692 | | + #298 (`bb099d9`) | 12,182 | 1,385 | 8,152 | 21,719 | All 27 gains are pixel programs. Matching programs by source container hash, none that validated on #439 fails on the branch. Refusals fell by 27 in total. The largest drops were `an opaque lane mask` (−29), `an SCC the emitter did not compute` (−27), `a lane mask read as data` (−16) and `a lane-mask join of an untracked mask` (−15). Some programs now get further and stop on a later reason instead, most often `a program the console structure cannot hold` (+144). Compute and mesh counts did not change. Local title data was used for this comparison; only counts, refusal reasons and hashes are reported here. This doesn't answer the HDR-target question. That still needs the in-game capture. AI-assisted (Claude Code).
Author
Owner

@⁠ghost on GitHub · 2026-11-24 13:45 UTC · original

@⁠r4tedx The in-game capture, on your base: #439 c153b21 vs bb099d9, both + #500 + a local trace (both include #612), RX 9060 XT, 4 frames, warm caches, one run per build:

  • c153b21: b37565055f2f7d3b refused at 0x5340; all 324 of its draws dropped.
  • bb099d9: all 252 issued, none dropped ("issued" is all the trace shows).
  • Their 2560x1440 RGBA16F target, end-of-frame dump: near-black in both. 7 of 8 dumps have 17–59 sampled pixels ≥ 0.0005 (the eighth peaks at 0.0004); none reach 0.01.

Your base lacks #346: 983 indirect rectangle-list draws dropped on bb099d9, 727 on that target. With #346 in both builds those drops are gone, though its path is outside my trace. The target is the same: 24–60 pixels ≥ 0.0005, none ≥ 0.01, bar one frame whose 21.5 max the quarter-sampled dump missed.

So your fix makes these draws run, but the dump shows no change from them or from #346. Not checked: their inputs, later writes, or correctness (qntic's #298 report).

AI-assisted (Claude Code, Claude Opus 5.5); no game data.

**@⁠ghost** on GitHub · 2026-11-24 13:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7133297237) @⁠r4tedx The in-game capture, on your base: #439 `c153b21` vs `bb099d9`, both + #500 + a local trace (both include #612), RX 9060 XT, 4 frames, warm caches, one run per build: - **`c153b21`:** `b37565055f2f7d3b` refused at `0x5340`; all 324 of its draws dropped. - **`bb099d9`:** all 252 issued, none dropped ("issued" is all the trace shows). - **Their 2560x1440 RGBA16F target**, end-of-frame dump: near-black in both. 7 of 8 dumps have 17–59 sampled pixels ≥ 0.0005 (the eighth peaks at 0.0004); none reach 0.01. Your base lacks #346: 983 indirect rectangle-list draws dropped on `bb099d9`, 727 on that target. With #346 in both builds those drops are gone, though its path is outside my trace. The target is the same: 24–60 pixels ≥ 0.0005, none ≥ 0.01, bar one frame whose 21.5 max the quarter-sampled dump missed. So your fix makes these draws run, but the dump shows no change from them or from #346. Not checked: their inputs, later writes, or correctness (qntic's #298 report). AI-assisted (Claude Code, Claude Opus 5.5); no game data.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 13:53 UTC · original

@⁠nullmarsh, thanks. This is the A/B the capture branch was for, and it settles one part. On bb099d9, b37565055f2f7d3b gets a pipeline and its draws are issued: 0 of 252 dropped, against all 324 dropped on c153b21. It also shows that those dropped draws weren't what kept the RGBA16F target empty. With them running, the target stays near-black, with or without #346.

What that means for the PRs:

  • #298 (and bb099d9): it does what it claims for this shader. The refusal is gone and the draws run. Your dump doesn't confirm or contradict the values those draws compute. So far, the evidence for that is qntic's hardware lane test on #298.
  • #439: it was the base of both builds, so this result doesn't bear on it.
  • The empty target: it needs another explanation. Now that the draws run, the next question is what they read. If the textures and buffers they sample are already zero, the cause is upstream of this pass. If those inputs hold data and the target still stays dark, the pixel shader's output or the target's state comes next.

If your trace can show, for one of the 252 draws, which views are bound and whether those resources hold nonzero data at that point, that would separate the two cases. Also, are 324 and 252 the same four frames counted the same way? Or does the scene issue fewer of these draws on bb099d9?

No new tests for this reply. My earlier check of bb099d9 used local title data offline, covering DXIL validation and pipeline creation for this shader only. The title was not run.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 13:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7133502527) @⁠nullmarsh, thanks. This is the A/B the capture branch was for, and it settles one part. On `bb099d9`, `b37565055f2f7d3b` gets a pipeline and its draws are issued: 0 of 252 dropped, against all 324 dropped on `c153b21`. It also shows that those dropped draws weren't what kept the RGBA16F target empty. With them running, the target stays near-black, with or without #346. What that means for the PRs: - **#298 (and `bb099d9`):** it does what it claims for this shader. The refusal is gone and the draws run. Your dump doesn't confirm or contradict the values those draws compute. So far, the evidence for that is qntic's hardware lane test on #298. - **#439:** it was the base of both builds, so this result doesn't bear on it. - **The empty target:** it needs another explanation. Now that the draws run, the next question is what they read. If the textures and buffers they sample are already zero, the cause is upstream of this pass. If those inputs hold data and the target still stays dark, the pixel shader's output or the target's state comes next. If your trace can show, for one of the 252 draws, which views are bound and whether those resources hold nonzero data at that point, that would separate the two cases. Also, are 324 and 252 the same four frames counted the same way? Or does the scene issue fewer of these draws on `bb099d9`? No new tests for this reply. My earlier check of `bb099d9` used local title data offline, covering DXIL validation and pipeline creation for this shader only. The title was not run. AI-assisted (Claude Code).
Author
Owner

@⁠ghost on GitHub · 2026-11-24 15:23 UTC · original

@⁠r4tedx Your two questions, from dump runs on bb099d9 + #500 + a local trace that names view resources and counts raw values per target (RX 9060 XT, 4 frames, warm cache):

  • 324 vs 252: same counting; the trigger lands on different frames. Per frame: c153b21 144/144/36/0; bb099d9 144/34/36/38, and in two later runs 144/34/70/70 and 144/34/68/68 (all ran).
  • Bound views: 16 texture views with a resource; 9 are targets I can read (end of frame, not at draw time):
    • Data: depth 2560x1440 (1-6% nonzero), three 384x384 RGBA16F.
    • Uniform: 2560x1440 R32F all 0; 2304x576 R16F all 0; 128x128 RGBA16F all 0; 80x45 one value (3 of 4 frames); 960x540 R32F 0x7FFFFFFF in every texel and frame (looks like a fill).
  • b375's own RGBA16F target: 0 NaN/Inf; 99.92-99.94% exactly 0.
  • The 2560x1440 R32F input is render target 0 of 232 draws (depth: the same buffer b375 reads). 218 are dropped, 206 by 9 pixel programs refused for "a 64-bit image atomic" (e.g. 8ba01719b71d1d35). It is all 0 at end of frame although 14 draws on it ran.

Not known: which views b375 samples; texture-UAV writes (the trace names buffer UAVs only). Next: the same run with #305.

AI-assisted (Claude Code, Claude Opus 5.5); no game data.

**@⁠ghost** on GitHub · 2026-11-24 15:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7135940345) @⁠r4tedx Your two questions, from dump runs on `bb099d9` + #500 + a local trace that names view resources and counts raw values per target (RX 9060 XT, 4 frames, warm cache): - **324 vs 252:** same counting; the trigger lands on different frames. Per frame: `c153b21` 144/144/36/0; `bb099d9` 144/34/36/38, and in two later runs 144/34/70/70 and 144/34/68/68 (all ran). - **Bound views:** 16 texture views with a resource; 9 are targets I can read (end of frame, not at draw time): - Data: depth 2560x1440 (1-6% nonzero), three 384x384 RGBA16F. - Uniform: 2560x1440 R32F all 0; 2304x576 R16F all 0; 128x128 RGBA16F all 0; 80x45 one value (3 of 4 frames); 960x540 R32F `0x7FFFFFFF` in every texel and frame (looks like a fill). - **b375's own RGBA16F target:** 0 NaN/Inf; 99.92-99.94% exactly 0. - **The 2560x1440 R32F input** is render target 0 of 232 draws (depth: the same buffer b375 reads). 218 are dropped, 206 by 9 pixel programs refused for "a 64-bit image atomic" (e.g. `8ba01719b71d1d35`). It is all 0 at end of frame although 14 draws on it ran. Not known: which views b375 samples; texture-UAV writes (the trace names buffer UAVs only). Next: the same run with #305. AI-assisted (Claude Code, Claude Opus 5.5); no game data.
Author
Owner

@⁠ghost on GitHub · 2026-11-24 15:44 UTC · original

@⁠r4tedx Follow-up with #305 (78dae83) added to the same base, 1 run, same scene:

  • 7 of the 9 programs now translate; 3f1c61d954b46f31 stops on "barycentrics read directly" and 97175c2c1a214a2f on "a scalar memory read as data". 192 of their draws on that 2560x1440 R32F target run in the 4 frames (0 without #305).
  • End-of-frame contents don't differ from two control runs: rt0 R32F all 0; rt1 R8 nonzero in 42-127 texels; rt2 R8 0x80 in every texel (looks like a clear value); the shared depth buffer within control run-to-run spread (1-6% nonzero); b375's own target 99.92-99.94% exactly 0.

An end-of-frame dump can't tell "never wrote" from "cleared later", and their 64-bit image writes aren't visible to my trace. This base has no #587.

AI-assisted (Claude Code, Claude Opus 5.5); no game data.

**@⁠ghost** on GitHub · 2026-11-24 15:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7136523176) @⁠r4tedx Follow-up with #305 (`78dae83`) added to the same base, 1 run, same scene: - 7 of the 9 programs now translate; `3f1c61d954b46f31` stops on "barycentrics read directly" and `97175c2c1a214a2f` on "a scalar memory read as data". 192 of their draws on that 2560x1440 R32F target run in the 4 frames (0 without #305). - End-of-frame contents don't differ from two control runs: rt0 R32F all 0; rt1 R8 nonzero in 42-127 texels; rt2 R8 `0x80` in every texel (looks like a clear value); the shared depth buffer within control run-to-run spread (1-6% nonzero); b375's own target 99.92-99.94% exactly 0. An end-of-frame dump can't tell "never wrote" from "cleared later", and their 64-bit image writes aren't visible to my trace. This base has no #587. AI-assisted (Claude Code, Claude Opus 5.5); no game data.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 15:48 UTC · original

@⁠nullmarsh, thanks. That's the run I was about to prepare a branch for, so I've dropped mine. Two things follow from it:

  • The draws feeding b375's input now run, and the picture doesn't change. With #305, 7 of the 9 producers translate and 192 of their draws run, but the R32F input still ends the frame all 0 and b375's own target stays ~99.9% zero, as in both controls. So along this chain, the refused programs aren't what keeps the target dark. As you say, an end-of-frame dump can't tell "never written" from "cleared later". And since these programs write 64-bit images, the R32F render target may not be where their results go.
  • Where the two remaining producers are covered:
    • 3f1c61d954b46f31 stops at barycentrics read directly. In upstream main (lower.rs, Input::Barycentric) that is the reason #453 (barycentrics through SV_Barycentrics) targets.
    • 97175c2c1a214a2f stops at a scalar memory read as data. #180 is the open PR that takes the most programs off that reason in h0useadv's census on #293 (771 → 300).

I haven't run either of them on this base. The title was not used for this reply.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 15:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7136638250) @⁠nullmarsh, thanks. That's the run I was about to prepare a branch for, so I've dropped mine. Two things follow from it: - **The draws feeding b375's input now run, and the picture doesn't change.** With #305, 7 of the 9 producers translate and 192 of their draws run, but the R32F input still ends the frame all 0 and b375's own target stays ~99.9% zero, as in both controls. So along this chain, the refused programs aren't what keeps the target dark. As you say, an end-of-frame dump can't tell "never written" from "cleared later". And since these programs write 64-bit images, the R32F render target may not be where their results go. - **Where the two remaining producers are covered:** - `3f1c61d954b46f31` stops at `barycentrics read directly`. In upstream `main` (`lower.rs`, `Input::Barycentric`) that is the reason #453 (barycentrics through `SV_Barycentrics`) targets. - `97175c2c1a214a2f` stops at `a scalar memory read as data`. #180 is the open PR that takes the most programs off that reason in h0useadv's census on #293 (771 → 300). I haven't run either of them on this base. The title was not used for this reply. AI-assisted (Claude Code).
Author
Owner

@⁠KainanP on GitHub · 2026-11-24 18:10 UTC · original

Ran this PR (a3451276) on Windows 11, RTX 4060 Laptop (driver 32.0.16.1047): cargo test -p victory-shader --lib --locked passes 3/3 times on the default adapter (76 passed).

With VICTORY_WARP=1 (the WARP mode documented in diff_tests.rs), lane_mask_phi_joins_execute_correctly fails:

partial_constant_join (hardware): compute_pipeline failed: Parâmetro incorreto.

(Windows' localized "The parameter is incorrect", i.e. E_INVALIDARG.)

Host::new(false) already returns WARP when VICTORY_WARP=1 (host.rs:68), but dispatch_wave32 only skips the fixed-WaveSize refusal when its own warp flag is set, so the "hardware" pass panics. Skipping there too isn't enough: then neither pass runs and ran > 0 fails ("neither hardware nor WARP SM 6.6 device available"), although a device was found.

This makes it pass on both (76 passed with VICTORY_WARP=1 and without):

@@ fn dispatch_wave32(
             eprintln!("{name}: no SM 6.6 {label} device; skipped");
             continue;
         };
+        ran += 1;
         let (root, pso) = match host.compute_pipeline(shader) {
             Ok(p) => p,
             // WARP does not accept every fixed WaveSize requirement.
-            Err(e) if warp && fixed_wave => {
+            Err(e) if (warp || std::env::var("VICTORY_WARP").is_ok_and(|v| v == "1")) && fixed_wave => {
@@
             assert_eq!(&out[0], want, "{name} ({label}): case {i} ({inputs:?})");
         }
-        ran += 1;
     }

(diff_tests.rs:1208 handles the same case by reading VICTORY_WARP.) Test-harness only; the join lowering itself checks out on the RTX.

Tested with the help of an AI (Claude Code).

**@⁠KainanP** on GitHub · 2026-11-24 18:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7140261254) Ran this PR (`a3451276`) on Windows 11, RTX 4060 Laptop (driver 32.0.16.1047): `cargo test -p victory-shader --lib --locked` passes 3/3 times on the default adapter (76 passed). With `VICTORY_WARP=1` (the WARP mode documented in `diff_tests.rs`), `lane_mask_phi_joins_execute_correctly` fails: ``` partial_constant_join (hardware): compute_pipeline failed: Parâmetro incorreto. ``` (Windows' localized "The parameter is incorrect", i.e. E_INVALIDARG.) `Host::new(false)` already returns WARP when `VICTORY_WARP=1` (`host.rs:68`), but `dispatch_wave32` only skips the fixed-WaveSize refusal when its own `warp` flag is set, so the "hardware" pass panics. Skipping there too isn't enough: then neither pass runs and `ran > 0` fails ("neither hardware nor WARP SM 6.6 device available"), although a device was found. This makes it pass on both (76 passed with `VICTORY_WARP=1` and without): ```diff @@ fn dispatch_wave32( eprintln!("{name}: no SM 6.6 {label} device; skipped"); continue; }; + ran += 1; let (root, pso) = match host.compute_pipeline(shader) { Ok(p) => p, // WARP does not accept every fixed WaveSize requirement. - Err(e) if warp && fixed_wave => { + Err(e) if (warp || std::env::var("VICTORY_WARP").is_ok_and(|v| v == "1")) && fixed_wave => { @@ assert_eq!(&out[0], want, "{name} ({label}): case {i} ({inputs:?})"); } - ran += 1; } ``` (`diff_tests.rs:1208` handles the same case by reading `VICTORY_WARP`.) Test-harness only; the join lowering itself checks out on the RTX. _Tested with the help of an AI (Claude Code)._
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-24 21:44 UTC · original

Thanks @⁠catminou4 for the review note and @⁠KainanP for the VICTORY_WARP=1 fix!

Rebased onto origin/main (ffe310e, new head ec086dc), integrating #566, #612, #140, #801, and #433:

  • Resolved crates/victory-shader/src/structure.rs (auto-merged keeping #566's reach and #385's phi_masks), crates/victory-shader/src/emit/lower.rs (kept #612's read_phis closure alongside #385's pending_masks resolution and lowers_cs test helper), and crates/victory-shader/src/emit/valu_tests.rs (kept #140's v_cmp_class_f16_matches_rdna2).
  • Updated all new resource::track calls to pass Some(&st) (#801).
  • Serialized dispatch_wave32 with ONE_AT_A_TIME (#433) and applied @KainanP's VICTORY_WARP=1 fix (incrementing ran after Host::new and skipping fixed-WaveSize rejections when VICTORY_WARP=1).

Re-verified on ec086dc (Windows MSVC):

  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean
  • cargo test --workspace --locked: 349 passed, 0 failed, 6 ignored (victory-shader: 127 passed, 0 failed, 1 ignored)
  • VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi_joins_execute_correctly: 1 passed, 0 failed
**@⁠nathanbzrr** on GitHub · 2026-11-24 21:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7145336943) Thanks @⁠catminou4 for the review note and @⁠KainanP for the `VICTORY_WARP=1` fix! Rebased onto `origin/main` (`ffe310e`, new head `ec086dc`), integrating `#566`, `#612`, `#140`, `#801`, and `#433`: - Resolved `crates/victory-shader/src/structure.rs` (auto-merged keeping `#566`'s `reach` and `#385`'s `phi_masks`), `crates/victory-shader/src/emit/lower.rs` (kept `#612`'s `read_phis` closure alongside `#385`'s `pending_masks` resolution and `lowers_cs` test helper), and `crates/victory-shader/src/emit/valu_tests.rs` (kept `#140`'s `v_cmp_class_f16_matches_rdna2`). - Updated all new `resource::track` calls to pass `Some(&st)` (`#801`). - Serialized `dispatch_wave32` with `ONE_AT_A_TIME` (`#433`) and applied `@KainanP`'s `VICTORY_WARP=1` fix (incrementing `ran` after `Host::new` and skipping fixed-`WaveSize` rejections when `VICTORY_WARP=1`). Re-verified on `ec086dc` (Windows MSVC): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean - `cargo test --workspace --locked`: 349 passed, 0 failed, 6 ignored (`victory-shader`: 127 passed, 0 failed, 1 ignored) - `VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi_joins_execute_correctly`: 1 passed, 0 failed
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-24 22:21 UTC · original

Rebased onto origin/main (70564ae, new head 02a2e91):

@⁠catminou4 @⁠KainanP

  • Resolved crates/victory-shader/src/structure.rs preserving origin/main's restored, discards, spilled(), and Lanes::mask fallback alongside phi_masks, derived_phis, phi_joins, phi_join_ids, and check_joins.
  • Resolved crates/victory-shader/src/emit/lower.rs keeping origin/main's live_edges / a7fc47a / 8af0472 / 0b35b7f changes, updating avoids edge-mask links to consult st.phi_masks before st.masks, and resolving pending_masks via st.phi_masks in fill_phis.
  • Resolved crates/victory-shader/src/emit/valu_tests.rs preserving all origin/main tests (through relative_moves_reach_only_what_their_clamped_index_can), updating build_wave32_cs's HostShader fields (root_uavs, memory, memory_writes, view_addresses, heap, heap_writes), and keeping @KainanP's VICTORY_WARP=1 fix + ONE_AT_A_TIME lock in dispatch_wave32.

Verified on 02a2e91 (Windows MSVC):

  • rustfmt --edition 2024 --check crates/victory-shader/src/emit/valu_tests.rs: clean (structure.rs and emit/lower.rs only retain pre-existing origin/main formatting diffs).
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.
  • cargo test --workspace --locked: 483 passed, 0 failed, 7 ignored (victory-shader: 216 passed, 0 failed, 2 ignored; xtask: 4 passed).
  • VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi_joins_execute_correctly: 1 passed, 0 failed.
**@⁠nathanbzrr** on GitHub · 2026-11-24 22:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7146133209) Rebased onto `origin/main` (`70564ae`, new head `02a2e91`): @⁠catminou4 @⁠KainanP - Resolved `crates/victory-shader/src/structure.rs` preserving `origin/main`'s `restored`, `discards`, `spilled()`, and `Lanes::mask` fallback alongside `phi_masks`, `derived_phis`, `phi_joins`, `phi_join_ids`, and `check_joins`. - Resolved `crates/victory-shader/src/emit/lower.rs` keeping `origin/main`'s `live_edges` / `a7fc47a` / `8af0472` / `0b35b7f` changes, updating `avoids` edge-mask links to consult `st.phi_masks` before `st.masks`, and resolving `pending_masks` via `st.phi_masks` in `fill_phis`. - Resolved `crates/victory-shader/src/emit/valu_tests.rs` preserving all `origin/main` tests (through `relative_moves_reach_only_what_their_clamped_index_can`), updating `build_wave32_cs`'s `HostShader` fields (`root_uavs`, `memory`, `memory_writes`, `view_addresses`, `heap`, `heap_writes`), and keeping `@KainanP`'s `VICTORY_WARP=1` fix + `ONE_AT_A_TIME` lock in `dispatch_wave32`. Verified on `02a2e91` (Windows MSVC): - `rustfmt --edition 2024 --check crates/victory-shader/src/emit/valu_tests.rs`: clean (`structure.rs` and `emit/lower.rs` only retain pre-existing `origin/main` formatting diffs). - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean. - `cargo test --workspace --locked`: `483 passed, 0 failed, 7 ignored` (`victory-shader`: `216 passed, 0 failed, 2 ignored`; `xtask`: `4 passed`). - `VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi_joins_execute_correctly`: `1 passed, 0 failed`.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:30 UTC · original · edited 2026-11-26 04:20 UTC

Automated triage for the maintainers.

Merge candidate. Since a3defec, mask_uses_console_lanes (emit/lower/phi.rs) ignores predecessors whose reach is FALSE when deciding uniform_join and queueing phi edges, and looks a v_cndmask_b32 mask up in st.other too, so a partial constant mask in an SGPR turns on console lanes; both read correctly. Carry-in selects and inline-constant masks still stop at a refusal, which is safe. The two new tests only check that WAVE_OPS is set and the DXIL validates; a lane-readback test (such as the direct-select case in this thread) would make them stronger. phi.rs still deserves a careful human read.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7148586102) · edited 2026-11-26 04:20 UTC <!-- victory-triage v1 head=90997428f5efaeb1533387e03cdf9088bdbb91bf verdict=merge-candidate at=2026-11-26T04:20:42Z --> Automated triage for the maintainers. **Merge candidate.** Since `a3defec`, `mask_uses_console_lanes` (`emit/lower/phi.rs`) ignores predecessors whose `reach` is `FALSE` when deciding `uniform_join` and queueing phi edges, and looks a `v_cndmask_b32` mask up in `st.other` too, so a partial constant mask in an SGPR turns on console lanes; both read correctly. Carry-in selects and inline-constant masks still stop at a refusal, which is safe. The two new tests only check that WAVE_OPS is set and the DXIL validates; a lane-readback test (such as the direct-select case in this thread) would make them stronger. `phi.rs` still deserves a careful human read. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-25 00:58 UTC · original

Rebased onto origin/main (42363ab, new head 14c46b2):

  • Resolved the test-block conflict in crates/victory-shader/src/structure.rs, keeping origin/main's Bools::vars/Bools::given tests and benchmark (e5b7159), BDD memo-cap overflow checks (f177aae), and Structured::other (67c4f53) alongside #385's phi_masks / PhiJoin / check_joins tracking and tests.
  • Cleanly integrated crates/victory-shader/src/emit/lower.rs (including 1e923ad WAVE_OPS and 67c4f53 v_cndmask_b32) and crates/victory-shader/src/emit/valu_tests.rs.

Verified locally (Windows MSVC):

  • On 4118f33 (59d7bf4):
    • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean
    • cargo test --workspace --locked: 705 passed, 0 failed, 10 ignored
    • cargo xtask policy: 182 files ok
  • On 42363ab (14c46b2):
    • cargo test -p victory-shader --locked: 253 passed, 0 failed, 3 ignored
    • VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi_joins_execute_correctly: 1 passed, 0 failed
**@⁠nathanbzrr** on GitHub · 2026-11-25 00:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7149081869) Rebased onto `origin/main` (`42363ab`, new head `14c46b2`): - Resolved the test-block conflict in `crates/victory-shader/src/structure.rs`, keeping `origin/main`'s `Bools::vars`/`Bools::given` tests and benchmark (`e5b7159`), BDD memo-cap overflow checks (`f177aae`), and `Structured::other` (`67c4f53`) alongside `#385`'s `phi_masks` / `PhiJoin` / `check_joins` tracking and tests. - Cleanly integrated `crates/victory-shader/src/emit/lower.rs` (including `1e923ad` `WAVE_OPS` and `67c4f53` `v_cndmask_b32`) and `crates/victory-shader/src/emit/valu_tests.rs`. Verified locally (Windows MSVC): - On `4118f33` (`59d7bf4`): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean - `cargo test --workspace --locked`: 705 passed, 0 failed, 10 ignored - `cargo xtask policy`: 182 files ok - On `42363ab` (`14c46b2`): - `cargo test -p victory-shader --locked`: 253 passed, 0 failed, 3 ignored - `VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi_joins_execute_correctly`: 1 passed, 0 failed
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-25 03:32 UTC · original

Updated crates/victory-shader/src/emit/lower.rs (head 42fd559, rebased on origin/main 940d32f) with both a fill_phis fix and SDK dxil.dll validation coverage, plus the #201 root-cause diagnosis for the 22 compute validation errors:

1. Cause of the 22 compute validation errors ("incompatible with the shader stage")

As established on #201 (see @⁠r4tedx's analysis, the #201 issue triage note, and @⁠iurysf's corpus stack census):

  • On main, crates/victory-shader/src/emit/lower.rs emits image_sample / image_sample_o / image_sample_b as dx.op.sample (op 60, implicit derivatives) in compute shaders while declaring dx.valver 1.6, which dxil.dll rejects with "Function uses features incompatible with the shader stage (cs) of the entry function" followed by "Entry function performs some operation that is incompatible with the shader stage or other entry properties".
  • The 24 additional compute shaders unblocked by #385's lane-mask phi join handling hit this pre-existing main lowering path once their control-flow joins no longer fail earlier.
  • In @⁠iurysf's #201 offline corpus census (26,096 programs), stacking #385 alongside #306 reduces compute validation failures to 0 (with only the 53 mesh output-size failures remaining). Because #1948, #1065, and #1237 already own compute derivative/validator-version handling upstream, #385 stays scoped to lane-mask phi joins rather than duplicating that fix.

2. Code & synthetic DXIL validation updates (crates/victory-shader/src/emit/lower.rs)

  • fill_phis ordering: moved pending_masks resolution before self.live_edges() so any scalar/phi values read while lowering mask-phi incoming booleans populate self.read_phis before data-phi edge liveness runs.
  • SDK dxil.dll validation: added validate_dxil (via Validator::load) to lane_mask_phi_joining_zero_and_compare_lowers, wave64_loop_mask_accumulator_from_zero_lowers, lane_mask_phi_with_partial_constant_enables_console_lanes (WaveSize(32) + WAVE_OPS), and added wave64_lane_mask_phi_with_partial_constant_validates (WaveSize(64) + WAVE_OPS). All four emit valid DXIL and pass Windows SDK dxil.dll 10.0.26100.0 validation without errors.

Verified on 42fd559 (Windows MSVC, VICTORY_DXIL SDK 10.0.26100.0):

  • cargo run -p xtask -- policy --staged: asset policy: 1 files ok
  • cargo clippy --workspace --all-targets -- -D warnings & --all-features: clean
  • cargo test -p victory-shader --locked: 255 passed, 0 failed, 3 ignored
  • VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi_joins_execute_correctly: 1 passed, 0 failed
  • cargo test --workspace --locked: 0 failures across all workspace crates
**@⁠nathanbzrr** on GitHub · 2026-11-25 03:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7152011696) Updated `crates/victory-shader/src/emit/lower.rs` (head `42fd559`, rebased on `origin/main` `940d32f`) with both a `fill_phis` fix and SDK `dxil.dll` validation coverage, plus the #201 root-cause diagnosis for the 22 compute validation errors: ### 1. Cause of the 22 compute validation errors ("incompatible with the shader stage") As established on #201 (see @⁠r4tedx's analysis, the #201 issue triage note, and @⁠iurysf's corpus stack census): - On `main`, `crates/victory-shader/src/emit/lower.rs` emits `image_sample` / `image_sample_o` / `image_sample_b` as `dx.op.sample` (op 60, implicit derivatives) in compute shaders while declaring `dx.valver` 1.6, which `dxil.dll` rejects with *"Function uses features incompatible with the shader stage (cs) of the entry function"* followed by *"Entry function performs some operation that is incompatible with the shader stage or other entry properties"*. - The 24 additional compute shaders unblocked by #385's lane-mask phi join handling hit this pre-existing `main` lowering path once their control-flow joins no longer fail earlier. - In @⁠iurysf's #201 offline corpus census (26,096 programs), stacking #385 alongside #306 reduces compute validation failures to **0** (with only the 53 mesh output-size failures remaining). Because #1948, #1065, and #1237 already own compute derivative/validator-version handling upstream, #385 stays scoped to lane-mask phi joins rather than duplicating that fix. ### 2. Code & synthetic DXIL validation updates (`crates/victory-shader/src/emit/lower.rs`) - **`fill_phis` ordering**: moved `pending_masks` resolution **before** `self.live_edges()` so any scalar/phi values read while lowering mask-phi incoming booleans populate `self.read_phis` before data-phi edge liveness runs. - **SDK `dxil.dll` validation**: added `validate_dxil` (via `Validator::load`) to `lane_mask_phi_joining_zero_and_compare_lowers`, `wave64_loop_mask_accumulator_from_zero_lowers`, `lane_mask_phi_with_partial_constant_enables_console_lanes` (`WaveSize(32)` + `WAVE_OPS`), and added `wave64_lane_mask_phi_with_partial_constant_validates` (`WaveSize(64)` + `WAVE_OPS`). All four emit valid DXIL and pass Windows SDK `dxil.dll` `10.0.26100.0` validation without errors. Verified on `42fd559` (Windows MSVC, `VICTORY_DXIL` SDK `10.0.26100.0`): - `cargo run -p xtask -- policy --staged`: `asset policy: 1 files ok` - `cargo clippy --workspace --all-targets -- -D warnings` & `--all-features`: clean - `cargo test -p victory-shader --locked`: 255 passed, 0 failed, 3 ignored - `VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi_joins_execute_correctly`: 1 passed, 0 failed - `cargo test --workspace --locked`: 0 failures across all workspace crates
Author
Owner

@⁠tyr0nsur on GitHub · 2026-11-25 14:57 UTC · original

Tested the predecessor tracking at 42fd55963823 on PortVI’s 940d32f-based patch stack, against 46 compute programs that previously stopped at the untracked-mask join. The tracking emitted all 46. The Windows SDK validator accepted 13 and rejected 33 with an empty phi i1.

In fill_phis, a scalar join materializes a mask word on one incoming edge. Its ballot requests a boolean loop phi after the first pass over pending_masks. Draining newly discovered masks and reconsidering scalar edges whenever another scalar input becomes live brought the same set to 46/46 validated. Our desktop RTX 4060 (driver 32.0.16.2114) created 45/46 compute pipelines. The remaining program declares WaveSize(64) on our fixed 32-lane adapter.

The authored data_join_materializes_a_loop_mask_wave32 test reproduces the empty phi on the upstream-only integration and checks the returned scalar and lane bit after the fix. It runs without a title. The three-pass loop and pair-identity tests are in the same PortVI patch. Thanks for the original edge tracking.

**@⁠tyr0nsur** on GitHub · 2026-11-25 14:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7166070204) Tested the predecessor tracking at `42fd55963823` on PortVI’s `940d32f`-based patch stack, against 46 compute programs that previously stopped at the untracked-mask join. The tracking emitted all 46. The Windows SDK validator accepted 13 and rejected 33 with an empty `phi i1`. In `fill_phis`, a scalar join materializes a mask word on one incoming edge. Its ballot requests a boolean loop phi after the first pass over `pending_masks`. Draining newly discovered masks and reconsidering scalar edges whenever another scalar input becomes live brought the same set to **46/46 validated**. Our desktop RTX 4060 (driver 32.0.16.2114) created 45/46 compute pipelines. The remaining program declares WaveSize(64) on our fixed 32-lane adapter. The authored `data_join_materializes_a_loop_mask_wave32` test reproduces the empty phi on the upstream-only integration and checks the returned scalar and lane bit after the fix. It runs without a title. The three-pass loop and pair-identity tests are in the same [PortVI patch](https://github.com/tyr0nsur/PortVI/blob/6578eff095f9cc01a948efd3ce44c15e406922a5/patches/0015-compute-mask-joins.patch). Thanks for the original edge tracking.
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-25 22:24 UTC · original

Rebased onto origin/main (f3578e3, new head 7420237) and addressed the three triage questions + fixpoint duplication issue:

1. Whole-mask & cross-lane reads after a per-lane join (given(m, e))

  • Both fill_mask_phis and the avoids links only evaluate given(m, e) under edge e:
    • In fill_mask_phis, the lowered phi i1 selects (x, qb) specifically along predecessor edge q -> b, where e holds for every lane traversing that edge, so given(m, e) evaluates to the exact same per-lane bit as m on that path (while allowing edges like if (v0 < s0) { s2 = vcc_lo } where given(m, e) == Bool::TRUE to simplify cleanly).
    • In avoids, lane_edge(q, to) already constrains e, so (joined == given(m, e)) on edge q -> to is equivalent to (joined == m) for lanes taking that edge.
  • Added synthetic tests reading the joined mask both as a whole 32-bit integer (s_and_b32 s6, s2, exec_lo) and cross-lane via v_readlane_b32 (lanes 0 and 31) after per-lane joins:
    • emit::lower::tests::per_lane_mask_phi_read_as_whole_mask_and_readlane_validates (WaveActiveBallot emitted once, validated with dxil.dll).
    • emit::valu_tests::lane_mask_phi_whole_read_and_readlane_execute_correctly (executed on host GPU covering both s2 = vcc_lo where given(m, e) == Bool::TRUE and an independent sub-mask v0 < s1 under v0 < s0).

2. console_lanes scan (selects) scope & title shader count

  • Updated selects in crates/victory-shader/src/emit/lower.rs to skip unreachable blocks (x.st.reach[b] != Bool::FALSE).
  • The scan still enables console_lanes only when a reachable v_cndmask_b32 / carry-in mask transitively depends on Atom::Opaque or Atom::Constant through phi_masks (plain compare masks and uniform 0 / -1 joins do not trigger console_lanes).
  • This environment has no local title files per docs/asset-policy.md, so the exact number of retail shaders changed in shaders.rpf cannot be measured here.

3. Single resolution per (data_phi, edge) and draining new pending_masks in fill_phis

  • Refactored fill_phis (crates/victory-shader/src/emit/lower.rs) to track resolved: Vec<Vec<Option<V>>> across fixpoint iterations instead of re-running fill_data_phis over already-resolved edges:
    • Each iteration drains fill_mask_phis()?, recomputes live = self.live_edges(), and resolves only newly-live unresolved (idx, n) entries once (mask_dword is never invoked twice for the same incoming edge).
    • The loop repeats whenever pending_masks is non-empty, self.read_phis grows, or any new data-phi edge resolves, and self.s.m.set_phi(v, incoming) is called once per data phi after convergence—preventing empty phi i1 entries when a data join materializes a loop mask (@tyr0nsur's report).
  • Added emit::lower::tests::fill_phis_fixpoint_resolves_loop_mask_ballot_without_empty_phi_or_duplicate_ballots, exercising a two-hop chain (s6 data join -> s2 loop mask -> s7 data phi -> s9 loop mask) and asserting lowered.wave_ballots == 2 and dxil.dll validation.

Verification (7420237)

  • cargo run -p xtask -- policy -> 186 files ok
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings & --all-features -> clean
  • cargo test -p victory-shader --locked -> 316 passed; 0 failed; 3 ignored (unit), 3 passed; 0 failed; 1 ignored (resource_tracking), 0 passed; 0 failed (doctests)
  • VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi -> 6 passed; 0 failed
**@⁠nathanbzrr** on GitHub · 2026-11-25 22:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7176331974) Rebased onto `origin/main` (`f3578e3`, new head `7420237`) and addressed the three triage questions + fixpoint duplication issue: ### 1. Whole-mask & cross-lane reads after a per-lane join (`given(m, e)`) - Both `fill_mask_phis` and the `avoids` links only evaluate `given(m, e)` under edge `e`: - In `fill_mask_phis`, the lowered `phi i1` selects `(x, qb)` specifically along predecessor edge `q -> b`, where `e` holds for every lane traversing that edge, so `given(m, e)` evaluates to the exact same per-lane bit as `m` on that path (while allowing edges like `if (v0 < s0) { s2 = vcc_lo }` where `given(m, e) == Bool::TRUE` to simplify cleanly). - In `avoids`, `lane_edge(q, to)` already constrains `e`, so `(joined == given(m, e))` on edge `q -> to` is equivalent to `(joined == m)` for lanes taking that edge. - Added synthetic tests reading the joined mask both as a whole 32-bit integer (`s_and_b32 s6, s2, exec_lo`) and cross-lane via `v_readlane_b32` (lanes 0 and 31) after per-lane joins: - `emit::lower::tests::per_lane_mask_phi_read_as_whole_mask_and_readlane_validates` (`WaveActiveBallot` emitted once, validated with `dxil.dll`). - `emit::valu_tests::lane_mask_phi_whole_read_and_readlane_execute_correctly` (executed on host GPU covering both `s2 = vcc_lo` where `given(m, e) == Bool::TRUE` and an independent sub-mask `v0 < s1` under `v0 < s0`). ### 2. `console_lanes` scan (`selects`) scope & title shader count - Updated `selects` in `crates/victory-shader/src/emit/lower.rs` to skip unreachable blocks (`x.st.reach[b] != Bool::FALSE`). - The scan still enables `console_lanes` only when a reachable `v_cndmask_b32` / carry-in mask transitively depends on `Atom::Opaque` or `Atom::Constant` through `phi_masks` (plain compare masks and uniform `0` / `-1` joins do not trigger `console_lanes`). - This environment has no local title files per `docs/asset-policy.md`, so the exact number of retail shaders changed in `shaders.rpf` cannot be measured here. ### 3. Single resolution per `(data_phi, edge)` and draining new `pending_masks` in `fill_phis` - Refactored `fill_phis` (`crates/victory-shader/src/emit/lower.rs`) to track `resolved: Vec<Vec<Option<V>>>` across fixpoint iterations instead of re-running `fill_data_phis` over already-resolved edges: - Each iteration drains `fill_mask_phis()?`, recomputes `live = self.live_edges()`, and resolves only newly-live unresolved `(idx, n)` entries once (`mask_dword` is never invoked twice for the same incoming edge). - The loop repeats whenever `pending_masks` is non-empty, `self.read_phis` grows, or any new data-phi edge resolves, and `self.s.m.set_phi(v, incoming)` is called **once** per data phi after convergence—preventing empty `phi i1` entries when a data join materializes a loop mask (`@tyr0nsur`'s report). - Added `emit::lower::tests::fill_phis_fixpoint_resolves_loop_mask_ballot_without_empty_phi_or_duplicate_ballots`, exercising a two-hop chain (`s6` data join -> `s2` loop mask -> `s7` data phi -> `s9` loop mask) and asserting `lowered.wave_ballots == 2` and `dxil.dll` validation. ### Verification (`7420237`) - `cargo run -p xtask -- policy` -> `186 files ok` - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings` & `--all-features` -> clean - `cargo test -p victory-shader --locked` -> `316 passed; 0 failed; 3 ignored` (unit), `3 passed; 0 failed; 1 ignored` (`resource_tracking`), `0 passed; 0 failed` (doctests) - `VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi` -> `6 passed; 0 failed`
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-25 23:05 UTC · original

Updated shaders/lane-mask-phi-joins (rebased on origin/main 842b0cb, new head a3defec) to fix the xtask asset-policy failure (crates/victory-shader/src/emit/lower.rs was 538,775 bytes vs. the 524,288-byte limit):

  • Extracted PR #385's lane-mask phi lowering (fill_mask_phis, fill_phis), console-lanes mask scan (mask_uses_console_lanes), and 9 unit tests into submodule crates/victory-shader/src/emit/lower/phi.rs (22,696 bytes), matching lower/bvh.rs (emit/lower.rs is now 515,592 LF bytes / 515,626 disk bytes).

Verification (a3defec)

  • cargo test -p xtask --locked -> 6 passed; 0 failed (policy::tests::repository_passes_policy ... ok)
  • cargo run -p xtask -- policy -> 186 files ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings & --all-features -> clean
  • cargo test -p victory-shader --locked -> 316 passed; 0 failed; 3 ignored (unit), 3 passed; 0 failed; 1 ignored (resource_tracking)
  • VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi -> 6 passed; 0 failed
**@⁠nathanbzrr** on GitHub · 2026-11-25 23:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7177131727) Updated `shaders/lane-mask-phi-joins` (rebased on `origin/main` `842b0cb`, new head `a3defec`) to fix the `xtask` asset-policy failure (`crates/victory-shader/src/emit/lower.rs` was `538,775` bytes vs. the `524,288`-byte limit): - Extracted PR #385's lane-mask phi lowering (`fill_mask_phis`, `fill_phis`), console-lanes mask scan (`mask_uses_console_lanes`), and 9 unit tests into submodule `crates/victory-shader/src/emit/lower/phi.rs` (`22,696` bytes), matching `lower/bvh.rs` (`emit/lower.rs` is now `515,592` LF bytes / `515,626` disk bytes). ### Verification (`a3defec`) - `cargo test -p xtask --locked` -> `6 passed; 0 failed` (`policy::tests::repository_passes_policy ... ok`) - `cargo run -p xtask -- policy` -> `186 files ok` - `cargo clippy --workspace --all-targets --locked -- -D warnings` & `--all-features` -> clean - `cargo test -p victory-shader --locked` -> `316 passed; 0 failed; 3 ignored` (unit), `3 passed; 0 failed; 1 ignored` (`resource_tracking`) - `VICTORY_WARP=1 cargo test -p victory-shader --locked -- lane_mask_phi` -> `6 passed; 0 failed`
Author
Owner

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

Code review and RTX 5090 + WARP + DXIL verification at head a3defece8db9 merged cleanly onto main (63bcca43c6a0):

  • Bonus lower.rs headroom: Extracting crates/victory-shader/src/emit/lower/phi.rs (22,696 B) shrinks emit/lower.rs from 520,563 B down to 515,626 B (8,662 B below the 512 KiB policy limit).
  • Code review (structure.rs:475-477, 827-900, emit/lower/phi.rs):
    • check_joins inspects all incoming edges (including back edges) of Join/PhiJoin, re-running when a back edge promotes a phi into derived_phis, and exports exact per-edge booleans via b.given(m, e) in phi_masks.
    • mask_uses_console_lanes walks Atom::Phi edges transitively so console_lanes/WAVE_OPS are triggered accurately, fill_mask_phis emits exact per-edge boolean(phi_edge, qb), and fill_phis uses a fixed-point resolved[idx][n] loop preventing empty phis or duplicate waveActiveBallot calls on cyclic masks read as data.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, dxil.dll 10.0.26100.0, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 192 files ok; cargo clippy (default + --features diagnostics): 0 warnings
    • emit::lower::tests (33/33), structure:: (16/16, 1 ignored), phi (25/25, including emit::lower::phi::tests and both GPU lane_mask_phi_* tests), and emit::semantics_tests (34/34 on both RTX 5090 and WARP, 1 ignored) all passed.

Solid fix and welcome lower.rs size reduction; LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7179849068) Code review and RTX 5090 + WARP + DXIL verification at head `a3defece8db9` merged cleanly onto `main` (`63bcca43c6a0`): - **Bonus `lower.rs` headroom**: Extracting `crates/victory-shader/src/emit/lower/phi.rs` (`22,696` B) shrinks `emit/lower.rs` from `520,563` B down to **`515,626` B** (`8,662` B below the 512 KiB policy limit). - **Code review (`structure.rs:475-477, 827-900`, `emit/lower/phi.rs`)**: - `check_joins` inspects all incoming edges (including back edges) of `Join`/`PhiJoin`, re-running when a back edge promotes a phi into `derived_phis`, and exports exact per-edge booleans via `b.given(m, e)` in `phi_masks`. - `mask_uses_console_lanes` walks `Atom::Phi` edges transitively so `console_lanes`/`WAVE_OPS` are triggered accurately, `fill_mask_phis` emits exact per-edge `boolean(phi_edge, qb)`, and `fill_phis` uses a fixed-point `resolved[idx][n]` loop preventing empty phis or duplicate `waveActiveBallot` calls on cyclic masks read as data. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `dxil.dll` 10.0.26100.0, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `192 files ok`; `cargo clippy` (default + `--features diagnostics`): 0 warnings - `emit::lower::tests` (33/33), `structure::` (16/16, 1 ignored), `phi` (25/25, including `emit::lower::phi::tests` and both GPU `lane_mask_phi_*` tests), and `emit::semantics_tests` (34/34 on both RTX 5090 and WARP, 1 ignored) all passed. Solid fix and welcome `lower.rs` size reduction; LGTM.
Author
Owner

@⁠Anzymanz on GitHub · 2026-11-26 02:19 UTC · original

From a tester working with Claude (AI-assisted, Claude Code): an offline check of this PR over a whole title's shader pack (25,889 distinct containers through emit::translate_with; hashes and counts only).

  • On this PR's head alone: of the 24 real programs the title's pack refuses (the other refusals are geometry-only containers), the 13 that stop at a lane-mask join of an untracked mask all translate.
  • On main 63bcca4 + #2348 + #2978, then with this PR (a3defec cherry-picked; the only conflicts were the mod lines and adjacent test additions, keep both): refused 219 → 202. 17 programs now translate: the 13 above, plus 4 that #2348 and #2978 had brought to a lane-mask join. 1,418 programs' output changes in all, and none goes from translated to refused.
  • All 1,418 changed programs' DXIL converts with dxil-spirv (master).

Not run: your GPU tests, and the title in a game run. Translation only.

**@⁠Anzymanz** on GitHub · 2026-11-26 02:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7180689599) From a tester working with Claude (AI-assisted, Claude Code): an offline check of this PR over a whole title's shader pack (25,889 distinct containers through `emit::translate_with`; hashes and counts only). - **On this PR's head alone:** of the 24 real programs the title's pack refuses (the other refusals are geometry-only containers), the 13 that stop at `a lane-mask join of an untracked mask` all translate. - **On main `63bcca4` + #2348 + #2978, then with this PR** (`a3defec` cherry-picked; the only conflicts were the `mod` lines and adjacent test additions, keep both): refused 219 → **202**. 17 programs now translate: the 13 above, plus 4 that #2348 and #2978 had brought to a lane-mask join. 1,418 programs' output changes in all, and **none** goes from translated to refused. - All 1,418 changed programs' DXIL converts with dxil-spirv (master). Not run: your GPU tests, and the title in a game run. Translation only.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 03:12 UTC · original

@⁠nathanbzrr I found a case outside the phi-edge tests where the same console-wave scan matters. A Wave32 compute shader uses v_cndmask_b32 v1, 0, 1, 15 and stores one result per lane. Only lanes 0–3 should write 1. On a3defec, translation stops at a constant lane mask. The select's direct inline mask never enters the scan. A partial mask in a scalar register can likewise be recorded in st.other, while the scan only looks in st.masks.

I put a standalone patch directly on your head. It checks both sources in reachable compute blocks. Inline zero and all-ones still work at any host wave size.

The new select regression covered nine 32-lane readbacks, including a scalar input with only bit 31 set and 0xa5a55a5a. The RTX 5080 and WARP 1.0.22 each returned 288/288 correct lane values. Built-in WARP returned 64/64 for the two width-independent controls and skipped the fixed Wave32 cases. The original phi execution tests and the fixed-point validator regression still pass. Strict shader Clippy passed.

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr385-direct-select-mask
git cherry-pick 1c73d188cb19e1ff8d0598124972ba897ed94e80
cargo test --locked -p victory-shader --lib direct_select_uses_this_lanes_mask_bit -- --nocapture

For the merge overlap with #2967, there is also a combined branch that preserves both PR histories and #171's signed carry fix. Your per-edge phi_masks and fixed-point resolution stay in lower/phi.rs. #2967 contributes its mask spill/restore and carry operand handling. Signed multiply-add SDST and carry-in are distinct here. The latter exposed the same missing direct-mask scan. Its eight additional Wave64 readbacks on portable WARP matched all 512 lanes, including masks that set only bits 32 or 63. lower.rs is 517,936 bytes in the combined tree (6,352 bytes below policy).

For wider coverage I also ran the combined production change with the carry regression. The library suite stopped at the heap-texture test tracked in #2571. Excluding that one test gave 321 passed, 3 ignored and the same two stride failures and gather failure seen on this host. The final targeted run included both new regressions and the saved-EXEC refusal control.

AI-assisted. All tests used synthetic shader inputs.

**@⁠steven-seagull27** on GitHub · 2026-11-26 03:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7181495818) @⁠nathanbzrr I found a case outside the phi-edge tests where the same console-wave scan matters. A Wave32 compute shader uses `v_cndmask_b32 v1, 0, 1, 15` and stores one result per lane. Only lanes 0–3 should write 1. On `a3defec`, translation stops at `a constant lane mask`. The select's direct inline mask never enters the scan. A partial mask in a scalar register can likewise be recorded in `st.other`, while the scan only looks in `st.masks`. I put a [standalone patch directly on your head](https://github.com/steven-seagull27/VIctory/commit/1c73d188cb19e1ff8d0598124972ba897ed94e80). It checks both sources in reachable compute blocks. Inline zero and all-ones still work at any host wave size. The new select regression covered nine 32-lane readbacks, including a scalar input with only bit 31 set and `0xa5a55a5a`. The RTX 5080 and WARP 1.0.22 each returned **288/288 correct lane values**. Built-in WARP returned **64/64** for the two width-independent controls and skipped the fixed Wave32 cases. The original phi execution tests and the fixed-point validator regression still pass. Strict shader Clippy passed. ```sh git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr385-direct-select-mask git cherry-pick 1c73d188cb19e1ff8d0598124972ba897ed94e80 cargo test --locked -p victory-shader --lib direct_select_uses_this_lanes_mask_bit -- --nocapture ``` For the [merge overlap with #2967](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2967), there is also a [combined branch](https://github.com/steven-seagull27/VIctory/commit/48df89a03c3c55f359193b713d441eb441e03aa7) that preserves both PR histories and #171's signed carry fix. Your per-edge `phi_masks` and fixed-point resolution stay in `lower/phi.rs`. #2967 contributes its mask spill/restore and carry operand handling. Signed multiply-add SDST and carry-*in* are distinct here. The latter exposed the same missing direct-mask scan. Its eight additional Wave64 readbacks on portable WARP matched all 512 lanes, including masks that set only bits 32 or 63. `lower.rs` is 517,936 bytes in the combined tree (6,352 bytes below policy). For wider coverage I also ran the combined production change with the carry regression. The library suite stopped at the heap-texture test tracked in [#2571](https://git.gtahub.st/github/Marvisak--VIctory/issues/2571). Excluding that one test gave 321 passed, 3 ignored and the same two stride failures and gather failure seen on this host. The final targeted run included both new regressions and the saved-EXEC refusal control. AI-assisted. All tests used synthetic shader inputs.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 13:19 UTC · original · reviewed

Test-merge with current main (ffe310e) conflicts — needs a rebase. Main moved recently (PR #566 waterfall loops touched lower.rs/resource.rs/valu_tests.rs), so shader PRs opened before it need rebasing. I'll re-review once it merges cleanly.

**@⁠catminou4** on GitHub · 2026-11-24 13:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#pullrequestreview-6039898336) · **reviewed** Test-merge with current main (`ffe310e`) **conflicts** — needs a rebase. Main moved recently (PR #566 waterfall loops touched `lower.rs`/`resource.rs`/`valu_tests.rs`), so shader PRs opened before it need rebasing. I'll re-review once it merges cleanly.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 09:55 UTC · original

@⁠nathanbzrr I rebased the direct-select mask fix onto your current head, 9099742, and reran the same regression on both revisions. The fix is one commit. Patch and regression test

On 9099742, all three adapters returned 64/64 correct lane values for the inline zero and all-ones controls. Translation then stopped at byte offset 24 with a constant lane mask for v_cndmask_b32 v1, 0, 1, 15, before that case could dispatch. Lanes 0–3 should select 1 and the other 28 should select 0.

Adapter Correct lane values with the fix
RTX 5080 288/288 across nine dispatches
Microsoft.Warp 1.0.22 288/288 across nine dispatches
Windows built-in WARP 64/64 for the two controls. The driver reports Wave4 only and skipped all seven fixed-Wave32 dispatches.

On your PR branch at 9099742, these commands fast-forward to the tested commit and run the synthetic readback test.

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr385-rebased-direct-select
git merge --ff-only FETCH_HEAD
cargo test --locked -p victory-shader --lib direct_select_uses_this_lanes_mask_bit -- --nocapture

AI-assisted with Codex.

**@⁠steven-seagull27** on GitHub · 2026-11-26 09:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7188657149) @⁠nathanbzrr I rebased the direct-select mask fix onto your current head, `9099742`, and reran the same regression on both revisions. The fix is one commit. [Patch and regression test](https://github.com/steven-seagull27/VIctory/commit/d8f0390dbe90541abe727c9a0c932a946af76b2a) On `9099742`, all three adapters returned 64/64 correct lane values for the inline zero and all-ones controls. Translation then stopped at byte offset 24 with `a constant lane mask` for `v_cndmask_b32 v1, 0, 1, 15`, before that case could dispatch. Lanes 0–3 should select 1 and the other 28 should select 0. | Adapter | Correct lane values with the fix | |---|---| | RTX 5080 | 288/288 across nine dispatches | | Microsoft.Warp 1.0.22 | 288/288 across nine dispatches | | Windows built-in WARP | 64/64 for the two controls. The driver reports Wave4 only and skipped all seven fixed-Wave32 dispatches. | On your PR branch at `9099742`, these commands fast-forward to the tested commit and run the synthetic readback test. ```sh git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr385-rebased-direct-select git merge --ff-only FETCH_HEAD cargo test --locked -p victory-shader --lib direct_select_uses_this_lanes_mask_bit -- --nocapture ``` AI-assisted with Codex.
Author
Owner

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

Splitting emit/lower/phi.rs brings emit/lower.rs down to 515,626 bytes (under the 524,288-byte policy limit) and the added structure/lowering/execution tests pass on RTX 5090 and WARP, but there are two correctness issues and a formatting check failure to resolve before merging:

  1. Non-uniform EXEC split misclassified as uniform (emit/lower.rs:8238-8247, emit/lower/phi.rs:121-154): uniform_join and forward_uniform only inspect immediate predecessors' exits, treating any LaneExit::Jump predecessor as uniform. Consider a Wave32 shader that initializes s2 to 0, narrows EXEC to lanes 0..16 (saving the original EXEC in s7), and branches on s_cbranch_execz so the nonempty arm copies s7 into s2 and jumps to the join while the skip arm also reaches the join via an unconditional s_branch, where EXEC is restored and v_cndmask_b32 selects on s2. On GFX10, the nonempty arm writes the wave-wide SGPR s2, so all 32 lanes should select true; because both immediate predecessors end in Jump, uniform_join returns true and fill_mask_phis feeds per-lane phi_edge booleans (true to lanes 0..15, false to lanes 16..31). Please keep rejecting joins unless uniformity across earlier EXEC splits is proven, and add a readback test covering two Jump predecessors.
  2. avoids vs. no_mask_lane_on_edge model mismatch (emit/lower.rs:8177-8190, emit/lower/phi.rs:155-158): avoids reads st.phi_masks[&ph.value][n] (falling back to st.masks.get(&ph.args[n])), whereas fill_mask_phis synthesizes false via no_mask_lane_on_edge when st.masks.get(&arg) is None and !uniform. If phi_masks stores a non-FALSE boolean derived from an unmasked data operand along that edge, the boolean model queried by avoids diverges from the false constant emitted into the phi.
  3. Formatting: rustfmt --edition 2024 --check fails on newly added code in crates/victory-shader/src/emit/lower/phi.rs (lines 34, 412) and the new tests in crates/victory-shader/src/emit/valu_tests.rs (lines 2557–2599).

Verified locally on Windows 11 x64 (RTX 5090 + WARP, 90997428):

  • cargo run --locked -p xtask -- policy (192 files ok) and cargo clippy --workspace --all-targets -- -D warnings (default and --all-features): clean.
  • structure::tests: 16 passed (1 ignored); emit::lower::tests: 33 passed; emit::lower::phi::tests: 11 passed; RTX 5090 & VICTORY_WARP=1 valu_tests::lane_mask_phi_*: 6 passed, 0 failed.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#pullrequestreview-6072968100) · **requested changes** Splitting `emit/lower/phi.rs` brings `emit/lower.rs` down to `515,626` bytes (under the `524,288`-byte policy limit) and the added structure/lowering/execution tests pass on RTX 5090 and WARP, but there are two correctness issues and a formatting check failure to resolve before merging: 1. **Non-uniform EXEC split misclassified as uniform (`emit/lower.rs:8238-8247`, `emit/lower/phi.rs:121-154`)**: `uniform_join` and `forward_uniform` only inspect immediate predecessors' exits, treating any `LaneExit::Jump` predecessor as uniform. Consider a Wave32 shader that initializes `s2` to `0`, narrows `EXEC` to lanes `0..16` (saving the original `EXEC` in `s7`), and branches on `s_cbranch_execz` so the nonempty arm copies `s7` into `s2` and jumps to the join while the skip arm also reaches the join via an unconditional `s_branch`, where `EXEC` is restored and `v_cndmask_b32` selects on `s2`. On GFX10, the nonempty arm writes the wave-wide SGPR `s2`, so all 32 lanes should select true; because both immediate predecessors end in `Jump`, `uniform_join` returns `true` and `fill_mask_phis` feeds per-lane `phi_edge` booleans (`true` to lanes `0..15`, `false` to lanes `16..31`). Please keep rejecting joins unless uniformity across earlier EXEC splits is proven, and add a readback test covering two `Jump` predecessors. 2. **`avoids` vs. `no_mask_lane_on_edge` model mismatch (`emit/lower.rs:8177-8190`, `emit/lower/phi.rs:155-158`)**: `avoids` reads `st.phi_masks[&ph.value][n]` (falling back to `st.masks.get(&ph.args[n])`), whereas `fill_mask_phis` synthesizes `false` via `no_mask_lane_on_edge` when `st.masks.get(&arg)` is `None` and `!uniform`. If `phi_masks` stores a non-`FALSE` boolean derived from an unmasked data operand along that edge, the boolean model queried by `avoids` diverges from the `false` constant emitted into the phi. 3. **Formatting**: `rustfmt --edition 2024 --check` fails on newly added code in `crates/victory-shader/src/emit/lower/phi.rs` (lines 34, 412) and the new tests in `crates/victory-shader/src/emit/valu_tests.rs` (lines 2557–2599). Verified locally on Windows 11 x64 (RTX 5090 + WARP, `90997428`): - `cargo run --locked -p xtask -- policy` (`192 files ok`) and `cargo clippy --workspace --all-targets -- -D warnings` (default and `--all-features`): clean. - `structure::tests`: 16 passed (1 ignored); `emit::lower::tests`: 33 passed; `emit::lower::phi::tests`: 11 passed; RTX 5090 & `VICTORY_WARP=1` `valu_tests::lane_mask_phi_*`: 6 passed, 0 failed.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 11:27 UTC · original

@⁠nathanbzrr @⁠fuzeofficlal I reproduced both findings on 90997428. In the first shader, both incoming blocks end in an unconditional jump, but their reach conditions select complementary lanes. If any lane enters the nonempty arm, its scalar write copies the original EXEC (all 32 bits) to s2. Review

Active lanes before the branch 0 1 8 16 31 32
Incorrect output lanes on the PR head 0 31 24 16 1 0

The RTX 5080, Windows inbox WARP, and WARP 1.0.22 each returned the same 72/192 incorrect words. For 16 active lanes, lanes 16–31 read 0 where 1 was expected. The patch refuses the unproven join before dispatch. A twin driven by a uniform scalar compare still translates and matched 192/192 per adapter. The regression also exercises initializing s2 from VCC, so both incoming masks are tracked.

The second regression is a synthetic pixel shader. One arm overwrites the interpolation j coordinate. On that incoming edge, the original interpolation proof reads TRUE while the emitted phi uses FALSE. With the inverted mask the original accepted the shader. The patch drops the contradictory fact, and both guard polarities now get the expected computed-barycentrics refusal. This check is at translation time.

The structure, lowering, phi and emitter test groups passed, including the existing valid interpolation and execution controls. I also ran shader Clippy with all features and the asset-policy check. This commit is based directly on the PR head and is independent of my earlier direct-select fix. Patch and both regressions

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr385-divergent-mask-joins
git cherry-pick 21e8b7098ae9b5b14c9698b4bc59a74ba5556c32

AI-assisted with Codex. Synthetic inputs on native Windows.

**@⁠steven-seagull27** on GitHub · 2026-11-26 11:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/385#issuecomment-7190754756) @⁠nathanbzrr @⁠fuzeofficlal I reproduced both findings on `90997428`. In the first shader, both incoming blocks end in an unconditional jump, but their reach conditions select complementary lanes. If any lane enters the nonempty arm, its scalar write copies the original EXEC (all 32 bits) to s2. [Review](https://git.gtahub.st/github/Marvisak--VIctory/pulls/385) | Active lanes before the branch | 0 | 1 | 8 | 16 | 31 | 32 | |---|---:|---:|---:|---:|---:|---:| | Incorrect output lanes on the PR head | 0 | 31 | 24 | 16 | 1 | 0 | The RTX 5080, Windows inbox WARP, and WARP 1.0.22 each returned the same **72/192 incorrect words**. For 16 active lanes, lanes 16–31 read `0` where `1` was expected. The patch refuses the unproven join before dispatch. A twin driven by a uniform scalar compare still translates and matched **192/192 per adapter**. The regression also exercises initializing s2 from VCC, so both incoming masks are tracked. The second regression is a synthetic pixel shader. One arm overwrites the interpolation j coordinate. On that incoming edge, the original interpolation proof reads `TRUE` while the emitted phi uses `FALSE`. With the inverted mask the original accepted the shader. The patch drops the contradictory fact, and both guard polarities now get the expected computed-barycentrics refusal. This check is at translation time. The structure, lowering, phi and emitter test groups passed, including the existing valid interpolation and execution controls. I also ran shader Clippy with all features and the asset-policy check. This commit is based directly on the PR head and is independent of my earlier direct-select fix. [Patch and both regressions](https://github.com/steven-seagull27/VIctory/commit/21e8b7098ae9b5b14c9698b4bc59a74ba5556c32) ```sh git fetch https://github.com/steven-seagull27/VIctory.git codex/pr385-divergent-mask-joins git cherry-pick 21e8b7098ae9b5b14c9698b4bc59a74ba5556c32 ``` AI-assisted with Codex. Synthetic inputs on native Windows.
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/385/head:github-bot/gh-385'
git switch 'github-bot/gh-385'

Merge

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