Shaders: honor permlane EXEC and FI/BC flags (on #1014) #1737

Open
github-bot wants to merge 5 commits from github-bot/gh-1737 into main AGit
Owner

@⁠jaschinski97-ops on GitHub · 2026-11-24 21:40 UTC · original
jaschinski97-ops:fix/upstream-permlane-flags → main · +520 −1 · 3 files · 5 commits · open

Lower v_permlane16_b32 and v_permlanex16_b32 with console EXEC source activity and FI/BC semantics. A selected inactive source must preserve the old destination or return zero according to BC, unless FI requests inactive-lane fetches.

Builds on #1014 (original author commit retained), whose synthetic reverse-row/masked-EXEC case returned a source value instead of the required old destination. Updated against upstream main 940d32f, with its unrelated shader changes retained. Coordination: PR #1737 in #1633.

  • Ballot console EXEC together with host activity; use a safe active shuffle lane before selecting an inactive-source fallback.

  • Honor both instruction flags, both row operations and in-place aliasing; reject unsupported input modifiers.

  • Require full host participation for FI. The analysis includes per-lane loop-limit returns, unresolved divergence, uniform branches and genuine reconvergence.

  • Add synthetic GPU readback and control-flow regressions.

Validation: Windows 11, NVIDIA GeForce RTX 3080, driver 32.0.16.2140; Rust 1.98.1 Windows GNU.

  • GPU matrix: 400 dispatches / 51,200 lane results, both operations, all FI/BC combinations, aliasing, five selectors and five EXEC masks. All pass. Final 940d32f targeted run: all five permlane tests pass, including four control-flow regressions; the loop-abort case fails without its correction.

  • Shader Clippy, all targets, diagnostics+host, warnings denied: passed. Asset policy: passed. Independent review of the current-main merge: no blocking findings.

Native wave32 is tested. RTX 3080 cannot execute native wave64, which is capability-skipped. WARP reports four-lane waves here and skips the row matrix. This does not add wave64 emulation or establish game boot, FPS or complete RTX compatibility. Fixtures are synthetic; no title data was used.

AI-assisted with Codex, including parallel research and independent agent review. GPU processes were serialized centrally. GitHub Actions passes on head a29e902 (Windows MSVC).

Combined local validation (main 940d32f + all three contributions, integration cfa116d):

  • cargo clippy --locked --workspace --all-targets --all-features -- -D warnings: passed.

  • cargo test --locked --workspace --all-features --no-fail-fast -- --test-threads=1: completed unfiltered; six tests fail. Shader suite: 271 passed, 3 failed, 3 ignored. GPU suite: 145 passed, 2 failed, 2 ignored. The five GPU/shader failures were independently reproduced on bare main 940d32f. The sixth is loads_binds_and_calls_probe: its unchanged fixture passes MSVC /DELAYLOAD to the local GNU linker, which rejects it.

  • The baseline failures are dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views, a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, and gathers_at_a_level_match_the_hardware. The full local workspace run is therefore explicitly not reported as passing.

  • New regression tests and the repository asset policy pass. All three PRs also pass GitHub's Windows MSVC CI. Green CI does not substitute for the separately reported RTX readback evidence.

App-local WARP follow-up: an external native-HLSL control reports the same cross-row/ballot-selected-index mismatch as the translated shader on Microsoft WARP 1.0.22 (#1737). This supports a DXC/WARP execution-path discrepancy; I have not independently reproduced that app-local build. A separate divergent-case discrepancy is still open. The local built-in WARP only supports four-lane waves and skips the matrix. No assertions are weakened to hide this limitation.

Refresh against main 67e8ae1 (2026-11-25)

Current-main refresh: head abb811f merges main 67e8ae1401df112248aed36d0024483181b718b7 without conflict. The permlane semantics are unchanged. All 6 permlane tests pass again, including 400 RTX 3080 Wave32 dispatches / 51,200 lane values; native Wave64 is unsupported on this card and built-in WARP (4..4 lanes) capability-skips this matrix. The app-local WARP caveat above remains open. Combined current-main validation also passes all 17 general emitter tests, all 20 interpolation tests and all 3 pipeline host-state tests, plus workspace Clippy for all targets/all features with warnings denied. This is targeted validation, not a new full-workspace native test result. GitHub Windows MSVC CI: https://github.com/Marvisak/VIctory/actions/runs/45652322993 (passed on this head).

Coordination bookkeeping: the earlier claim label was incorrect; see the correction.

**@⁠jaschinski97-ops** on GitHub · 2026-11-24 21:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737) `jaschinski97-ops:fix/upstream-permlane-flags` → `main` · +520 −1 · 3 files · 5 commits · open Lower v_permlane16_b32 and v_permlanex16_b32 with console EXEC source activity and FI/BC semantics. A selected inactive source must preserve the old destination or return zero according to BC, unless FI requests inactive-lane fetches. Builds on #1014 (original author commit retained), whose synthetic reverse-row/masked-EXEC case returned a source value instead of the required old destination. Updated against upstream main 940d32f, with its unrelated shader changes retained. Coordination: PR #1737 in #1633. - Ballot console EXEC together with host activity; use a safe active shuffle lane before selecting an inactive-source fallback. - Honor both instruction flags, both row operations and in-place aliasing; reject unsupported input modifiers. - Require full host participation for FI. The analysis includes per-lane loop-limit returns, unresolved divergence, uniform branches and genuine reconvergence. - Add synthetic GPU readback and control-flow regressions. Validation: Windows 11, NVIDIA GeForce RTX 3080, driver 32.0.16.2140; Rust 1.98.1 Windows GNU. - GPU matrix: 400 dispatches / 51,200 lane results, both operations, all FI/BC combinations, aliasing, five selectors and five EXEC masks. All pass. Final 940d32f targeted run: all five permlane tests pass, including four control-flow regressions; the loop-abort case fails without its correction. - Shader Clippy, all targets, diagnostics+host, warnings denied: passed. Asset policy: passed. Independent review of the current-main merge: no blocking findings. Native wave32 is tested. RTX 3080 cannot execute native wave64, which is capability-skipped. WARP reports four-lane waves here and skips the row matrix. This does not add wave64 emulation or establish game boot, FPS or complete RTX compatibility. Fixtures are synthetic; no title data was used. AI-assisted with Codex, including parallel research and independent agent review. GPU processes were serialized centrally. GitHub Actions passes on head a29e902 (Windows MSVC). Combined local validation (main 940d32f + all three contributions, integration cfa116d): - `cargo clippy --locked --workspace --all-targets --all-features -- -D warnings`: passed. - `cargo test --locked --workspace --all-features --no-fail-fast -- --test-threads=1`: completed unfiltered; six tests fail. Shader suite: 271 passed, 3 failed, 3 ignored. GPU suite: 145 passed, 2 failed, 2 ignored. The five GPU/shader failures were independently reproduced on bare main 940d32f. The sixth is `loads_binds_and_calls_probe`: its unchanged fixture passes MSVC `/DELAYLOAD` to the local GNU linker, which rejects it. - The baseline failures are `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`, `a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, and `gathers_at_a_level_match_the_hardware`. The full local workspace run is therefore explicitly not reported as passing. - New regression tests and the repository asset policy pass. All three PRs also pass GitHub's Windows MSVC CI. Green CI does not substitute for the separately reported RTX readback evidence. App-local WARP follow-up: an external native-HLSL control reports the same cross-row/ballot-selected-index mismatch as the translated shader on Microsoft WARP 1.0.22 (https://git.gtahub.st/github/Marvisak--VIctory/pulls/1737). This supports a DXC/WARP execution-path discrepancy; I have not independently reproduced that app-local build. A separate divergent-case discrepancy is still open. The local built-in WARP only supports four-lane waves and skips the matrix. No assertions are weakened to hide this limitation. ### Refresh against main 67e8ae1 (2026-11-25) Current-main refresh: head `abb811f` merges main `67e8ae1401df112248aed36d0024483181b718b7` without conflict. The permlane semantics are unchanged. All 6 permlane tests pass again, including 400 RTX 3080 Wave32 dispatches / 51,200 lane values; native Wave64 is unsupported on this card and built-in WARP (4..4 lanes) capability-skips this matrix. The app-local WARP caveat above remains open. Combined current-main validation also passes all 17 general emitter tests, all 20 interpolation tests and all 3 pipeline host-state tests, plus workspace Clippy for all targets/all features with warnings denied. This is targeted validation, not a new full-workspace native test result. GitHub Windows MSVC CI: https://github.com/Marvisak/VIctory/actions/runs/45652322993 (passed on this head). Coordination bookkeeping: the earlier claim label was incorrect; see the [correction](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:43:19 +00:00
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-24 21:53 UTC · original

The RTX 5080 passed the Wave32 matrix. With app-local Microsoft WARP 1.0.22, permlane_rows_and_inactive_sources reproduced a cross-row mismatch. I reran the unmodified test on the updated PR head 108b38b: the RTX passed again, and WARP stopped at the same Wave32 assertion on lane 4.

Full counts on 6950616. I temporarily collected mismatches past the first assertion so the test could finish both wave sizes. Two fresh runs gave identical counts. Each row below is one run.

Adapter Wave size Dispatches with a mismatch Incorrect lane values
RTX 5080 (driver 621.24) 32 0 / 400 0 / 51,200
WARP 1.0.22 32 4 / 400 64 / 51,200
WARP 1.0.22 64 4 / 400 64 / 51,200

Lane 4 read lane 14 instead of lane 30. With v_permlanex16_b32, selectors [0xF10E2D3C, 0x4B5A6978], EXEC=0x55555555, and FI=0, lane 4 selects index 14 in the opposite 16-lane row. Both destination lane 4 and source lane 30 are active. The expected value was 0x1234001e (lane 30); WARP returned 0x1234000e (lane 14 in the same row). This was the first difference at both wave sizes in the complete runs. It reproduced with either BC setting and with or without source/destination aliasing. Every same-row permutation passed.

Windows 11 build 26300.10075. Built-in WARP reported a wave range of 4–4 and skipped the matrix. The app-local WARP DLL reported 4–128 and exercised both wave sizes.

**@⁠steven-seagull27** on GitHub · 2026-11-24 21:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7145520654) The RTX 5080 passed the Wave32 matrix. With app-local Microsoft WARP 1.0.22, `permlane_rows_and_inactive_sources` reproduced a cross-row mismatch. I reran the unmodified test on the updated PR head `108b38b`: the RTX passed again, and WARP stopped at the same Wave32 assertion on lane 4. **Full counts on `6950616`.** I temporarily collected mismatches past the first assertion so the test could finish both wave sizes. Two fresh runs gave identical counts. Each row below is one run. | Adapter | Wave size | Dispatches with a mismatch | Incorrect lane values | |---|---:|---:|---:| | RTX 5080 (driver 621.24) | 32 | 0 / 400 | 0 / 51,200 | | WARP 1.0.22 | 32 | 4 / 400 | 64 / 51,200 | | WARP 1.0.22 | 64 | 4 / 400 | 64 / 51,200 | **Lane 4 read lane 14 instead of lane 30.** With `v_permlanex16_b32`, selectors `[0xF10E2D3C, 0x4B5A6978]`, `EXEC=0x55555555`, and `FI=0`, lane 4 selects index 14 in the opposite 16-lane row. Both destination lane 4 and source lane 30 are active. The expected value was `0x1234001e` (lane 30); WARP returned `0x1234000e` (lane 14 in the same row). This was the first difference at both wave sizes in the complete runs. It reproduced with either BC setting and with or without source/destination aliasing. Every same-row permutation passed. Windows 11 build 26300.10075. Built-in WARP reported a wave range of 4–4 and skipped the matrix. The app-local WARP DLL reported 4–128 and exercised both wave sizes.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:36 UTC · original · edited 2026-11-25 22:24 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: main has moved since the last triage, and the branch now conflicts in crates/victory-shader/src/emit/lower.rs. It will be reviewed again once it is rebased onto current main.

