Shaders: compute reading lanes only within aligned groups declares no wave size #2117

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

@⁠rminzao on GitHub · 2026-11-25 05:19 UTC · original
rminzao:shaders-narrow-lane-groups-no-wave-size → main · +760 −17 · 17 files · 2 commits · open

Claimed in #1633 (claim).

Problem

A compute program that reads other lanes declares the console's exact wave size (lower.rs, the console_lanes decision; WaveSize(32) or WaveSize(64)). A host refuses a WaveSize outside its [WaveLaneCountMin, WaveLaneCountMax]:

host lanes refused today
NVIDIA 32-32 every lane-dependent wave64 program
Intel UHD (Xe-LP, #1829) 16-16 lane-dependent wave32 and wave64
WARP 4-4 lane-dependent wave32 and wave64

Many such reads never leave a small aligned group of lanes, though: DPP quad_perm stays in a quad, DPP8 in 8 lanes, DPP row controls in 16, ds_swizzle in quad mode in a quad and in bitmask mode in 2^(highest lane bit it changes + 1). Any host wave of at least G lanes, aligned on G, gives each group the same lanes, whatever the host's wave size.

Change

  • lane_group gives each instruction the aligned group it reads (table below). When the widest group G of a compute program is smaller than the console wave N, and nothing in it needs the whole wave, the program declares no WaveSize and Lowered/HostShader carry min_lanes = G.
  • Thread ids of such a program are relabelled with the host's wave size (waveGetLaneCount) instead of the constant N (narrow_thread_id, lane_thread), on the same assumption thread_id makes today: a host wave holds an aligned run of flat thread ids. DPP row_mask/bank_mask and constant lane bits take the console lane from the relabelled id (console_lane).
  • victory-gpu: Host::wave_lanes_min reads OPTIONS1 once (logged), and a compute pipeline whose shader has min_lanes above it is refused as "the host GPU's waves are narrower than the lane groups the shader reads". min_lanes is in the shader cache entry.
instruction G
DPP quad_perm, ds_swizzle quad mode 4
DPP8 8
DPP16 row_shl/shr/ror, row_mirror, row_half_mirror, row_share, row_xmask 16
ds_swizzle bitmask mode 1-32, from the bits the masks change
other DPP controls, permutes, v_mbcnt*, v_readlane/v_writelane, masks read as data N (whole wave)

Kept whole-wave (declaring WaveSize exactly as before): programs with s_barrier (a host wave whose lanes all skip it would hang the host, where the console's wave still arrives), any LDS use (the console compiler leaves out barriers within one wave, so an intra-wave LDS exchange would race across host waves), v_permlane*, a v_readfirstlane that isn't a waterfall read, opaque or constant lane-mask guards, one-wave groups with LDS, and whole-wave sections. A narrow attempt that fails to lower for any reason, or reads a lane mask as data, is lowered again whole-wave, so narrowing never makes a program fail that translates today.

Unchanged for every other program: the narrow path is separate (thread_id gets one early branch). Hashing lowered.dxil for every input the shader suite lowers, on main 940d32f and on this branch: all 484 that main lowers whole-wave or lane-free give byte-identical DXIL; only the new tests' narrow programs differ.

Tested

Intel UHD Graphics (driver 31.0.101.4146), RTX 4050 Laptop (595.97) and WARP, Windows 11. New module emit::lane_group_tests; each GPU test reads back 128 threads lane by lane against a CPU model of the console, with encodings checked against the decoder's text and DXIL validated.

test Intel UHD (16) RTX 4050 (32) WARP (4)
quad_reads_run_on_any_host_wave (wave32 + wave64: quad_perm with row/bank masks, quad swizzle) pass pass pass
row_reads_run_on_host_waves_of_16_lanes (row_shr:3 with masks, row_mirror, DPP8, swizzle xor) pass pass skipped (4 lanes)
half_reads_of_wave64_run_on_host_waves_of_32_lanes skipped (16 lanes) pass skipped
lane_groups_set_the_fewest_host_lanes, reads_of_the_whole_wave_keep_its_size (readlane, mbcnt, readfirstlane, s_barrier, a whole-wave section), lds_shared_within_the_wave_keeps_its_size pass (CPU)
pipeline::host::tests::shaders_reading_lane_groups_need_host_waves_that_hold_them pass (CPU)

The RTX 4050 ran through a local, uncommitted switch of the test host to the high-performance adapter. Breaking the console-lane computation, the section fallback or the barrier/LDS rules each makes a test fail.

  • cargo test -p victory-shader --lib on the Intel UHD: 244 passed, 9 failed; main: 238 passed, the same 9 failures (all covered by other open PRs, see #1829). cargo test -p victory-gpu --lib: 141 passed, 3 failed; main: 140 passed, the same 3.
  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings, with and without --all-features: clean. cargo check --workspace --all-targets: clean. rustfmt --check: no diffs in the new hunks; the new test file is clean. cargo xtask policy: ok.

Overlap: #1922's gate refuses wave64 compute without a declared wave size on hosts under 64 lanes; with this PR the narrow wave64 programs are such programs, so the two need reconciling (whichever lands second). #2035 (barrier sync on narrow waves) is orthogonal: programs with barriers don't narrow here.

Not run: the title, AMD hardware (a 32-64 lane host runs narrow programs at the driver's choice of size), and how many of the title's programs narrow. Programs with LDS or barriers, likely the bulk of lane-dependent compute, are deliberately left as they are.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠rminzao** on GitHub · 2026-11-25 05:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117) `rminzao:shaders-narrow-lane-groups-no-wave-size` → `main` · +760 −17 · 17 files · 2 commits · open Claimed in #1633 ([claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)). ## Problem A compute program that reads other lanes declares the console's exact wave size (`lower.rs`, the `console_lanes` decision; `WaveSize(32)` or `WaveSize(64)`). A host refuses a `WaveSize` outside its `[WaveLaneCountMin, WaveLaneCountMax]`: | host | lanes | refused today | |---|---|---| | NVIDIA | 32-32 | every lane-dependent wave64 program | | Intel UHD (Xe-LP, #1829) | 16-16 | lane-dependent wave32 and wave64 | | WARP | 4-4 | lane-dependent wave32 and wave64 | Many such reads never leave a small aligned group of lanes, though: DPP `quad_perm` stays in a quad, DPP8 in 8 lanes, DPP row controls in 16, `ds_swizzle` in quad mode in a quad and in bitmask mode in 2^(highest lane bit it changes + 1). Any host wave of at least G lanes, aligned on G, gives each group the same lanes, whatever the host's wave size. ## Change - `lane_group` gives each instruction the aligned group it reads (table below). When the widest group G of a compute program is smaller than the console wave N, and nothing in it needs the whole wave, the program declares no `WaveSize` and `Lowered`/`HostShader` carry `min_lanes = G`. - Thread ids of such a program are relabelled with the host's wave size (`waveGetLaneCount`) instead of the constant N (`narrow_thread_id`, `lane_thread`), on the same assumption `thread_id` makes today: a host wave holds an aligned run of flat thread ids. DPP `row_mask`/`bank_mask` and constant lane bits take the console lane from the relabelled id (`console_lane`). - `victory-gpu`: `Host::wave_lanes_min` reads `OPTIONS1` once (logged), and a compute pipeline whose shader has `min_lanes` above it is refused as "the host GPU's waves are narrower than the lane groups the shader reads". `min_lanes` is in the shader cache entry. | instruction | G | |---|---| | DPP `quad_perm`, `ds_swizzle` quad mode | 4 | | DPP8 | 8 | | DPP16 `row_shl/shr/ror`, `row_mirror`, `row_half_mirror`, `row_share`, `row_xmask` | 16 | | `ds_swizzle` bitmask mode | 1-32, from the bits the masks change | | other DPP controls, permutes, `v_mbcnt*`, `v_readlane`/`v_writelane`, masks read as data | N (whole wave) | Kept whole-wave (declaring `WaveSize` exactly as before): programs with `s_barrier` (a host wave whose lanes all skip it would hang the host, where the console's wave still arrives), any LDS use (the console compiler leaves out barriers within one wave, so an intra-wave LDS exchange would race across host waves), `v_permlane*`, a `v_readfirstlane` that isn't a waterfall read, opaque or constant lane-mask guards, one-wave groups with LDS, and whole-wave sections. A narrow attempt that fails to lower for any reason, or reads a lane mask as data, is lowered again whole-wave, so narrowing never makes a program fail that translates today. **Unchanged for every other program:** the narrow path is separate (`thread_id` gets one early branch). Hashing `lowered.dxil` for every input the shader suite lowers, on `main` 940d32f and on this branch: all 484 that `main` lowers whole-wave or lane-free give byte-identical DXIL; only the new tests' narrow programs differ. ## Tested Intel UHD Graphics (driver 31.0.101.4146), RTX 4050 Laptop (595.97) and WARP, Windows 11. New module `emit::lane_group_tests`; each GPU test reads back 128 threads lane by lane against a CPU model of the console, with encodings checked against the decoder's text and DXIL validated. | test | Intel UHD (16) | RTX 4050 (32) | WARP (4) | |---|---|---|---| | `quad_reads_run_on_any_host_wave` (wave32 + wave64: `quad_perm` with row/bank masks, quad swizzle) | pass | pass | pass | | `row_reads_run_on_host_waves_of_16_lanes` (`row_shr:3` with masks, `row_mirror`, DPP8, swizzle xor) | pass | pass | skipped (4 lanes) | | `half_reads_of_wave64_run_on_host_waves_of_32_lanes` | skipped (16 lanes) | pass | skipped | | `lane_groups_set_the_fewest_host_lanes`, `reads_of_the_whole_wave_keep_its_size` (readlane, mbcnt, readfirstlane, `s_barrier`, a whole-wave section), `lds_shared_within_the_wave_keeps_its_size` | pass (CPU) | | | | `pipeline::host::tests::shaders_reading_lane_groups_need_host_waves_that_hold_them` | pass (CPU) | | | The RTX 4050 ran through a local, uncommitted switch of the test host to the high-performance adapter. Breaking the console-lane computation, the section fallback or the barrier/LDS rules each makes a test fail. - `cargo test -p victory-shader --lib` on the Intel UHD: 244 passed, 9 failed; `main`: 238 passed, the same 9 failures (all covered by other open PRs, see #1829). `cargo test -p victory-gpu --lib`: 141 passed, 3 failed; `main`: 140 passed, the same 3. - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings`, with and without `--all-features`: clean. `cargo check --workspace --all-targets`: clean. `rustfmt --check`: no diffs in the new hunks; the new test file is clean. `cargo xtask policy`: ok. **Overlap:** #1922's gate refuses wave64 compute without a declared wave size on hosts under 64 lanes; with this PR the narrow wave64 programs are such programs, so the two need reconciling (whichever lands second). #2035 (barrier sync on narrow waves) is orthogonal: programs with barriers don't narrow here. Not run: the title, AMD hardware (a 32-64 lane host runs narrow programs at the driver's choice of size), and how many of the title's programs narrow. Programs with LDS or barriers, likely the bulk of lane-dependent compute, are deliberately left as they are. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A compute program reading other lanes declared the console's WaveSize(32)
or WaveSize(64), so hosts without that size refused it: NVIDIA every
wave64 one, a 16-lane Intel iGPU and WARP both sizes. When every
cross-lane read stays inside an aligned group of G lanes smaller than the
wave (DPP quad_perm, DPP8 and row controls, ds_swizzle in quad mode or
with a narrow bitmask), host waves of at least G lanes give each group the
same lanes: such a program declares no wave size, takes its thread ids by
the host's wave size, and carries min_lanes = G, which the runtime checks
against the host's WaveLaneCountMin before making the pipeline.

Programs that also use s_barrier, LDS, lane masks as data, v_mbcnt,
readlane/writelane, permutes, v_permlane* or whole-wave sections keep
WaveSize, and their DXIL is unchanged. A narrow attempt that fails to
lower is redone whole-wave.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`lane_thread` takes a host wave's ids as one run from its first, which
holds for 1-D groups but not 2-D ones: hosts tile those into waves (4x4
on Intel, 16x2 on NVIDIA), so ids repeated. 2-D and 3-D groups keep the
console's wave size. The lane-group code moves to `lower/lanes.rs`,
keeping `lower.rs` under the 512 KiB file limit, and the HostShader
initializers main added get `min_lanes`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:55:20 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 05:44 UTC · original

A remaining narrow-wave case on b3b5c93d73c73a54528993f370c6eba86fc9c648: DPP16 row_xmask:3 selects lane XOR 3, which stays within each four-lane group. The current classifier assigns it 16 lanes and excludes four-lane WARP. ISA modifier semantics

571b78a sizes this lane group from the mask in one commit on that exact head. The same synthetic dispatch test skipped WARP and failed before. After, the compiled shader ran on WARP for guest wave32 and wave64. All 128 readbacks for each mode matched the lane oracle, including old destination values in masked rows and banks.

Full forced-WARP shader suite: 250 passed, 4 failed, 3 ignored before. After: 251 passed, 3 failed, 3 ignored. The gather, lane-permute and edge-flagged triangle failures were shared. Strict shader Clippy and staged asset policy passed.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 05:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#issuecomment-7154098907) A remaining narrow-wave case on b3b5c93d73c73a54528993f370c6eba86fc9c648: DPP16 row_xmask:3 selects lane XOR 3, which stays within each four-lane group. The current classifier assigns it 16 lanes and excludes four-lane WARP. [ISA modifier semantics](https://llvm.org/docs/AMDGPUModifierSyntax.html#dpp16-ctrl) [571b78a](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/571b78ac841a0d50a86404a34e953d6b76b0d517) sizes this lane group from the mask in one commit on that exact head. The same synthetic dispatch test skipped WARP and failed before. After, the compiled shader ran on WARP for guest wave32 and wave64. All 128 readbacks for each mode matched the lane oracle, including old destination values in masked rows and banks. Full forced-WARP shader suite: 250 passed, 4 failed, 3 ignored before. After: 251 passed, 3 failed, 3 ignored. The gather, lane-permute and edge-flagged triangle failures were shared. Strict shader Clippy and staged asset policy passed.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 06:10 UTC · original

This and #2126 rewrite the same arithmetic, they conflict, and one may be a precondition of the other

Two pull requests in the same window are changing how a thread's lane is arranged for cross-lane reads, and they are not independent.

Measured: they conflict, in the one file where it matters:

#2126 + #2117  → conflict in crates/victory-shader/src/emit/lower.rs

#2126 (console_flat, "compute threads that read other lanes keep unique ids in 2-D groups") changes how a thread's console flat id is derived, using a group-shared ticket, because a host may put threads of several rows into one wave; #2117 changes whether a wave size is declared at all, adding min_lanes and a Stop::Wide re-lowering for programs that only read within aligned groups of 4, 8, 16 or 32.

The question that decides how they land is about your premise for narrow groups. The argument for "an aligned group of k lanes never straddles a host wave" needs the host to fill its waves from consecutive flat ids in group order. #2126's description says that is not what some hosts do: an RTX 5070 Ti fills 2-D groups in 16 × 2 tiles ("24, 32 or 64 wide or not a power of two wide"), and XCL's notes report 2 × 2 quads on an RX 9070. If threads of one aligned group land in different host waves, then a narrow-group read is not within one wave after all, and #2126's ticket is what makes the ids line up again.

So:

  • if that is right, #2126 is a precondition for #2117 on those hosts and the order is 2126 then 2117, with the conflict resolved in favour of the ticket;
  • if the aligned-group argument holds without the ticket — because the group is small enough that a tile never splits it, which may well be true for 4 and 8 while false for 16 and 32 — then say which sizes are safe on which tiling, because that is precisely the boundary the code has to get right, and #2117's own fallback (Stop::Wide) is where it goes wrong if it is.

I am not asking for both to be merged together; I am asking for the sentence that says which mechanism owns the 2-D case. At the moment two of them claim it and they disagree by construction.

A note on the evidence, since it decides what a reviewer can check: translate --validate will not show this. A declared or missing WaveSize is refused by the host when the pipeline is created, so the number that moves is the --pipelines count (or a boot), not the validated count. If either description has a before/after of that count on a host whose lane count differs from the console's, it would settle the review in one line; on this machine (NVIDIA, 32 lanes, 32.0.16.2124) I can measure it for whichever of the two lands first, and for the pair once they agree.

No game data is involved: file names, hosts and counts.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 06:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#issuecomment-7154526552) **This and #2126 rewrite the same arithmetic, they conflict, and one may be a precondition of the other** Two pull requests in the same window are changing how a thread's lane is arranged for cross-lane reads, and they are not independent. **Measured**: they conflict, in the one file where it matters: ``` #2126 + #2117 → conflict in crates/victory-shader/src/emit/lower.rs ``` #2126 (`console_flat`, "compute threads that read other lanes keep unique ids in 2-D groups") changes how a thread's console flat id is derived, using a group-shared ticket, because a host may put threads of several rows into one wave; #2117 changes *whether a wave size is declared at all*, adding `min_lanes` and a `Stop::Wide` re-lowering for programs that only read within aligned groups of 4, 8, 16 or 32. **The question that decides how they land** is about your premise for narrow groups. The argument for "an aligned group of `k` lanes never straddles a host wave" needs the host to fill its waves from consecutive flat ids in group order. #2126's description says that is **not** what some hosts do: an RTX 5070 Ti fills 2-D groups in 16 × 2 tiles ("24, 32 or 64 wide or not a power of two wide"), and XCL's notes report 2 × 2 quads on an RX 9070. If threads of one aligned group land in *different* host waves, then a narrow-group read is not within one wave after all, and #2126's ticket is what makes the ids line up again. So: - if that is right, **#2126 is a precondition for #2117 on those hosts** and the order is 2126 then 2117, with the conflict resolved in favour of the ticket; - if the aligned-group argument holds without the ticket — because the group is small enough that a tile never splits it, which may well be true for 4 and 8 while false for 16 and 32 — then say which sizes are safe on which tiling, because that is precisely the boundary the code has to get right, and #2117's own fallback (`Stop::Wide`) is where it goes wrong if it is. I am not asking for both to be merged together; I am asking for the sentence that says which mechanism owns the 2-D case. At the moment two of them claim it and they disagree by construction. **A note on the evidence**, since it decides what a reviewer can check: `translate --validate` will not show this. A declared or missing `WaveSize` is refused by the **host** when the pipeline is created, so the number that moves is the `--pipelines` count (or a boot), not the validated count. If either description has a before/after of that count on a host whose lane count differs from the console's, it would settle the review in one line; on this machine (NVIDIA, 32 lanes, `32.0.16.2124`) I can measure it for whichever of the two lands first, and for the pair once they agree. No game data is involved: file names, hosts and counts. Written with an AI assistant.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 10:44 UTC · original · edited 2026-11-26 02:17 UTC

Automated triage for the maintainers.

Merge candidate. 8f190cc takes the first option from the last triage: in Lower::new (crates/victory-shader/src/emit/lower.rs), min_lanes is set only for [n, 1, 1] groups, and only when nothing needs the whole wave (masks as data, one-wave LDS, s_barrier, v_permlane, v_readfirstlane_b32 outside waterfalls, any LDS, sections); everything else declares the console's wave size as on main. lane_group_tests::lane_groups_of_2d_thread_groups_keep_the_wave_size covers 2-D and 3-D shapes. A program that fails narrow is lowered again whole-wave (Stop::Wide), and that retry cannot loop since min_lanes is 0 then. On the host side, HostPipeline refuses a compute pipeline when wave_lanes_min() is below min_lanes (or unknown), and min_lanes is part of the shader cache encoding, so old entries fail to decode instead of being misread. The 1-D restriction rests on host layout probes (#2126 and the Intel UHD data in this thread), not console behaviour, which is the right kind of evidence here. CI check passes and it merges cleanly.

On your reply: this answers the 2-D blocker. One note for the maintainer: #2084 also adds to lower.rs, and the two together come to about 525,100 bytes, past the 512 KiB cargo xtask policy limit, so whichever merges second will need another small move out of lower.rs.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 10:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#issuecomment-7160116192) · edited 2026-11-26 02:17 UTC <!-- victory-triage v1 head=8f190ccea45855746c7182f8bd7c847b0c8af0fb verdict=merge-candidate at=2026-11-26T02:21:00Z --> Automated triage for the maintainers. **Merge candidate.** `8f190cc` takes the first option from the last triage: in `Lower::new` (`crates/victory-shader/src/emit/lower.rs`), `min_lanes` is set only for `[n, 1, 1]` groups, and only when nothing needs the whole wave (masks as data, one-wave LDS, `s_barrier`, `v_permlane`, `v_readfirstlane_b32` outside waterfalls, any LDS, sections); everything else declares the console's wave size as on `main`. `lane_group_tests::lane_groups_of_2d_thread_groups_keep_the_wave_size` covers 2-D and 3-D shapes. A program that fails narrow is lowered again whole-wave (`Stop::Wide`), and that retry cannot loop since `min_lanes` is 0 then. On the host side, `HostPipeline` refuses a compute pipeline when `wave_lanes_min()` is below `min_lanes` (or unknown), and `min_lanes` is part of the shader cache encoding, so old entries fail to decode instead of being misread. The 1-D restriction rests on host layout probes (#2126 and the Intel UHD data in this thread), not console behaviour, which is the right kind of evidence here. CI `check` passes and it merges cleanly. On your reply: this answers the 2-D blocker. One note for the maintainer: #2084 also adds to `lower.rs`, and the two together come to about 525,100 bytes, past the 512 KiB `cargo xtask policy` limit, so whichever merges second will need another small move out of `lower.rs`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 12:30 UTC · original

Data for the triage's 2-D question, from an Intel UHD (Xe-LP, 16-lane waves). This head's 6 new tests pass there (the wave64-half test skips), and they all use a 1-D group. #2126's wave-layout probe on the same iGPU, without WaveSize, shows 1-D groups in aligned 16-lane runs but most 2-D groups in 4×4 tiles ([8,8,1] first wave = ids 0-3, 8-11, 16-19, 24-27). The probe reports relabel bijective false for 13 of the 19 shapes that are not [n,1,1], so lane_thread would repeat ids there as well. Full list in item 5 of #1829

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.

**@⁠KainanP** on GitHub · 2026-11-25 12:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#issuecomment-7162473211) Data for the triage's 2-D question, from an Intel UHD (Xe-LP, 16-lane waves). This head's 6 new tests pass there (the wave64-half test skips), and they all use a 1-D group. #2126's wave-layout probe on the same iGPU, without `WaveSize`, shows 1-D groups in aligned 16-lane runs but most 2-D groups in **4×4 tiles** (`[8,8,1]` first wave = ids 0-3, 8-11, 16-19, 24-27). The probe reports `relabel bijective false` for 13 of the 19 shapes that are not `[n,1,1]`, so `lane_thread` would repeat ids there as well. Full list in item 5 of https://git.gtahub.st/github/Marvisak--VIctory/issues/1829 _AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this._
Author
Owner

@⁠rminzao on GitHub · 2026-11-26 01:43 UTC · original

Rebased onto main (63bcca4) and pushed 8f190cc, taking the first of the triage's two options: only 1-D groups are narrowed.

  • 1-D only: min_lanes is set only when the group is [n, 1, 1]. 2-D and 3-D groups with lane-group reads declare the console's wave size, as on main. @⁠KainanP's probe (aligned 16-lane runs for 1-D groups on the Intel UHD, 4×4 tiles for most 2-D ones) and #2126's NVIDIA layout both point this way. With #2126's ticket, narrowing 2-D groups could come back later.
  • 2-D test: lane_groups_of_2d_thread_groups_keep_the_wave_size lowers quad and row_shr reads in [8,16,1], [16,8,1], [32,2,2] and [64,1,2] groups, wave32 and wave64, and asserts min_lanes 0 and a declared wave size. It fails with the restriction removed.
  • File limit: with this PR on current main, lower.rs went past cargo xtask policy's 512 KiB limit. lane_group, narrow_thread_id, lane_thread and console_lane moved unchanged to emit/lower/lanes.rs. lower.rs is now 523,785 bytes.
  • row_xmask below 4: not changed here. As the triage notes it is safe, only less narrow. 571b78a can land on top.

cargo test -p victory-shader --lib on the Intel UHD: 298 passed, 11 failed, the same 11 as main. The 7 lane_group tests pass on WARP. victory-gpu: 229 passed, the 3 heap-cap and placed-view failures main has. Clippy (with and without --all-features) and cargo xtask policy are clean.

AI-assisted (Claude Code).

**@⁠rminzao** on GitHub · 2026-11-26 01:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#issuecomment-7180056949) Rebased onto `main` (63bcca4) and pushed `8f190cc`, taking the first of the triage's two options: only 1-D groups are narrowed. - **1-D only:** `min_lanes` is set only when the group is `[n, 1, 1]`. 2-D and 3-D groups with lane-group reads declare the console's wave size, as on `main`. @⁠KainanP's probe (aligned 16-lane runs for 1-D groups on the Intel UHD, 4×4 tiles for most 2-D ones) and #2126's NVIDIA layout both point this way. With #2126's ticket, narrowing 2-D groups could come back later. - **2-D test:** `lane_groups_of_2d_thread_groups_keep_the_wave_size` lowers quad and `row_shr` reads in `[8,16,1]`, `[16,8,1]`, `[32,2,2]` and `[64,1,2]` groups, wave32 and wave64, and asserts `min_lanes` 0 and a declared wave size. It fails with the restriction removed. - **File limit:** with this PR on current `main`, `lower.rs` went past `cargo xtask policy`'s 512 KiB limit. `lane_group`, `narrow_thread_id`, `lane_thread` and `console_lane` moved unchanged to `emit/lower/lanes.rs`. `lower.rs` is now 523,785 bytes. - **`row_xmask` below 4:** not changed here. As the triage notes it is safe, only less narrow. 571b78a can land on top. `cargo test -p victory-shader --lib` on the Intel UHD: 298 passed, 11 failed, the same 11 as `main`. The 7 `lane_group` tests pass on WARP. `victory-gpu`: 229 passed, the 3 heap-cap and placed-view failures `main` has. Clippy (with and without `--all-features`) and `cargo xtask policy` are clean. _AI-assisted (Claude Code)._
Author
Owner

@⁠reboot0000-cmd on GitHub · 2026-11-26 03:09 UTC · original

Correcting my own number from three hours ago, and the correction is total: on 8f190cc the rule now clears 0 of the 396.

Same archive (26,503 containers, 26,084 programs), same host (RTX 4090, WaveLaneCount 32..32), same validator (DXC 1.8.2502.8), SM 6.6 via #463's Agility exports. This time the candidate is the pull-request head commit itself as a worktree on 63bcca4, not a merged approximation, and the control is 63bcca4 with the same exports — so the two rows differ by exactly the 20 lines that changed.

tree, base 63bcca43 compute emitted compute validated compute pipelines made refused total pipelines
control (main) 2,658 1,910 2,262 396 25,273
+ #2117 8f190cc (1-D only) 2,658 1,910 2,262 396 25,273

Identical in every column: 0 cleared, 0 newly refused, 0 pipelines lost.

On the earlier head (b3b5c93, measured against 61bfc773 this afternoon) the same archive gained 17 pipelines and lost nothing — 16 mipmap-generation programs (im:CS_Texture2DMipmap2/3_*, im:CS_Texture2DArrayMipmap2/3_*) and cascadeshadows_processing:CS_ComputeMinMax. Those 17 offsets are refused again on 8f190cc, individually, not in aggregate.

Which answers the 2-D question with the only kind of evidence that settles it, from the title's side rather than the ISA's:

a program that cleared under the unrestricted rule and is refused again under 1-D-only gains nothing from the rule as it now stands. All 16 im:* mipmap programs are in that set. The clean reading is that their thread groups are not [n, 1, 1]; the alternative is that the move of lane_group into lower/lanes.rs changed when the clause fires. Either way the measured effect on this title is nil — and the practical point holds regardless of which it is: whatever the rule buys here, it lives outside 1-D groups, so it is exactly what the 1-D-only restriction gives back. @fiestorra's question about which mechanism owns the 2-D case is therefore not hypothetical for this archive; these 16 programs are the whole measured benefit.

Two notes so nobody chases a non-issue:

  • Your own lane_groups_of_2d_thread_groups_keep_the_wave_size passes on this machine, which is consistent with the flat table above — the behaviour and the archive agree.
  • quad_reads_run_on_any_host_wave fails here, and it is this host's OS, not the change: it prints no SM 6.6 hardware device; skipped / no SM 6.6 warp device; skipped first, then asserts on a device list that is empty because it has to be. On Windows 10 19044 an image without the Agility /EXPORT declarations is capped at shader model 6.5, and cargo test binaries do not carry them — only the victory executable does, via #463. Nothing to fix here; worth a line in the test so the next Windows 10 host doesn't read it as a regression.

If the 2-D case acquires a mechanism — #2126's per-wave base, or whatever owns it after the discussion above — I can re-run these two rows in about 35 minutes; the harness is built and both runs pass the same integrity checks (container and program counts, per-stage emitted = validated + refused arithmetic) before any number here gets posted.

Counts and program names from the title's own shader archive; nothing shipped.

**@⁠reboot0000-cmd** on GitHub · 2026-11-26 03:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#issuecomment-7181444461) Correcting my own number from three hours ago, and the correction is total: **on `8f190cc` the rule now clears 0 of the 396.** Same archive (26,503 containers, 26,084 programs), same host (RTX 4090, `WaveLaneCount` 32..32), same validator (DXC `1.8.2502.8`), SM 6.6 via #463's Agility exports. This time the candidate is the pull-request head commit itself as a worktree on `63bcca4`, not a merged approximation, and the control is `63bcca4` with the same exports — so the two rows differ by exactly the 20 lines that changed. | tree, base `63bcca43` | compute emitted | compute validated | compute pipelines made | refused | total pipelines | |---|---:|---:|---:|---:|---:| | control (`main`) | 2,658 | 1,910 | 2,262 | **396** | 25,273 | | + #2117 `8f190cc` (1-D only) | 2,658 | 1,910 | 2,262 | **396** | 25,273 | Identical in every column: **0 cleared, 0 newly refused, 0 pipelines lost.** On the earlier head (`b3b5c93`, measured against `61bfc773` this afternoon) the same archive gained 17 pipelines and lost nothing — 16 mipmap-generation programs (`im:CS_Texture2DMipmap2/3_*`, `im:CS_Texture2DArrayMipmap2/3_*`) and `cascadeshadows_processing:CS_ComputeMinMax`. Those 17 offsets are refused again on `8f190cc`, individually, not in aggregate. Which answers the 2-D question with the only kind of evidence that settles it, from the title's side rather than the ISA's: **a program that cleared under the unrestricted rule and is refused again under 1-D-only gains nothing from the rule as it now stands.** All 16 `im:*` mipmap programs are in that set. The clean reading is that their thread groups are not `[n, 1, 1]`; the alternative is that the move of `lane_group` into `lower/lanes.rs` changed when the clause fires. Either way the measured effect on this title is nil — and the practical point holds regardless of which it is: whatever the rule buys here, it lives outside 1-D groups, so it is exactly what the 1-D-only restriction gives back. `@fiestorra`'s question about which mechanism owns the 2-D case is therefore not hypothetical for this archive; these 16 programs are the whole measured benefit. Two notes so nobody chases a non-issue: - Your own `lane_groups_of_2d_thread_groups_keep_the_wave_size` passes on this machine, which is consistent with the flat table above — the behaviour and the archive agree. - `quad_reads_run_on_any_host_wave` fails here, and it is this host's OS, not the change: it prints `no SM 6.6 hardware device; skipped` / `no SM 6.6 warp device; skipped` first, then asserts on a device list that is empty because it has to be. On Windows 10 19044 an image without the Agility `/EXPORT` declarations is capped at shader model 6.5, and `cargo test` binaries do not carry them — only the `victory` executable does, via #463. Nothing to fix here; worth a line in the test so the next Windows 10 host doesn't read it as a regression. If the 2-D case acquires a mechanism — #2126's per-wave base, or whatever owns it after the discussion above — I can re-run these two rows in about 35 minutes; the harness is built and both runs pass the same integrity checks (container and program counts, per-stage emitted = validated + refused arithmetic) before any number here gets posted. Counts and program names from the title's own shader archive; nothing shipped.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 05:26 UTC · original · approved these changes

Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):

  • cargo test -p victory-shader --lib wave — 14 passed, 0 failed (including shaders_reading_lane_groups_need_host_waves_that_hold_them)
  • cargo clippy -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok (184 files ok)

Clean refinement omitting WaveSize when compute lane reads stay within aligned groups, improving Wave32/NVIDIA compatibility while guarding host minimum wave lanes. Looks great.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 05:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#pullrequestreview-6052280829) · **approved these changes** Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with `dxil.dll` validator): - `cargo test -p victory-shader --lib wave` — **14 passed, 0 failed** (including `shaders_reading_lane_groups_need_host_waves_that_hold_them`) - `cargo clippy -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok (`184 files ok`) Clean refinement omitting `WaveSize` when compute lane reads stay within aligned groups, improving Wave32/NVIDIA compatibility while guarding host minimum wave lanes. Looks great. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 06:33 UTC · original · approved these changes

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

144 passed / 0 failed / 2 ignored. Compute reading lanes only within aligned groups declares... — lane-group constraint declaration; mixed gpu+shader.

**@⁠catminou4** on GitHub · 2026-11-25 06:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#pullrequestreview-6052900024) · **approved these changes** Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 144 passed / 0 failed / 2 ignored. Compute reading lanes only within aligned groups declares... — lane-group constraint declaration; mixed gpu+shader.
Author
Owner

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

Reviewed 8f190ccea45855746c7182f8bd7c847b0c8af0fb and verified on Windows 11 with an NVIDIA GeForce RTX 5090 (Wave32-only, 32-32 lanes), WARP (4-4 lanes), D3D12 Debug Layer, and Windows SDK dxil.dll (10.0.26100.0).

Audit

  • Lane-group classification & fallback (crates/victory-shader/src/emit/lower/lanes.rs:14, :54, :73, :112; crates/victory-shader/src/emit/lower.rs:589, :645, :1351, :1384, :1448):
    • lane_group conservatively classifies DPP quad/DPP8/row controls and ds_swizzle_b32 (both quad mode and exact bitmask smallest power-of-two aligned group), while falling back to the full console wave for permutes, v_mbcnt*, v_readlane_b32/v_writelane_b32, unknown/wide DPP controls, and mask-as-data reads.
    • Keeping the declared console wave size for non-1D thread groups (cs.threads[1] != 1 || cs.threads[2] != 1), barriers, v_permlane*, non-waterfall v_readfirstlane_b32, LDS/one-wave shared memory, and whole-wave sections (Stop::Wide one-shot retry) safely avoids 2D tiled host wave layouts and lane-width races.
    • lane_thread / console_lane preserves console lane indices for lane_bit and DPP row_mask/bank_mask on narrower host waves.
  • Pipeline gate & cache (crates/victory-gpu/src/host.rs:1105, crates/victory-gpu/src/pipeline/host.rs:389, :444, crates/victory-gpu/src/shader_cache.rs:291, :353):
    • too_few_lanes cleanly rejects compute pipelines whenever host.wave_lanes_min() < shader.min_lanes (including unknown 0), and persisting min_lanes in shader_cache.rs automatically invalidates existing disk caches via include_bytes!("shader_cache.rs").
  • Non-blocking maintenance note: crates/victory-shader/src/emit/lower.rs is at 523,785 bytes (503 bytes below the 512 KiB xtask policy limit), so combining this with another PR touching lower.rs will likely need moving another helper out.

Verification

  • cargo run -p xtask -- policy (193 files ok)
  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings (default & --all-features)
  • cargo test -p victory-shader --lib -- --nocapture lane_group_tests:: with VICTORY_DXIL pointing to SDK dxil.dll: 7/7 passed — on Wave32-only RTX 5090 all three runtime suites ran and matched lane-by-lane across 128 threads (including console wave64 32-lane half_swizzle, 16-lane row/DPP8 ops, and 4-lane quads); on WARP (4-4), quad reads ran and 16/32-lane groups skipped cleanly.
  • victory-shader crosslane_tests:: + bvh_tests::: 19/19 passed on hardware; 26/26 passed (lane_group_tests:: + crosslane_tests:: + bvh_tests::) under VICTORY_WARP=1.
  • victory-gpu pipeline:: + shader_cache:: with VICTORY_D3D12_DEBUG=1: 28/28 passed on RTX 5090; 31/31 passed (--features diagnostics) on WARP.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 15:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2117#pullrequestreview-6076886334) · **approved these changes** Reviewed `8f190ccea45855746c7182f8bd7c847b0c8af0fb` and verified on Windows 11 with an NVIDIA GeForce RTX 5090 (Wave32-only, `32-32` lanes), WARP (`4-4` lanes), D3D12 Debug Layer, and Windows SDK `dxil.dll` (`10.0.26100.0`). ### Audit - **Lane-group classification & fallback** (`crates/victory-shader/src/emit/lower/lanes.rs:14`, `:54`, `:73`, `:112`; `crates/victory-shader/src/emit/lower.rs:589`, `:645`, `:1351`, `:1384`, `:1448`): - `lane_group` conservatively classifies DPP quad/DPP8/row controls and `ds_swizzle_b32` (both quad mode and exact bitmask smallest power-of-two aligned group), while falling back to the full console wave for permutes, `v_mbcnt*`, `v_readlane_b32`/`v_writelane_b32`, unknown/wide DPP controls, and mask-as-data reads. - Keeping the declared console wave size for non-1D thread groups (`cs.threads[1] != 1 || cs.threads[2] != 1`), barriers, `v_permlane*`, non-waterfall `v_readfirstlane_b32`, LDS/one-wave shared memory, and whole-wave sections (`Stop::Wide` one-shot retry) safely avoids 2D tiled host wave layouts and lane-width races. - `lane_thread` / `console_lane` preserves console lane indices for `lane_bit` and DPP `row_mask`/`bank_mask` on narrower host waves. - **Pipeline gate & cache** (`crates/victory-gpu/src/host.rs:1105`, `crates/victory-gpu/src/pipeline/host.rs:389`, `:444`, `crates/victory-gpu/src/shader_cache.rs:291`, `:353`): - `too_few_lanes` cleanly rejects compute pipelines whenever `host.wave_lanes_min() < shader.min_lanes` (including unknown `0`), and persisting `min_lanes` in `shader_cache.rs` automatically invalidates existing disk caches via `include_bytes!("shader_cache.rs")`. - **Non-blocking maintenance note**: `crates/victory-shader/src/emit/lower.rs` is at `523,785` bytes (`503` bytes below the 512 KiB `xtask policy` limit), so combining this with another PR touching `lower.rs` will likely need moving another helper out. ### Verification - `cargo run -p xtask -- policy` (`193 files ok`) - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings` (default & `--all-features`) - `cargo test -p victory-shader --lib -- --nocapture lane_group_tests::` with `VICTORY_DXIL` pointing to SDK `dxil.dll`: **7/7 passed** — on Wave32-only RTX 5090 all three runtime suites ran and matched lane-by-lane across 128 threads (including console wave64 32-lane `half_swizzle`, 16-lane row/DPP8 ops, and 4-lane quads); on WARP (`4-4`), quad reads ran and 16/32-lane groups skipped cleanly. - `victory-shader` `crosslane_tests::` + `bvh_tests::`: **19/19 passed** on hardware; **26/26 passed** (`lane_group_tests::` + `crosslane_tests::` + `bvh_tests::`) under `VICTORY_WARP=1`. - `victory-gpu` `pipeline::` + `shader_cache::` with `VICTORY_D3D12_DEBUG=1`: **28/28 passed** on RTX 5090; **31/31 passed** (`--features diagnostics`) on WARP.
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/2117/head:github-bot/gh-2117'
git switch 'github-bot/gh-2117'

Merge

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