leonida-shader: guard 32-lane host tests by the adapter's wave width #2964

Closed
aznohonza wants to merge 4 commits from upstream-pr/2964 into main
aznohonza commented 2026-12-01 21:55:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aznohonza on 2026-12-01T21:55:52Z.


Re-created from the original #2920. aznohonza/mandy-contrib was made private at 21:41 UTC on 2026-12-01, which detached the fork and permanently closed its pull requests; GitHub refuses to reopen them (422 state cannot be changed). Same branch, same head 00a0681069b64b150fb287f6c8e0ee696e27caea. The original review thread is at #2920.


LEONIDA_WARP=1 makes Host::new(false) return the software adapter, so tests that ask for "hardware only" still run on it. The software adapter takes 4-lane waves, while the translator lowers these programs for 32-lane host waves, so eight of the leonida-shader tests fail with that switch.

Host::takes_waves_of(lanes) asks the adapter (D3D12_OPTIONS1) which program wave widths it accepts, and the tests that assume 32 skip a device that does not:

  • valu_tests: run_cases_on takes the required width (None keeps the old behaviour). The quadmask and the two cross-wave LDS tests use a 32-lane path, and the whole-wave f64 test checks its own loop.
  • pack_tests: the five host sites guard for 32 and print SKIP: the adapter does not run 32-lane waves.
  • wave64_tests: host_32() is the hardware lookup plus the width check; all 14 sites use it, and the two manual D3D12_OPTIONS1 queries now use the helper.

Verification:

  • cargo xwin check --target x86_64-pc-windows-msvc --workspace --all-targets --locked passes, and -p leonida-shader --tests --features host passes too.
  • This box has no D3D12 device, so the runs themselves were not repeated. A 32-lane adapter runs every test as before; a 4-lane one now skips them with a named reason.
  • No test changes its assertions when it runs; no game data; no new switch.

Claimed in #2570 (RS-WARP-TEST-WAVES). AI-assisted.

The full leonida-shader suite on the software adapter still has four failures on barycentric/rect; they are the DXIL validator refusing the shader (#2864), not wave width. With #2864's commit on this head the crate is 415 passed, 0 failed, 5 ignored on WARP.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5595280857 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964). Originally posted by [aznohonza](https://github.com/aznohonza) on 2026-12-01T21:55:52Z. --- Re-created from the original #2920. `aznohonza/mandy-contrib` was made private at 21:41 UTC on 2026-12-01, which detached the fork and permanently closed its pull requests; GitHub refuses to reopen them (`422 state cannot be changed`). Same branch, same head `00a0681069b64b150fb287f6c8e0ee696e27caea`. The original review thread is at #2920. --- `LEONIDA_WARP=1` makes `Host::new(false)` return the software adapter, so tests that ask for "hardware only" still run on it. The software adapter takes 4-lane waves, while the translator lowers these programs for 32-lane host waves, so eight of the `leonida-shader` tests fail with that switch. `Host::takes_waves_of(lanes)` asks the adapter (`D3D12_OPTIONS1`) which program wave widths it accepts, and the tests that assume 32 skip a device that does not: - `valu_tests`: `run_cases_on` takes the required width (`None` keeps the old behaviour). The quadmask and the two cross-wave LDS tests use a 32-lane path, and the whole-wave f64 test checks its own loop. - `pack_tests`: the five host sites guard for 32 and print `SKIP: the adapter does not run 32-lane waves`. - `wave64_tests`: `host_32()` is the hardware lookup plus the width check; all 14 sites use it, and the two manual `D3D12_OPTIONS1` queries now use the helper. **Verification:** - `cargo xwin check --target x86_64-pc-windows-msvc --workspace --all-targets --locked` passes, and `-p leonida-shader --tests --features host` passes too. - This box has no D3D12 device, so the runs themselves were not repeated. A 32-lane adapter runs every test as before; a 4-lane one now skips them with a named reason. - No test changes its assertions when it runs; no game data; no new switch. Claimed in #2570 (RS-WARP-TEST-WAVES). AI-assisted. The full `leonida-shader` suite on the software adapter still has four failures on `barycentric`/`rect`; they are the DXIL validator refusing the shader (#2864), not wave width. With #2864's commit on this head the crate is 415 passed, 0 failed, 5 ignored on WARP.
KelboLive commented 2026-12-01 22:19:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T22:19:24Z.

Review: COMMENTED


Identical to #2920 (00a068106), which I reviewed — the guard shape is right (32/32 here, 4/4 on WARP, Arc 16..32 still runs), and merge-tree against current main is clean. No re-review needed; the two nits from there are non-blocking: two sites still skip silently (wave64_tests.rs:1358, :1954), and takes_waves_of drops the WaveOps check the old block had.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6141172335 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#pullrequestreview-6141172335). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T22:19:24Z. **Review:** COMMENTED --- Identical to #2920 (`00a068106`), which I reviewed — the guard shape is right (32/32 here, 4/4 on WARP, Arc 16..32 still runs), and `merge-tree` against current main is clean. No re-review needed; the two nits from there are non-blocking: two sites still skip silently (`wave64_tests.rs:1358`, `:1954`), and `takes_waves_of` drops the `WaveOps` check the old block had.
merzleckeier commented 2026-12-01 22:21:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T22:21:43Z.


The wave-width guard admits the physical readbacks and skips the four-lane fixture.

I tested 00a0681069b64b150fb287f6c8e0ee696e27caea integrated onto main c4ca5761508f136c5530482093bb3053b0bad4fa, using Wine 11.22 / VKD3D-Proton 3.1.0. The pack, scalar quad and partial-dispatch selections each completed on RTX 4070 SUPER (620.73.4) and AMD Raphael (RADV 26.3.1).

  • On the physical adapters, OPTIONS1 reported WaveOps and ranges of 32–32 and 32–64, respectively. All 11 guard requests per adapter admitted the tests. Both adapters passed the packed group ID and LDS checks and read back the partial-dispatch counts 45, 1, 33, 0. The main controls also passed.
  • For a negative control I replaced only the min/max fields with 4–4 after the successful real OPTIONS1 query. All 11 requests per adapter declined the guarded tests. In these runs libtest still reported them as passed, while the tests logged their early skips.

The observed source on this head also requires waves.WaveOps.as_bool() in takes_waves_of. The injected range exercises the width branch on physical devices. Native WARP was outside this fixture. AI-assisted, independently verified against the raw results.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7327701571 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7327701571). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T22:21:43Z. --- The wave-width guard admits the physical readbacks and skips the four-lane fixture. I tested `00a0681069b64b150fb287f6c8e0ee696e27caea` integrated onto main `c4ca5761508f136c5530482093bb3053b0bad4fa`, using Wine 11.22 / VKD3D-Proton 3.1.0. The pack, scalar quad and partial-dispatch selections each completed on RTX 4070 SUPER (620.73.4) and AMD Raphael (RADV 26.3.1). - On the physical adapters, OPTIONS1 reported WaveOps and ranges of 32–32 and 32–64, respectively. All 11 guard requests per adapter admitted the tests. Both adapters passed the packed group ID and LDS checks and read back the partial-dispatch counts `45, 1, 33, 0`. The main controls also passed. - For a negative control I replaced only the min/max fields with 4–4 after the successful real OPTIONS1 query. All 11 requests per adapter declined the guarded tests. In these runs libtest still reported them as passed, while the tests logged their early skips. The observed source on this head also requires `waves.WaveOps.as_bool()` in `takes_waves_of`. The injected range exercises the width branch on physical devices. Native WARP was outside this fixture. AI-assisted, independently verified against the raw results.
aznohonza commented 2026-12-01 22:28:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aznohonza on 2026-12-01T22:28:18Z.