Previous verdict for this head: merge candidate.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7152074720) · edited 2026-11-25 22:24 UTC <!-- victory-triage v1 head=abb811f13df1eefbd37de1e0bdfb068caf666471 verdict=needs-rebase at=2026-11-25T22:27:00Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main`: `main` has moved since the last triage, and the branch now conflicts in `crates/victory-shader/src/emit/lower.rs`. It will be reviewed again once it is rebased onto current `main`. Previous verdict for this head: merge candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠zed6000 on GitHub · 2026-11-25 04:23 UTC · original

Measured offline on the title's shaders (the method in #1247): merged onto main 940d32f (a clean merge), +1 program and 0 lost. On main it failed with "emit: v_permlanex16_b32".

One thing to fix: on 940d32f the new permlane_tests.rs no longer compiles. Main's cd94d35 added a view_marks field, and the test's Parts { .. } (line 85) and HostShader { .. } (line 97) initializers don't set it (E0063: missing field view_marks). The release build is unaffected. Adding the field to both initializers should be enough. Offline counts only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-25 04:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7152801510) Measured offline on the title's shaders (the method in #1247): merged onto main `940d32f` (a clean merge), **+1 program and 0 lost**. On main it failed with "emit: v_permlanex16_b32". One thing to fix: on `940d32f` the new `permlane_tests.rs` no longer compiles. Main's `cd94d35` added a `view_marks` field, and the test's `Parts { .. }` (line 85) and `HostShader { .. }` (line 97) initializers don't set it (`E0063: missing field view_marks`). The release build is unaffected. Adding the field to both initializers should be enough. Offline counts only; no program names or data.
Author
Owner

@⁠zed6000 on GitHub · 2026-11-25 04:27 UTC · original

To square this with the macOS approval above: permlane_tests is #[cfg(all(test, windows))], so it compiles only on Windows, and a macOS or Linux test run never builds it. I rechecked this PR alone, merged onto 940d32f, on Windows: cargo test -p victory-shader --lib --no-run fails with E0063: missing field view_marks in Parts and HostShader. Those are main's new fields from cd94d35. The release build and the +1 program are unaffected. Adding view_marks to the two test initializers is the whole fix.

**@⁠zed6000** on GitHub · 2026-11-25 04:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7152865446) To square this with the macOS approval above: `permlane_tests` is `#[cfg(all(test, windows))]`, so it compiles only on Windows, and a macOS or Linux test run never builds it. I rechecked this PR alone, merged onto `940d32f`, on Windows: `cargo test -p victory-shader --lib --no-run` fails with `E0063: missing field view_marks` in `Parts` and `HostShader`. Those are main's new fields from `cd94d35`. The release build and the +1 program are unaffected. Adding `view_marks` to the two test initializers is the whole fix.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-25 10:47 UTC · original