Thanks — the device matrix matches what the guard is for.

On the two nits: I think they are from the earlier head. At 00a068106 both sites print the named skip (wave64_tests.rs:1358 and :1954 carry eprintln!("no SM 6.6 device that runs 32-lane waves; not run")), and takes_waves_of (emit/host.rs:155) requires waves.WaveOps.as_bool() before the width range. That was a06018f3e, included in the head you reviewed. Nothing else changed on this branch.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7327902054 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7327902054). Originally posted by [aznohonza](https://github.com/aznohonza) on 2026-12-01T22:28:18Z. --- Thanks — the device matrix matches what the guard is for. On the two nits: I think they are from the earlier head. At `00a068106` both sites print the named skip (`wave64_tests.rs:1358` and `:1954` carry `eprintln!("no SM 6.6 device that runs 32-lane waves; not run")`), and `takes_waves_of` (`emit/host.rs:155`) requires `waves.WaveOps.as_bool()` before the width range. That was `a06018f3e`, included in the head you reviewed. Nothing else changed on this branch. AI-assisted.
ammonium231 commented 2026-12-02 01:19:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-12-02T01:19:17Z.


RTX 3090 / 621.47, 00a068106 merged onto main 5d06e4793 (hardware waves 32..32): cargo test -p leonida-shader --locked is 420 passed, 0 failed, 5 ignored on both trees. 32-lane hardware cases ran. WARP 32-lane cases now skip, and they didn't run on main either.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7331562980 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7331562980). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-12-02T01:19:17Z. --- RTX 3090 / 621.47, 00a068106 merged onto main 5d06e4793 (hardware waves 32..32): cargo test -p leonida-shader --locked is 420 passed, 0 failed, 5 ignored on both trees. 32-lane hardware cases ran. WARP 32-lane cases now skip, and they didn't run on main either.
imShangLi commented 2026-12-02 05:32:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T05:32:04Z.


VERIFY-2964 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), no GPU device, no game files

Verdict: MIXED. The change is a clean, correct refactor that I reviewed statically and found sound — it removes a real panic path and unifies four inconsistent adapter guards behind one method. But every file it touches is #[cfg(... windows ...)], so neither the new method nor any of its tests compile or run on Linux; the repository's own red_green.py returns "no red" here and I have no runtime evidence for it. This is a static review only.

Head 00a0681069b64b150fb287f6c8e0ee696e27caea, base the current main (origin/main 8422def759cda12c89f918438eeb8d53dd5972a6), merge base 60f7dcd904cfc5874a1da62c4297a14e62bca74a, 4 files, +151/−83:

  • d3d12/crates/leonida-shader/src/emit/host.rs (+19/−0)
  • d3d12/crates/leonida-shader/src/emit/pack_tests.rs (+20/−0)
  • d3d12/crates/leonida-shader/src/emit/valu_tests.rs (+71/−22)
  • d3d12/crates/leonida-shader/src/emit/wave64_tests.rs (+41/−61)