The lane-4 mismatch reproduces in independently compiled HLSL on Microsoft WARP 1.0.22. DXC compiled the control directly to Shader Model 6.6. I also reran the translated matrix on a29e902, which now builds on Windows. The two matrices agreed on all the counts below.

Adapter and wave Dispatches with a mismatch Wrong lane values
RTX 5080, Wave32 0/400 0/51,200
WARP 1.0.22, Wave32 4/400 64/51,200
WARP 1.0.22, Wave64 4/400 64/51,200

With cross-row selection, FI=0 and EXEC=0x55555555, lane 4 computed source 30. Both lanes were enabled, and a hardware ballot showed every lane physically active. In the same native dispatch, WaveReadLaneAt(value, source) returned 0x1234001e (lane 30). Reading with the ballot-selected index returned 0x1234000e (lane 14), even though that index also read back as 30. This reproduced at -O3 and -Od. Built-in WARP on this PC reported wave sizes 4–4 and skipped both widths. The RTX skipped Wave64.

Passing the source index directly cleared the original 400-case matrix on standalone WARP. A separate FI-disabled test with a divergent branch still had 728/25,600 incorrect lanes at Wave32 and 828/25,600 at Wave64 with that change (original lowering: 780 and 734). I would keep the direct-index change experimental. The native control isolates the original discrepancy to this DXC/WARP execution path. The cause of the divergent case remains open.

The focused control is one commit on top of a29e902. It prints the adapter, loaded WARP DLL and both lane-4 results. HLSL source · Windows rerun instructions

**@⁠steven-seagull27** on GitHub · 2026-11-25 10:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7160177565) **The lane-4 mismatch reproduces in independently compiled HLSL on Microsoft WARP 1.0.22.** DXC compiled the control directly to Shader Model 6.6. I also reran the translated matrix on `a29e902`, which now builds on Windows. The two matrices agreed on all the counts below. | Adapter and wave | Dispatches with a mismatch | Wrong lane values | |---|---:|---:| | RTX 5080, Wave32 | 0/400 | 0/51,200 | | WARP 1.0.22, Wave32 | 4/400 | 64/51,200 | | WARP 1.0.22, Wave64 | 4/400 | 64/51,200 | With cross-row selection, `FI=0` and `EXEC=0x55555555`, lane 4 computed source 30. Both lanes were enabled, and a hardware ballot showed every lane physically active. In the **same native dispatch**, `WaveReadLaneAt(value, source)` returned `0x1234001e` (lane 30). Reading with the ballot-selected index returned `0x1234000e` (lane 14), even though that index also read back as 30. This reproduced at `-O3` and `-Od`. Built-in WARP on this PC reported wave sizes 4–4 and skipped both widths. The RTX skipped Wave64. Passing the source index directly cleared the original 400-case matrix on standalone WARP. A separate FI-disabled test with a divergent branch still had 728/25,600 incorrect lanes at Wave32 and 828/25,600 at Wave64 with that change (original lowering: 780 and 734). I would keep the direct-index change experimental. The native control isolates the original discrepancy to this DXC/WARP execution path. The cause of the divergent case remains open. The focused control is one commit on top of `a29e902`. It prints the adapter, loaded WARP DLL and both lane-4 results. [HLSL source](https://github.com/steven-seagull27/VIctory/blob/4ced7384507197c5163fdba7f154441d8e968e1d/tests/permlane-native/control.hlsl) · [Windows rerun instructions](https://github.com/steven-seagull27/VIctory/blob/4ced7384507197c5163fdba7f154441d8e968e1d/tests/permlane-native/README.md)
Author
Owner

@⁠jaschinski97-ops on GitHub · 2026-11-25 10:57 UTC · original

Status on current head a29e902, merged with main 940d32f:

  • Both synthetic initializers now set view_marks; Windows MSVC CI passes, as do the local Windows GNU build/Clippy checks. The earlier E0063 reports concern the preceding heads.
  • RTX 3080 driver 32.0.16.2140 passes all 400 native-wave32 dispatches / 51,200 lane values. Built-in WARP here reports 4..4 lanes and capability-skips this matrix.
  • Thank you for the independent control in #1737. Based on that report, the matching translated/native-HLSL failures point to the DXC/WARP execution path for ballot-selected indices. I have not independently rerun app-local WARP 1.0.22. The separate divergent-control-flow discrepancy remains unresolved; your direct-index experiment does not establish a safe general replacement for the current inactive-source handling.

The PR keeps the ISA semantics and regression assertions, and the software-backend limitation is explicit. No game-data or gameplay claim. AI-assisted follow-up.

**@⁠jaschinski97-ops** on GitHub · 2026-11-25 10:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7160391341) Status on current head a29e902, merged with main 940d32f: - Both synthetic initializers now set view_marks; Windows MSVC CI passes, as do the local Windows GNU build/Clippy checks. The earlier E0063 reports concern the preceding heads. - RTX 3080 driver 32.0.16.2140 passes all 400 native-wave32 dispatches / 51,200 lane values. Built-in WARP here reports 4..4 lanes and capability-skips this matrix. - Thank you for the independent control in https://git.gtahub.st/github/Marvisak--VIctory/pulls/1737. Based on that report, the matching translated/native-HLSL failures point to the DXC/WARP execution path for ballot-selected indices. I have not independently rerun app-local WARP 1.0.22. The separate divergent-control-flow discrepancy remains unresolved; your direct-index experiment does not establish a safe general replacement for the current inactive-source handling. The PR keeps the ISA semantics and regression assertions, and the software-backend limitation is explicit. No game-data or gameplay claim. AI-assisted follow-up.
Author
Owner

@⁠zed6000 on GitHub · 2026-11-25 18:26 UTC · original

Re-checked head abb811f on main 13f91ca (a clean merge), on Windows. permlane_tests compiles now, and cargo test -p victory-shader --lib gives 276 passed and 0 failed on an RX 7900 XTX. On shaders.rpf (1.0.2.1) it is +1 program, 0 lost: the one main still refuses with "emit: v_permlanex16_b32". Offline counts only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-25 18:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7170903715) Re-checked head `abb811f` on main `13f91ca` (a clean merge), on Windows. `permlane_tests` compiles now, and `cargo test -p victory-shader --lib` gives 276 passed and 0 failed on an RX 7900 XTX. On `shaders.rpf` (1.0.2.1) it is **+1 program, 0 lost**: the one main still refuses with "emit: v_permlanex16_b32". Offline counts only; no program names or data.
Author
Owner

@⁠pawrenity on GitHub · 2026-11-25 23:49 UTC · original