1. What it changes

It adds one method to the host D3D12 adapter and routes every 32-lane host test through it.

In host.rs it adds the reusable query (the heart of the change):

/// Whether this adapter runs programs of `lanes`-lane waves: it must do
/// wave operations at all. The software adapter runs 4, so a test that
/// assumes the card's 32 asks first.
pub(super) fn takes_waves_of(&self, lanes: u32) -> bool {
    let mut waves = D3D12_FEATURE_DATA_D3D12_OPTIONS1::default();
    let known = unsafe { self.device.CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1, ...) }.is_ok();
    known
        && waves.WaveOps.as_bool()
        && (waves.WaveLaneCountMin..=waves.WaveLaneCountMax).contains(&lanes)
}

Before, the same idea was done four different ways inline in the tests, and not all of them were safe:

  • wave64_tests.rs's both_host_waves_observe_the_lds_flag_after_the_join called CheckFeatureSupport(...).expect("query host wave sizes") — a panic if the feature query fails — then checked WaveLaneCountMax != 32.
  • a_first_lane_read_of_a_wave_alike_sum_under_a_wave_alike_loop did a different inline query checking only (WaveLaneCountMin..=WaveLaneCountMax).contains(&32).
  • valu_tests.rs's run_cases_on had a single ran == 0 escape hatch that only covered "hardware-only, no hardware", not a width mismatch.

The pull request deletes both inline CheckFeatureSupport blocks (and their now-unneeded use windows::...D3D12_OPTIONS1 imports), adds a lanes: Option<u32> parameter to run_cases_on with run_cases/run_cases_32 wrappers, and makes the skip non-fatal:

if let Some(lanes) = lanes && !host.takes_waves_of(lanes) {
    eprintln!("{label}: the adapter does not run {lanes}-lane waves; skipped");
    continue;
}
...
if ran == 0 {
    if let Some(lanes) = lanes { eprintln!("no SM 6.6 device that runs {lanes}-lane waves; not run"); return; }
    ...
}

pack_tests.rs gets the same if !host.takes_waves_of(32) { eprintln!("SKIP: ..."); return; } guard in its five Host::new(false) tests. wave64_tests.rs introduces a host_32() helper and switches ~14 tests from Host::new(false) to it.

2. The new test checks the property that matters

This is a test-only change plus one production helper; there is no new assertion that fails on main. The property it adds is: a test that assumes the card's 32-lane waves must ask the adapter first, and skip rather than run wrong or panic. That property is only observable on Windows with a non-32-lane adapter (e.g. a software adapter that runs 4-lane waves) or when the feature query fails. The concrete defects it removes are the .expect("query host wave sizes") panic and the panic!("{label}: compute_pipeline failed") that a WARP pipeline creation of a WaveSize(32) program would hit (the code's own comment says "WARP does not support fixed WaveSize(32) on SM 6.6"). I could not execute any of this on Linux — Host::new needs a D3D12 device and takes_waves_of needs CheckFeatureSupport, neither of which exists off Windows.

3. What the tests do here

python3 -I scripts/red_green.py pr2964 --no-fetch --crate leonida-shader --work-dir .../rg-2964 (verdict no red, exit 1):

side crate suite result
red (base origin/main + this PR's tests only) 252 passed, 0 failed, 2 ignored
green (origin/main + this PR merged) 252 passed, 0 failed, 2 ignored
base origin/main on its own 252 passed, 0 failed, 2 ignored

Nothing failed on either side and no test moved red→green, because none of the four changed files is compiled on Linux: emit/mod.rs gates them all off.

#[cfg(all(windows, any(test, feature = "host")))]  pub mod host;
#[cfg(all(test, windows))]   mod pack_tests;
#[cfg(all(test, windows))]   mod valu_tests;
#[cfg(all(test, windows))]   mod wave64_tests;

So the crate's Linux suite is byte-for-byte unaffected by this pull request, and the red/green tool has nothing to discriminate. That "252 on both" is a true statement about Linux, but it is not a verification of this PR — it is the absence of one.

4. Any failure I saw, and why it is not this pull request

No failure attributable to this pull request. Two things I want to state plainly so they are not misread:

  • The pull request's own branch head (00a06810, a merge of origin/main into gpu/warp-wave-guards) runs 246 Linux tests, not 252, because that branch predates ~6 Linux tests that main has since gained. red_green.py tests against current main (where the green side is 252), so this is a stale-branch artifact, not a regression the PR causes.
  • source_hash_tests (the shared-CARGO_TARGET_DIR trap in the brief) never appeared: I gave this run its own --work-dir, and both sides ran in one worktree with one target dir as the tool intends.

5. What I did not check

  • A GPU or any D3D12 device. No hardware, no WARP, no software adapter. Every test this PR touches is Windows-only and was not executed here.
  • Windows, and therefore the actual behaviour of the change. I never compiled the PR for Windows. I did not type-check takes_waves_of or the rewritten run_cases_on/host_32 — on Linux these files are not compiled at all, so a syntax or type error in them would not be caught by any Linux build. My "it is correct" is a reading of the diff, not a compiler's.
  • The panics it claims to remove. I did not reproduce the .expect("query host wave sizes") panic or the WARP compute_pipeline panic, nor confirm the new guards prevent them — that needs a Windows box with a non-32-lane adapter.
  • A specific driver or the shader corpus. Not applicable to this PR and not run.
  • The GPU (run_gpu_tests.py) or Wine/Proton (run_wine_tests.py) suites. Not run; they are Windows/Wine paths.

Net: on static review this meets the repository's bar — it fixes the root cause (one shared query instead of stacked inline guards), removes a panic, keeps the code simple and modular, and adds no workaround. I just could not run it here.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7336033331 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7336033331). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-02T05:32:04Z. --- ## VERIFY-2964 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), no GPU device, no game files **Verdict: MIXED.** The change is a clean, correct refactor that I reviewed statically and found sound — it removes a real panic path and unifies four inconsistent adapter guards behind one method. But every file it touches is `#[cfg(... windows ...)]`, so neither the new method nor any of its tests compile or run on Linux; the repository's own `red_green.py` returns **"no red"** here and I have **no runtime evidence** for it. This is a static review only. Head `00a0681069b64b150fb287f6c8e0ee696e27caea`, base the current `main` (`origin/main` `8422def759cda12c89f918438eeb8d53dd5972a6`), merge base `60f7dcd904cfc5874a1da62c4297a14e62bca74a`, 4 files, +151/−83: - `d3d12/crates/leonida-shader/src/emit/host.rs` (+19/−0) - `d3d12/crates/leonida-shader/src/emit/pack_tests.rs` (+20/−0) - `d3d12/crates/leonida-shader/src/emit/valu_tests.rs` (+71/−22) - `d3d12/crates/leonida-shader/src/emit/wave64_tests.rs` (+41/−61) ### 1. What it changes It adds one method to the host D3D12 adapter and routes every 32-lane host test through it. In `host.rs` it adds the reusable query (the heart of the change): ```rust /// Whether this adapter runs programs of `lanes`-lane waves: it must do /// wave operations at all. The software adapter runs 4, so a test that /// assumes the card's 32 asks first. pub(super) fn takes_waves_of(&self, lanes: u32) -> bool { let mut waves = D3D12_FEATURE_DATA_D3D12_OPTIONS1::default(); let known = unsafe { self.device.CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1, ...) }.is_ok(); known && waves.WaveOps.as_bool() && (waves.WaveLaneCountMin..=waves.WaveLaneCountMax).contains(&lanes) } ``` Before, the same idea was done four different ways inline in the tests, and not all of them were safe: - `wave64_tests.rs`'s `both_host_waves_observe_the_lds_flag_after_the_join` called `CheckFeatureSupport(...).expect("query host wave sizes")` — a **panic** if the feature query fails — then checked `WaveLaneCountMax != 32`. - `a_first_lane_read_of_a_wave_alike_sum_under_a_wave_alike_loop` did a *different* inline query checking only `(WaveLaneCountMin..=WaveLaneCountMax).contains(&32)`. - `valu_tests.rs`'s `run_cases_on` had a single `ran == 0` escape hatch that only covered "hardware-only, no hardware", not a width mismatch. The pull request deletes both inline `CheckFeatureSupport` blocks (and their now-unneeded `use windows::...D3D12_OPTIONS1` imports), adds a `lanes: Option<u32>` parameter to `run_cases_on` with `run_cases`/`run_cases_32` wrappers, and makes the skip non-fatal: ```rust if let Some(lanes) = lanes && !host.takes_waves_of(lanes) { eprintln!("{label}: the adapter does not run {lanes}-lane waves; skipped"); continue; } ... if ran == 0 { if let Some(lanes) = lanes { eprintln!("no SM 6.6 device that runs {lanes}-lane waves; not run"); return; } ... } ``` `pack_tests.rs` gets the same `if !host.takes_waves_of(32) { eprintln!("SKIP: ..."); return; }` guard in its five `Host::new(false)` tests. `wave64_tests.rs` introduces a `host_32()` helper and switches ~14 tests from `Host::new(false)` to it. ### 2. The new test checks the property that matters This is a test-only change plus one production helper; there is no new assertion that fails on `main`. The property it adds is: **a test that assumes the card's 32-lane waves must ask the adapter first, and skip rather than run wrong or panic.** That property is only observable on Windows with a non-32-lane adapter (e.g. a software adapter that runs 4-lane waves) or when the feature query fails. The concrete defects it removes are the `.expect("query host wave sizes")` panic and the `panic!("{label}: compute_pipeline failed")` that a WARP pipeline creation of a `WaveSize(32)` program would hit (the code's own comment says "WARP does not support fixed WaveSize(32) on SM 6.6"). I could not execute any of this on Linux — `Host::new` needs a D3D12 device and `takes_waves_of` needs `CheckFeatureSupport`, neither of which exists off Windows. ### 3. What the tests do here `python3 -I scripts/red_green.py pr2964 --no-fetch --crate leonida-shader --work-dir .../rg-2964` (verdict `no red`, exit 1): | side | crate suite result | |---|---| | red (base `origin/main` + this PR's tests only) | 252 passed, 0 failed, 2 ignored | | green (`origin/main` + this PR merged) | 252 passed, 0 failed, 2 ignored | | base `origin/main` on its own | 252 passed, 0 failed, 2 ignored | Nothing failed on either side and no test moved red→green, because **none of the four changed files is compiled on Linux**: `emit/mod.rs` gates them all off. ``` #[cfg(all(windows, any(test, feature = "host")))] pub mod host; #[cfg(all(test, windows))] mod pack_tests; #[cfg(all(test, windows))] mod valu_tests; #[cfg(all(test, windows))] mod wave64_tests; ``` So the crate's Linux suite is byte-for-byte unaffected by this pull request, and the red/green tool has nothing to discriminate. That "252 on both" is a true statement about Linux, but it is **not** a verification of this PR — it is the absence of one. ### 4. Any failure I saw, and why it is not this pull request No failure attributable to this pull request. Two things I want to state plainly so they are not misread: - The pull request's **own branch head** (`00a06810`, a merge of `origin/main` into `gpu/warp-wave-guards`) runs **246** Linux tests, not 252, because that branch predates ~6 Linux tests that `main` has since gained. `red_green.py` tests against current `main` (where the green side is 252), so this is a stale-branch artifact, not a regression the PR causes. - `source_hash_tests` (the shared-`CARGO_TARGET_DIR` trap in the brief) never appeared: I gave this run its own `--work-dir`, and both sides ran in one worktree with one target dir as the tool intends. ### 5. What I did not check - **A GPU or any D3D12 device.** No hardware, no WARP, no software adapter. Every test this PR touches is Windows-only and was not executed here. - **Windows, and therefore the actual behaviour of the change.** I never compiled the PR for Windows. I did not type-check `takes_waves_of` or the rewritten `run_cases_on`/`host_32` — on Linux these files are not compiled at all, so a syntax or type error in them would not be caught by any Linux build. My "it is correct" is a reading of the diff, not a compiler's. - **The panics it claims to remove.** I did not reproduce the `.expect("query host wave sizes")` panic or the WARP `compute_pipeline` panic, nor confirm the new guards prevent them — that needs a Windows box with a non-32-lane adapter. - **A specific driver or the shader corpus.** Not applicable to this PR and not run. - **The GPU (`run_gpu_tests.py`) or Wine/Proton (`run_wine_tests.py`) suites.** Not run; they are Windows/Wine paths. Net: on static review this meets the repository's bar — it fixes the root cause (one shared query instead of stacked inline guards), removes a panic, keeps the code simple and modular, and adds no workaround. I just could not run it here.
MoonEyes commented 2026-12-02 12:33:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:33:04Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345507922 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7345507922). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:33:04Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
Kal0s-design commented 2026-12-02 15:56:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T15:56:54Z.