In case it saves you a step on the rebase: I merged current main (63bcca4) into head abb811f locally. The only conflict is the end of mod tests in crates/victory-shader/src/emit/lower.rs, where main added ds_bpermute_wave64_preserves_32_lane_half and ds_bpermute_refuses_gds next to your permlane16_lowers. Keeping both sides resolves it. The PR side only needs its closing }:

     #[test]
     fn permlane16_lowers() {
         ...
         lowers(&words, 0).expect("v_permlanex16_b32 should lower");
-=======
+    }
 
     #[test]
     fn ds_bpermute_wave64_preserves_32_lane_half() {

Nothing else conflicts. Results on that merge, on Windows 11 with an NVIDIA GeForce RTX 4070 + WARP (--test-threads=1):

  • cargo test -p victory-shader --lib --locked -- emit::permlane_tests emit::crosslane_tests emit::lower: 44 passed, 0 failed.
    • RTX 4070 reports waves 32..32. permlane_rows_and_inactive_sources passes the full Wave32 matrix and skips Wave64.
    • The built-in WARP reports waves 4..4, so it skips the permlane GPU matrix. The other GPU checks in crosslane_tests run only on hardware, apart from the pipeline-creation test, which also ran on WARP.
  • With app-local WARP 1.0.22 (d3d10warp.dll from the Microsoft.Direct3D.WARP NuGet package, next to the test binary; it reports waves 4..128), permlane_rows_and_inactive_sources fails at the same spot steven-seagull27 reported: WARP wave64=false cross=true fi=false bc=false alias=false selectors=[f10e2d3c, 4b5a6978] mask=55555555 lane=4, got 0x1234000e (lane 14), expected 0x1234001e (lane 30). The other 4 permlane tests, plus crosslane_tests and emit::lower (39 tests), pass with that DLL. I did not have the separate divergent FI=0 experiment, so I have no numbers for it.
  • Full lib suite (--skip heap_direct_texture_reads_mark_their_heap_index, which crashes the test process on main too on this machine): 304 passed, 3 failed. Those 3 also fail on main 63bcca4 here (two stride_tests, synthetic_tests::gathers_at_a_level_match_the_hardware).
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.

I have the full merge as a patch against abb811f (git apply-able, 62 files, almost all of it from main) if that helps. Re-merging and keeping both test entries gives the same result.

AI-assisted (Claude Code).

**@⁠pawrenity** on GitHub · 2026-11-25 23:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7178111229) In case it saves you a step on the rebase: I merged current `main` (`63bcca4`) into head `abb811f` locally. The only conflict is the end of `mod tests` in `crates/victory-shader/src/emit/lower.rs`, where `main` added `ds_bpermute_wave64_preserves_32_lane_half` and `ds_bpermute_refuses_gds` next to your `permlane16_lowers`. Keeping both sides resolves it. The PR side only needs its closing `}`: ```diff #[test] fn permlane16_lowers() { ... lowers(&words, 0).expect("v_permlanex16_b32 should lower"); -======= + } #[test] fn ds_bpermute_wave64_preserves_32_lane_half() { ``` Nothing else conflicts. Results on that merge, on Windows 11 with an NVIDIA GeForce RTX 4070 + WARP (`--test-threads=1`): - `cargo test -p victory-shader --lib --locked -- emit::permlane_tests emit::crosslane_tests emit::lower`: 44 passed, 0 failed. - RTX 4070 reports waves 32..32. `permlane_rows_and_inactive_sources` passes the full Wave32 matrix and skips Wave64. - The built-in WARP reports waves 4..4, so it skips the permlane GPU matrix. The other GPU checks in `crosslane_tests` run only on hardware, apart from the pipeline-creation test, which also ran on WARP. - With app-local **WARP 1.0.22** (`d3d10warp.dll` from the `Microsoft.Direct3D.WARP` NuGet package, next to the test binary; it reports waves 4..128), `permlane_rows_and_inactive_sources` fails at the same spot steven-seagull27 reported: `WARP wave64=false cross=true fi=false bc=false alias=false selectors=[f10e2d3c, 4b5a6978] mask=55555555 lane=4`, got `0x1234000e` (lane 14), expected `0x1234001e` (lane 30). The other 4 permlane tests, plus `crosslane_tests` and `emit::lower` (39 tests), pass with that DLL. I did not have the separate divergent FI=0 experiment, so I have no numbers for it. - Full lib suite (`--skip heap_direct_texture_reads_mark_their_heap_index`, which crashes the test process on `main` too on this machine): 304 passed, 3 failed. Those 3 also fail on `main` `63bcca4` here (two `stride_tests`, `synthetic_tests::gathers_at_a_level_match_the_hardware`). - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: clean. I have the full merge as a patch against `abb811f` (`git apply`-able, 62 files, almost all of it from `main`) if that helps. Re-merging and keeping both test entries gives the same result. AI-assisted (Claude Code).
Author
Owner

@⁠zed6000 on GitHub · 2026-11-26 00:11 UTC · original

The same merge on AMD, where the Wave64 half of the matrix can run. Head abb811f merged onto main 63bcca4, with the one lower.rs conflict resolved as above (keep both test entries, close permlane16_lowers). The diff against main is the PR's 3 files. Windows 11, AMD Radeon RX 7900 XTX (RDNA3), driver's built-in WARP:

  • permlane_rows_and_inactive_sources: the hardware reports waves 32..64, so both the Wave32 and the Wave64 matrices run, and every row and EXEC case passes ("all row and EXEC cases passed on hardware"). The built-in WARP reports 4..4 and skips, as on the 4070.
  • cargo test -p victory-shader --lib --locked -- emit::permlane_tests emit::crosslane_tests emit::lower --test-threads=1: 44 passed, 0 failed (DPP16 18/0, DPP8/DPP8FI 5/0, ds_swizzle 6/0 on hardware).
  • Full lib suite with no --skip: 308 passed, 0 failed (3 ignored, as on main). That includes heap_direct_texture_reads_mark_their_heap_index, every stride_tests test and synthetic_tests::gathers_at_a_level_match_the_hardware. So the crash and the 3 failures seen on the RTX 4070 machine do not show up on this AMD machine, either with this PR or on main (main 63bcca4 alone: 302/0 here).
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.