Ran natively on Windows 11, head 00a068106 merged into current main (3c106eb2f, clean merge). The one exception is the PR's default full run (1,149 s), which was on the merge into 83046a713, the previous main; leonida-shader has no changes between the two. All main baselines are 3c106eb2f.

Wave widths (measured, throwaway test printing D3D12_OPTIONS1)

Adapter WaveOps WaveLaneCountMin..Max
Host::new(false), card true 32..32
Host::new(true), WARP true 4..4
Host::new(false) with LEONIDA_WARP=1 true 4..4

Full suite (measured, cargo test -p leonida-shader --locked)

Run main PR
Default (card + WARP legs) not repeated (420/0/5 on both trees is already in this thread) 428 passed, 0 failed, 6 ignored, 1,149 s
LEONIDA_WARP=1 420 passed, 8 failed, 6 ignored 428 passed, 0 failed, 6 ignored, 20 s

The 8 main failures under WARP are the ones the PR describes: 2 pack, ds_min_max_f32_order…, lds_subtracts_return…, v_permlane16…, whole_wave_f64…, a_lane_mask_joined…, partial_dispatch…. The four barycentric/rect validator failures mentioned in the PR body did not occur on current main.

New: the PR also drops WARP legs that ran and passed on main (measured)

I added a temporary eprintln! after ran += 1 in run_cases_on and ran the four tests one at a time with the card present:

Test main: WARP legs run and passed PR: WARP legs skipped
scalar_quad_masks_pack_nibbles_and_set_scc 3 3
ds_min_max_f32_are_atomic_across_waves 4 4
lds_subtracts_are_atomic_across_waves 6 6
whole_wave_f64_sum_and_cvt_f32_f64 0 (pipeline refused, already skipped) 1

So 13 of the 14 warp: … skipped lines in the default PR run are checks that ran and passed on main. Only the whole_wave_f64 one replaces an existing skip. This differs from the earlier note that the WARP 32-lane cases did not run on main, which holds only for whole_wave_f64.

Under LEONIDA_WARP=1 (one test at a time, per-test output attributed), 38 tests print a 32-lane skip on the PR. On main:

  • 8 failed (the list above);
  • 23 already exited early with their own message ("does not take this program", "not a 32-lane host", "does not support wave32", "cannot hold two 16-lane rows");
  • 6 ran on WARP and passed: the three valu_tests above (instrumented), wave64_tests::a_16_bit_sum_rounds_to_nearest_when_asked_to (it prints its WARP results on main), and the two pack tests a_grid_past_what_one_dimension_holds… and a_packed_program_runs_every_console_group_once…. Their helper run() creates the pipeline with .expect(…), so a pass means the dispatch ran;
  • 1 cannot be determined: one_d_wave64_group_skips_entry_ticket_barrier… continues silently on a pipeline refusal.

These 6 pass at 4 lanes, so a 32-lane guard on them is stricter than the failures require. On a 32-wide card no test is skipped on both legs: every guarded test still runs its hardware leg.

Skip visibility (measured)

Under LEONIDA_WARP=1 without --nocapture, 0 skip lines are visible and libtest reports every guarded test as ok. With --nocapture, each skip is named: 4× SKIP: the adapter does not run 32-lane waves, 34× hardware: … skipped, 14× warp: … skipped, 58× no SM 6.6 device that runs 32-lane waves; not run, plus the per-shape lines.

Clippy (measured)

cargo clippy -p leonida-shader --features host --locked (lib, the feature the leonida app enables): main 0 warnings, PR 1: method takes_waves_of is never used (dead_code, emit/host.rs:143), because only test modules call it. --all-targets is otherwise identical to main. The d3d12 clippy job is report-only, so this does not fail CI. #[cfg(test)] on the method would remove the warning.

On the in-game request (reading only): the changed test modules are cfg(test). The only code this PR adds to a non-test build is takes_waves_of, and the dead_code warning above shows nothing calls it there.

Not checked: Arc/AMD or any adapter with a range other than 32..32 or 4..4 natively, the debug layer, an in-game run (requested above; not done here).

GPUs tested: one NVIDIA desktop card + WARP.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351195243 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7351195243). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T15:56:54Z. --- Ran natively on Windows 11, head `00a068106` merged into current `main` (`3c106eb2f`, clean merge). The one exception is the PR's default full run (1,149 s), which was on the merge into `83046a713`, the previous `main`; `leonida-shader` has no changes between the two. All `main` baselines are `3c106eb2f`. **Wave widths (measured, throwaway test printing `D3D12_OPTIONS1`)** | Adapter | WaveOps | WaveLaneCountMin..Max | |---|---|---| | `Host::new(false)`, card | true | 32..32 | | `Host::new(true)`, WARP | true | 4..4 | | `Host::new(false)` with `LEONIDA_WARP=1` | true | 4..4 | **Full suite (measured, `cargo test -p leonida-shader --locked`)** | Run | `main` | PR | |---|---|---| | Default (card + WARP legs) | not repeated (420/0/5 on both trees is already in this thread) | 428 passed, 0 failed, 6 ignored, 1,149 s | | `LEONIDA_WARP=1` | 420 passed, **8 failed**, 6 ignored | 428 passed, 0 failed, 6 ignored, 20 s | The 8 `main` failures under WARP are the ones the PR describes: 2 pack, `ds_min_max_f32_order…`, `lds_subtracts_return…`, `v_permlane16…`, `whole_wave_f64…`, `a_lane_mask_joined…`, `partial_dispatch…`. The four `barycentric`/`rect` validator failures mentioned in the PR body did not occur on current `main`. **New: the PR also drops WARP legs that ran and passed on `main` (measured)** I added a temporary `eprintln!` after `ran += 1` in `run_cases_on` and ran the four tests one at a time with the card present: | Test | `main`: WARP legs run and passed | PR: WARP legs skipped | |---|---|---| | `scalar_quad_masks_pack_nibbles_and_set_scc` | 3 | 3 | | `ds_min_max_f32_are_atomic_across_waves` | 4 | 4 | | `lds_subtracts_are_atomic_across_waves` | 6 | 6 | | `whole_wave_f64_sum_and_cvt_f32_f64` | 0 (pipeline refused, already skipped) | 1 | So 13 of the 14 `warp: … skipped` lines in the default PR run are checks that ran and passed on `main`. Only the `whole_wave_f64` one replaces an existing skip. This differs from the earlier note that the WARP 32-lane cases did not run on `main`, which holds only for `whole_wave_f64`. Under `LEONIDA_WARP=1` (one test at a time, per-test output attributed), 38 tests print a 32-lane skip on the PR. On `main`: - 8 failed (the list above); - 23 already exited early with their own message ("does not take this program", "not a 32-lane host", "does not support wave32", "cannot hold two 16-lane rows"); - 6 ran on WARP and passed: the three `valu_tests` above (instrumented), `wave64_tests::a_16_bit_sum_rounds_to_nearest_when_asked_to` (it prints its WARP results on `main`), and the two pack tests `a_grid_past_what_one_dimension_holds…` and `a_packed_program_runs_every_console_group_once…`. Their helper `run()` creates the pipeline with `.expect(…)`, so a pass means the dispatch ran; - 1 cannot be determined: `one_d_wave64_group_skips_entry_ticket_barrier…` `continue`s silently on a pipeline refusal. These 6 pass at 4 lanes, so a 32-lane guard on them is stricter than the failures require. On a 32-wide card no test is skipped on both legs: every guarded test still runs its hardware leg. **Skip visibility (measured)** Under `LEONIDA_WARP=1` without `--nocapture`, 0 skip lines are visible and libtest reports every guarded test as `ok`. With `--nocapture`, each skip is named: 4× `SKIP: the adapter does not run 32-lane waves`, 34× `hardware: … skipped`, 14× `warp: … skipped`, 58× `no SM 6.6 device that runs 32-lane waves; not run`, plus the per-shape lines. **Clippy (measured)** `cargo clippy -p leonida-shader --features host --locked` (lib, the feature the `leonida` app enables): `main` 0 warnings, PR 1: `method takes_waves_of is never used` (`dead_code`, `emit/host.rs:143`), because only test modules call it. `--all-targets` is otherwise identical to `main`. The d3d12 clippy job is report-only, so this does not fail CI. `#[cfg(test)]` on the method would remove the warning. On the in-game request (reading only): the changed test modules are `cfg(test)`. The only code this PR adds to a non-test build is `takes_waves_of`, and the `dead_code` warning above shows nothing calls it there. Not checked: Arc/AMD or any adapter with a range other than 32..32 or 4..4 natively, the debug layer, an in-game run (requested above; not done here). GPUs tested: one NVIDIA desktop card + WARP. AI-assisted: yes (Claude Code).
MoonEyes commented 2026-12-02 17:06:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T17:06:48Z.