Earlier on this PR I measured abb811f on the title's shaders (on 13f91ca): +1, 0 lost. Between this and the 4070 run, the matrix now has hardware results for both wave sizes. The only failing case left is app-local WARP 1.0.22's Wave32 lane 14 vs 30, which points at WARP's handling of the case rather than at the lowering. A lowering that leans on behaviour D3D leaves undefined would look the same, though, so the FI=0 experiment is still worth having.

Offline tests only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-26 00:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7178486071) The same merge on AMD, where the Wave64 half of the matrix can run. Head `abb811f` merged onto `main` `63bcca4`, with the one `lower.rs` conflict resolved as above (keep both test entries, close `permlane16_lowers`). The diff against `main` is the PR's 3 files. Windows 11, **AMD Radeon RX 7900 XTX** (RDNA3), driver's built-in WARP: - `permlane_rows_and_inactive_sources`: the hardware reports **waves 32..64**, so both the Wave32 and the **Wave64** matrices run, and every row and EXEC case passes ("all row and EXEC cases passed on hardware"). The built-in WARP reports 4..4 and skips, as on the 4070. - `cargo test -p victory-shader --lib --locked -- emit::permlane_tests emit::crosslane_tests emit::lower --test-threads=1`: 44 passed, 0 failed (DPP16 18/0, DPP8/DPP8FI 5/0, ds_swizzle 6/0 on hardware). - Full lib suite with no `--skip`: **308 passed, 0 failed** (3 ignored, as on `main`). That includes `heap_direct_texture_reads_mark_their_heap_index`, every `stride_tests` test and `synthetic_tests::gathers_at_a_level_match_the_hardware`. So the crash and the 3 failures seen on the RTX 4070 machine do not show up on this AMD machine, either with this PR or on `main` (`main` `63bcca4` alone: 302/0 here). - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: clean. Earlier on this PR I measured `abb811f` on the title's shaders (on `13f91ca`): +1, 0 lost. Between this and the 4070 run, the matrix now has hardware results for both wave sizes. The only failing case left is app-local WARP 1.0.22's Wave32 lane 14 vs 30, which points at WARP's handling of the case rather than at the lowering. A lowering that leans on behaviour D3D leaves undefined would look the same, though, so the FI=0 experiment is still worth having. Offline tests only; no program names or data.
Author
Owner

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

@⁠pawrenity @⁠zed6000 Here is the missing divergent FI=0 readback, based directly on abb811f. It inserts s_cbranch_execz around the two-dword shuffle and reuses the PR's selectors, masks, alias cases and per-lane oracle. Each width runs 200 dispatches of 128 threads. Runnable test commit.

Adapter Wave32 wrong / 25,600 Wave64 wrong / 25,600
RTX 5080 0 Unsupported
Windows built-in WARP (4..4) Skipped Skipped
Microsoft.Warp 1.0.22, three fresh processes 780, 740, 780 740, 724, 728

With identity selectors, permlanex16, EXEC=0xffff0000 in both halves, FI=0 and BC=0, lane 16 selects inactive lane 0. Its old destination is 42. WARP returned lane 0's 0x12340000. The straight-line control still measured exactly 64/51,200 wrong at each WARP width in every process.

I also compiled the divergent case independently with DXC as cs_6_6. Inside the branch I routed each inactive source to the executing destination's own lane before WaveReadLaneAt. Selecting source activity directly from the input EXEC bits still gave 64/25,600 wrong on WARP at either wave width with both -O3 and -Od. Lane 4 requested active lane 30 and got lane 14. Selecting activity from WaveActiveBallot(true) inside the branch gave 780/25,600 on Wave32 and 728/25,600 on Wave64 at -O3. RTX returned 0/25,600 in all four supported DXC configurations. These controls reproduce both symptoms outside VIctory's emitter. A passing straight-line run alone doesn't cover divergent FI=0.

To run the new fixture against the PR head or your local merge:

git fetch https://github.com/steven-seagull27/VIctory.git codex/pr1737-divergent-fi0-readback
git cherry-pick a5c740754dcfaed72aa61bfaaf20aff8465bfdd4
cargo test -p victory-shader --lib permlane_fi_zero_under_divergent_exec -- --nocapture

The test prints a numerator, denominator and first failing lane for each supported width. An RX 7900 XTX readback on the merged head would give us the missing AMD comparison.