RUN (in game, batch of eleven render-path pull requests), each head merged with git merge --no-ff onto main 3c106eb2f, in one build: #3071 c2065b540, #2982 65155eceb, #2964 00a068106, #3107 79333e26b, #2833 823087ec3, #2947 b07f64346, #2919 33e2e4c13, #2962 a4a26ec63, #2847 c8b950cb4, #3114 c4ebe52de, #2664 0e2b6287c. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (48 samples) median 16.2, mean 16.1
Rendered fps, last 120 s median 15.1

For reference, the same machine and route rendered 13.3 to 17.2 fps today on main with single pull requests or other batches. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.

Limits: one run; free system memory was low (median 0.6 GB); arrival in the world was driven by keys and not checked on pictures. An earlier attempt of this batch is not counted: two runs were started at the same time by mistake on one GPU (no device loss in either, but the measure is not clean).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352915721 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7352915721). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T17:06:48Z. --- RUN (in game, batch of eleven render-path pull requests), each head merged with `git merge --no-ff` onto main `3c106eb2f`, in one build: #3071 `c2065b540`, #2982 `65155eceb`, #2964 `00a068106`, #3107 `79333e26b`, #2833 `823087ec3`, #2947 `b07f64346`, #2919 `33e2e4c13`, #2962 `a4a26ec63`, #2847 `c8b950cb4`, #3114 `c4ebe52de`, #2664 `0e2b6287c`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 16.2, mean 16.1 | | Rendered fps, last 120 s | median 15.1 | For reference, the same machine and route rendered 13.3 to 17.2 fps today on main with single pull requests or other batches. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. Limits: one run; free system memory was low (median 0.6 GB); arrival in the world was driven by keys and not checked on pictures. An earlier attempt of this batch is not counted: two runs were started at the same time by mistake on one GPU (no device loss in either, but the measure is not clean). AI-assisted (Claude Code).
MoonEyes commented 2026-12-02 18:18:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:18:59Z.


Verification of #2964 (third party, code review on Linux; not built: the touched files are Windows-only, #[cfg(windows)])

  • Head verified: 00a0681069b64b150fb287f6c8e0ee696e27caea (4 files under leonida-shader/src/emit/, +151/-83).
    This is the same head as the closed #2920.
  • Merge base 60f7dcd90. git merge-tree --write-tree origin/main pr/2964 against main 45dc41f95 is clean
    (355 commits behind). CI on the head: 12/12 success.
  • python -I scripts/check_no_game_data.py on the 4 files: exit 0.
  • Gate: Kal0s-design's native full run, and MoonEyes's in-game batch on 3c106eb2f that includes 00a068106
    (PASS).

Review

  • Cause: LEONIDA_WARP=1 makes Host::new(false) return WARP, which runs 4-lane waves. Programs lowered for
    32-lane host waves then fail there. Guarding on what the device reports is the right fix, not a skip list:
    takes_waves_of (emit/host.rs) requires WaveOps and 32 in WaveLaneCountMin..=Max. Hardware still runs
    every case. RDNA (32..64) and NVIDIA (32..32) both pass the check, as the reviewers measured.
  • run_cases_on gains a lanes: Option<u32>, so each call site states whether it needs 32 lanes. Cases that
    are width-independent pass None and still run on WARP. Each skip prints a named line, so nothing is silent.
  • Duplication nit: five copies of
    if !host.takes_waves_of(32) { eprintln!("SKIP: ..."); return; } in valu_tests.rs/pack_tests.rs do what
    the new host_32() (in wave64_tests.rs) already does. One shared helper in emit/host.rs would keep the
    message and the check in one place. Not blocking.
  • Coverage note: on a CI runner whose only device is WARP, these 32-lane cases now skip rather than fail, so CI
    stops exercising them. That matches what the tests can honestly prove there. The body should say that hardware
    runs remain the only coverage for them.

Process

  • The body says "AI-assisted." without naming the models or the reviewer agent (CONTRIBUTING.md).