**@⁠steven-seagull27** on GitHub · 2026-11-26 01:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7179926345) @⁠pawrenity @⁠zed6000 Here is the missing **divergent FI=0 readback**, based directly on `abb811f`. It inserts `s_cbranch_execz` around the two-dword shuffle and reuses the PR's selectors, masks, alias cases and per-lane oracle. Each width runs 200 dispatches of 128 threads. [Runnable test commit](https://github.com/steven-seagull27/VIctory/commit/a5c740754dcfaed72aa61bfaaf20aff8465bfdd4). | Adapter | Wave32 wrong / 25,600 | Wave64 wrong / 25,600 | |---|---:|---:| | RTX 5080 | 0 | Unsupported | | Windows built-in WARP (4..4) | Skipped | Skipped | | Microsoft.Warp 1.0.22, three fresh processes | 780, 740, 780 | 740, 724, 728 | With identity selectors, `permlanex16`, `EXEC=0xffff0000` in both halves, FI=0 and BC=0, lane 16 selects inactive lane 0. Its old destination is 42. WARP returned lane 0's `0x12340000`. The straight-line control still measured exactly 64/51,200 wrong at each WARP width in every process. I also compiled the divergent case independently with DXC as `cs_6_6`. Inside the branch I routed each inactive source to the **executing destination's own lane** before `WaveReadLaneAt`. Selecting source activity directly from the input EXEC bits still gave 64/25,600 wrong on WARP at either wave width with both `-O3` and `-Od`. Lane 4 requested active lane 30 and got lane 14. Selecting activity from `WaveActiveBallot(true)` inside the branch gave 780/25,600 on Wave32 and 728/25,600 on Wave64 at `-O3`. RTX returned 0/25,600 in all four supported DXC configurations. These controls reproduce both symptoms outside VIctory's emitter. A passing straight-line run alone doesn't cover divergent FI=0. To run the new fixture against the PR head or your local merge: ```sh git fetch https://github.com/steven-seagull27/VIctory.git codex/pr1737-divergent-fi0-readback git cherry-pick a5c740754dcfaed72aa61bfaaf20aff8465bfdd4 cargo test -p victory-shader --lib permlane_fi_zero_under_divergent_exec -- --nocapture ``` The test prints a numerator, denominator and first failing lane for each supported width. An RX 7900 XTX readback on the merged head would give us the missing AMD comparison.
Author
Owner

@⁠zed6000 on GitHub · 2026-11-26 02:12 UTC · original

@⁠steven-seagull27 Here's the AMD comparison: your fixture a5c7407 (on abb811f, as committed) on an RX 7900 XTX (RDNA3), Windows 11, which reports waves 32..64. I ran three fresh processes:

Adapter Wave32 wrong / 25,600 Wave64 wrong / 25,600
RX 7900 XTX, run 1 0 0
RX 7900 XTX, run 2 0 0
RX 7900 XTX, run 3 0 0
Windows built-in WARP (4..4) Skipped Skipped

permlane_fi_zero_under_divergent_exec passes each time. All 6 emit::permlane_tests pass on the same build, including permlane_rows_and_inactive_sources in both wave sizes.

With your RTX 5080 numbers, that gives 0 wrong on NVIDIA hardware (Wave32) and on AMD hardware in both Wave32 and Wave64, for divergent FI=0. The only adapter that disagrees is Microsoft.Warp 1.0.22, which your DXC-only controls already reproduce outside VIctory's emitter. That fits WARP's handling of reads from inactive lanes under divergence, not the PR's lowering.

Offline tests only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-26 02:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7180568474) @⁠steven-seagull27 Here's the AMD comparison: your fixture `a5c7407` (on `abb811f`, as committed) on an **RX 7900 XTX** (RDNA3), Windows 11, which reports waves 32..64. I ran three fresh processes: | Adapter | Wave32 wrong / 25,600 | Wave64 wrong / 25,600 | |---|---:|---:| | RX 7900 XTX, run 1 | 0 | 0 | | RX 7900 XTX, run 2 | 0 | 0 | | RX 7900 XTX, run 3 | 0 | 0 | | Windows built-in WARP (4..4) | Skipped | Skipped | `permlane_fi_zero_under_divergent_exec` passes each time. All 6 `emit::permlane_tests` pass on the same build, including `permlane_rows_and_inactive_sources` in both wave sizes. With your RTX 5080 numbers, that gives 0 wrong on NVIDIA hardware (Wave32) and on AMD hardware in both Wave32 and **Wave64**, for divergent FI=0. The only adapter that disagrees is Microsoft.Warp 1.0.22, which your DXC-only controls already reproduce outside VIctory's emitter. That fits WARP's handling of reads from inactive lanes under divergence, not the PR's lowering. Offline tests only; no program names or data.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 03:38 UTC · original · edited 2026-11-26 03:45 UTC

@⁠jaschinski97-ops I put a fast-forwardable branch on my fork for current main (63bcca4). It retains your commits, the divergent FI=0 fixture, and both of the ds_bpermute regressions @⁠pawrenity and @⁠zed6000 identified at the merge conflict. Moving the permlane code into its own module also keeps lower.rs under the repository’s size limit.

I found a separate correctness issue affecting physical GPUs as well as WARP. Given a scalar that was set differently on either side of an EXEC split, a later scalar compare can select different host lanes. The old check treated that compare as wave-uniform and allowed a fetch-inactive cross-row shuffle to read a lane that had already left the host branch. With a 128-thread synthetic case and an EXEC mask of 1, all 128/128 outputs were wrong on both RTX 5080 and WARP 1.0.22. Lane 0 expected 0x12340010, got 0 on RTX and 0x12340000 on WARP. The all-lanes and no-lanes controls matched. Fix and regression

The new check refuses that shader and still translates a branch on a scalar expression computed entirely from uniform inputs. All nine focused tests passed on Windows. The RTX 5080 returned 0/51,200 mismatches in the straight-line Wave32 matrix and 0/25,600 in the divergent FI=0 matrix. Your original WARP permutation limitation still applies to this branch. @⁠zed6000’s RX 7900 XTX Wave32 and Wave64 results were on the earlier divergent fixture.

To take the branch from the PR head:

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr1737-current-main
git merge --ff-only FETCH_HEAD
cargo test --locked -p victory-shader --lib emit::permlane_tests:: -- --nocapture --test-threads=1

WARP follow-up. I also tested a separate integration of this branch with @⁠andrewpozdnakov7-jpg’s #2997. It reuses their four-lane bank reads and captures which lanes will enter the shuffle while all lanes can still vote. On both branch directions the guest keeps the old destination, or uses zero when bound control requests it, if the source took the other edge. Combined commit

Adapter Straight Skip the shuffle on empty EXEC Take the shuffle on nonempty EXEC
RTX 5080, Wave32 0/51,200 0/25,600 0/25,600
WARP 1.0.22, Wave32 0/51,200 0/25,600 0/25,600
WARP 1.0.22, Wave64 0/51,200 0/25,600 0/25,600

Counts are mismatches per run, with 128 threads per group. All three fresh WARP processes agreed, including the original lane 4 → lane 30 case. Inbox WARP reported only four lanes and skipped both widths. A direct merge of the two PRs still had 64 straight-line mismatches per width and hundreds in the skip case. Banked reads alone fixed the straight case. Moving the vote before the split fixed the eligible divergent case.

The software path explicitly declines partially populated waves and nested control flow where it cannot recover the incoming lane mask. Both have compile-time regressions. Across 192 native-path translations covering Wave32/Wave64, both DXIL and the complete binding records matched the direct merge byte for byte. All 18 focused Windows tests, strict shader Clippy and asset policy passed.

To try the combined branch, fetch refs/heads/codex/pr1737-warp-lane-selection from the same fork. Both original PR histories are included.

AI-assisted with Codex. Synthetic shaders and readbacks.

**@⁠steven-seagull27** on GitHub · 2026-11-26 03:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1737#issuecomment-7181899990) · edited 2026-11-26 03:45 UTC @⁠jaschinski97-ops I put a fast-forwardable branch on my fork for current `main` (`63bcca4`). It retains your commits, the divergent FI=0 fixture, and both of the `ds_bpermute` regressions @⁠pawrenity and @⁠zed6000 identified at the merge conflict. Moving the permlane code into its own module also keeps `lower.rs` under the repository’s size limit. I found a separate correctness issue affecting physical GPUs as well as WARP. Given a scalar that was set differently on either side of an EXEC split, a later scalar compare can select different host lanes. The old check treated that compare as wave-uniform and allowed a fetch-inactive cross-row shuffle to read a lane that had already left the host branch. With a 128-thread synthetic case and an EXEC mask of 1, all **128/128** outputs were wrong on both RTX 5080 and WARP 1.0.22. Lane 0 expected `0x12340010`, got `0` on RTX and `0x12340000` on WARP. The all-lanes and no-lanes controls matched. [Fix and regression](https://github.com/steven-seagull27/VIctory/commit/733f9e8584e2a35cbf0f1e066a2077ad3502f039) The new check refuses that shader and still translates a branch on a scalar expression computed entirely from uniform inputs. All nine focused tests passed on Windows. The RTX 5080 returned **0/51,200** mismatches in the straight-line Wave32 matrix and **0/25,600** in the divergent FI=0 matrix. Your original WARP permutation limitation still applies to this branch. @⁠zed6000’s [RX 7900 XTX Wave32 and Wave64 results](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1737) were on the earlier divergent fixture. To take the branch from the PR head: ```sh git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr1737-current-main git merge --ff-only FETCH_HEAD cargo test --locked -p victory-shader --lib emit::permlane_tests:: -- --nocapture --test-threads=1 ``` **WARP follow-up.** I also tested a separate integration of this branch with @⁠andrewpozdnakov7-jpg’s #2997. It reuses their four-lane bank reads and captures which lanes will enter the shuffle while all lanes can still vote. On both branch directions the guest keeps the old destination, or uses zero when bound control requests it, if the source took the other edge. [Combined commit](https://github.com/steven-seagull27/VIctory/commit/9c503731a15444c254d2d8e3feaaf99e3d4563b3) | Adapter | Straight | Skip the shuffle on empty EXEC | Take the shuffle on nonempty EXEC | |---|---:|---:|---:| | RTX 5080, Wave32 | 0/51,200 | 0/25,600 | 0/25,600 | | WARP 1.0.22, Wave32 | 0/51,200 | 0/25,600 | 0/25,600 | | WARP 1.0.22, Wave64 | 0/51,200 | 0/25,600 | 0/25,600 | Counts are mismatches per run, with 128 threads per group. All three fresh WARP processes agreed, including the original lane 4 → lane 30 case. Inbox WARP reported only four lanes and skipped both widths. A direct merge of the two PRs still had 64 straight-line mismatches per width and hundreds in the skip case. Banked reads alone fixed the straight case. Moving the vote before the split fixed the eligible divergent case. The software path explicitly declines partially populated waves and nested control flow where it cannot recover the incoming lane mask. Both have compile-time regressions. Across 192 native-path translations covering Wave32/Wave64, both DXIL and the complete binding records matched the direct merge byte for byte. All 18 focused Windows tests, strict shader Clippy and asset policy passed. To try the combined branch, fetch `refs/heads/codex/pr1737-warp-lane-selection` from the same fork. Both original PR histories are included. AI-assisted with Codex. Synthetic shaders and readbacks.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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