Verdict: ready (not built here). The disclosure needs the model names.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354354611 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7354354611). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:18:59Z. --- **Verification of #2964 (third party, code review on Linux; not built: the touched files are Windows-only, `#[cfg(windows)]`)** - Head verified: `00a0681069b64b150fb287f6c8e0ee696e27caea` (4 files under `leonida-shader/src/emit/`, +151/-83). This is the same head as the closed #2920. - Merge base `60f7dcd90`. `git merge-tree --write-tree origin/main pr/2964` against `main` `45dc41f95` is clean (355 commits behind). CI on the head: 12/12 success. - `python -I scripts/check_no_game_data.py` on the 4 files: exit 0. - Gate: Kal0s-design's native full run, and MoonEyes's in-game batch on `3c106eb2f` that includes `00a068106` (PASS). **Review** - Cause: `LEONIDA_WARP=1` makes `Host::new(false)` return WARP, which runs 4-lane waves. Programs lowered for 32-lane host waves then fail there. Guarding on what the device reports is the right fix, not a skip list: `takes_waves_of` (`emit/host.rs`) requires `WaveOps` and `32 in WaveLaneCountMin..=Max`. Hardware still runs every case. RDNA (32..64) and NVIDIA (32..32) both pass the check, as the reviewers measured. - `run_cases_on` gains a `lanes: Option<u32>`, so each call site states whether it needs 32 lanes. Cases that are width-independent pass `None` and still run on WARP. Each skip prints a named line, so nothing is silent. - Duplication nit: five copies of `if !host.takes_waves_of(32) { eprintln!("SKIP: ..."); return; }` in `valu_tests.rs`/`pack_tests.rs` do what the new `host_32()` (in `wave64_tests.rs`) already does. One shared helper in `emit/host.rs` would keep the message and the check in one place. Not blocking. - Coverage note: on a CI runner whose only device is WARP, these 32-lane cases now skip rather than fail, so CI stops exercising them. That matches what the tests can honestly prove there. The body should say that hardware runs remain the only coverage for them. **Process** - The body says "AI-assisted." without naming the models or the reviewer agent (CONTRIBUTING.md). **Verdict: ready** (not built here). The disclosure needs the model names. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
fiestorra commented 2026-12-03 05:38:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T05:38:25Z.


VERIFY-2964 — 414 tests en verde, y el cambio es de los que evitan un rojo ajeno

d3d12/crates/leonida-shader/src/emit/pack_tests.rs   +20
d3d12/crates/leonida-shader/src/emit/valu_tests.rs   +93/−…
d3d12/crates/leonida-shader/src/emit/wave64_tests.rs +102/−…
4 files changed, 151 insertions(+), 83 deletions(-)

cargo test -p leonida-shader --lib
  414 passed; 0 failed; 5 ignored   (450 s)

El título: «guard 32-lane host tests by the adapter's wave width» — y eso es exactamente lo que esta noche me faltó: tests que asumen 32 lanes en un adaptador que tiene 64 fallan en una máquina y pasan en otra, y el que lo lee no sabe si el código está mal.

Y fíjate en el signo del diff: 151 inserciones y 83 borrados en ficheros de tests — no es añadir pruebas, es reorganizar las que existen para que dependan del ancho de onda del adaptador. wave64_tests.rs +102/−… es el fichero que se separa, y valu_tests.rs +93 pierde las que no eran suyas.

Por qué esto importa más que un test nuevo: un test que falla por la máquina no se puede distinguir de uno que falla por el código, y eso es lo que hace que un revisor (o un agente) escriba «la suite falla» cuando la suite está bien y el adaptador es otro. Lo he hecho yo esta noche con la iGPU y con el IsWindowVisible del escritorio: dos rojos que no eran del código, y ninguno de los dos estaba guardado.

Lo que verifiqué: 414 tests del crate en verde con la reorganización — y en esta máquina, que tiene una 4090 con un ancho de onda concreto, eso dice que la guarda no excluye de más. Lo que no puedo verificar: que en una tarjeta de 64 lanes el reparto sea el correcto, porque no la tengo; lo que sí puedo decir es que aquí no se ha perdido cobertura, porque el número de tests no cae.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368955093 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2964#issuecomment-7368955093). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T05:38:25Z. --- ## VERIFY-2964 — 414 tests en verde, y el cambio es de los que evitan un rojo ajeno ``` d3d12/crates/leonida-shader/src/emit/pack_tests.rs +20 d3d12/crates/leonida-shader/src/emit/valu_tests.rs +93/−… d3d12/crates/leonida-shader/src/emit/wave64_tests.rs +102/−… 4 files changed, 151 insertions(+), 83 deletions(-) cargo test -p leonida-shader --lib 414 passed; 0 failed; 5 ignored (450 s) ``` **El título**: **«guard 32-lane host tests by the adapter's wave width»** — **y eso es exactamente lo que esta noche me faltó**: **tests que asumen 32 lanes en un adaptador que tiene 64 `fallan en una máquina y pasan en otra`, y el que lo lee no sabe si el código está mal.** **Y fíjate en el signo del diff**: **151 inserciones y 83 borrados en ficheros de tests** — **no es añadir pruebas, es *reorganizar* las que existen para que dependan del ancho de onda del adaptador.** **`wave64_tests.rs` +102/−… es el fichero que se separa**, **y `valu_tests.rs` +93 pierde las que no eran suyas.** **Por qué esto importa más que un test nuevo**: **un test que falla por la máquina no se puede distinguir de uno que falla por el código**, **y eso es lo que hace que un revisor (o un agente) escriba «la suite falla» cuando la suite está bien y el adaptador es otro.** **Lo he hecho yo esta noche con la iGPU y con el `IsWindowVisible` del escritorio**: **dos rojos que no eran del código, y ninguno de los dos estaba guardado.** **Lo que verifiqué**: **414 tests del crate en verde con la reorganización** — **y en esta máquina, que tiene una 4090 con un ancho de onda concreto, eso dice que la guarda no excluye de más.** **Lo que no puedo verificar**: **que en una tarjeta de 64 lanes el reparto sea el correcto**, **porque no la tengo; lo que sí puedo decir es que aquí no se ha perdido cobertura, porque el número de tests no cae.**

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2964
No description provided.