d3d12: opt-in RDNA target-barrier, list raw-twin, and wave-32 switches for #2771 / #2770 #2834

Open
zmasi wants to merge 20 commits from upstream-pr/2834 into main
zmasi commented 2026-12-01 05:01:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-01T05:01:14Z.


Summary

Refs #2771, #2770 (D3D12-RDNA-GBUFFER-TERRAIN-TILES).

Because #2771 (RX 7800 XT, RDNA 3) and #2770 (RX 9070 XT, RDNA 4) reproduce only on RDNA 3 / RDNA 4 hardware in outdoor scenes and our local test machine has an RTX 3090 + WARP with no retail game data, the root cause is not claimed as proven here. Instead of changing default runtime behaviour unmeasured, this PR lands the three concrete AMD-relevant gaps between Mandy and monte-alt/vesper (7b7e556, GPL-3.0) as opt-in switches — all off by default — with per-frame diagnostic counters and hardware/WARP unit tests so RDNA 3 / RDNA 4 testers can isolate the exact mechanism in a single A/B pass.

With all three switches unset (the default), command-list recording, thin-list streams, descriptor slots, and shader translation are unchanged from main.

Switches Added (All Off by Default)

  1. LEONIDA_TARGET_BARRIERS=<bits> (leonida-gpu/src/list/groups.rs, list.rs, list/thin.rs, draw.rs, host/place.rs; adapted after monte-alt/vesper 7b7e556 VESPER_SMART_BARRIERS, GPL-3.0):

    • Bit 1 (named texture moves): parses the console's ID3D12GraphicsCommandList7::Barrier texture barrier groups (list.rs previously ignored _groups and emitted one null-resource UAV barrier) and transitions named single-subresource host textures left for reading (RENDER_TARGET / DEPTH_WRITE / COPY_DEST -> shader-read / copy-source state) through HostList::ensure_state, caching the single-subresource check (GetDesc + CheckFeatureSupport) per HostTexture::serial so partial barriers do not query the driver repeatedly. Capped at 31 textures per call with a once-logged warning; when bit 2 is also enabled (=3), calls exceeding 31 textures fall back to a full target wait for the remainder.
    • Bit 2 (target waits): upgrades resource-less texture barriers, global barriers, and pipeline syncs to HostList::wait_for_everything (wait_for_all) when the host list has recorded a draw, clear, or resolve into a target since its last target wait.
    • Supports LEONIDA_THIN=1 record/replay round-trips while keeping the unset thin-list encoding identical to main (single word) and supports live toggling via LEONIDA_AB=4,LEONIDA_TARGET_BARRIERS.
  2. LEONIDA_LIST_TWIN_MOVE=1 (leonida-gpu/src/descriptor.rs, descriptor/host.rs, descriptor/host/listed_raw_tests.rs; after monte-alt/vesper 7b7e556, GPL-3.0):

    • Applies move_raw in place to non-16-byte-aligned raw buffer twins inside per-thread LIST_VIEWS slots (where main only moved the single staging slot and left per-list raw twins biased or null), and adds the moved-in-list count to the raw-twins frame diagnostic line. Supports live toggling via LEONIDA_AB=4,LEONIDA_LIST_TWIN_MOVE.
  3. LEONIDA_HOST_WAVE32=1 (leonida-shader/src/emit/mod.rs, emit/lower.rs; after monte-alt/vesper 7b7e556 VESPER_RDNA_WAVE32, GPL-3.0):

    • On RDNA hosts (32..64 wave lanes), tells the shader translator to target 32-lane waves (matching the wave-32 forms run on NVIDIA) and keys the shader cache on both the effective lane count and switch value.
    • Important behaviour note for A/B runs: Unlike Vesper's hybrid fallback, this diagnostic switch refuses wave64-only shaders with "no wave32 lowering for this wave64 program" (emit/mod.rs), so missing pipelines / skipped draws are expected on a LEONIDA_HOST_WAVE32=1 run. Do not read unrelated missing geometry or passes as #2771/#2770 getting worse — judge only whether the flickering black/grey ground tiles themselves disappear or change.
  4. d3d12/docs/switches.md: Regenerated via python -I tools/d3d12_switches.py --out d3d12/docs/switches.md.

A/B Isolation Plan for RDNA 3 / RDNA 4 (#2771, #2770)

From the same outdoor save spot through the launcher (diag profile):

# Fastest single-run live toggle check (switches bits 1+2 on/off every 4 seconds):
.\scripts\play-d3d12.ps1 -More @{ LEONIDA_AB = '4,LEONIDA_TARGET_BARRIERS' }

# Individual one-variable runs:
.\scripts\play-d3d12.ps1 -More @{ LEONIDA_TARGET_BARRIERS = '3' }   # then '1' and '2' if '3' fixes it
.\scripts\play-d3d12.ps1 -More @{ LEONIDA_LIST_TWIN_MOVE = '1' }    # or LEONIDA_AB = '4,LEONIDA_LIST_TWIN_MOVE'
.\scripts\play-d3d12.ps1 -More @{ LEONIDA_HOST_WAVE32 = '1' }       # first run retranslates; expect "no wave32 lowering for this wave64 program" refusals / missing pipelines (check ground tiles only)

Useful existing zero-code controls on the same spot if needed: LEONIDA_INDIRECT_BATCH='0'; LEONIDA_INDIRECT_WINDOW='0', LEONIDA_RAW_VIEWS='0', and LEONIDA_TWIN_BIAS='0'.

Key log lines to include from each run:

  • Startup settings line + host wave lanes
  • the title's waits for what was drawn into targets per frame ... (reports full target waits, skipped waits, named read textures, and in-list transitions)
  • raw twins of buffer views made per frame ...
  • LEONIDA_HOST_WAVE32=1: ... plus "no wave32 lowering for this wave64 program" / DROPPED / no host pipeline lines (on LEONIDA_HOST_WAVE32=1, wave64-only shader refusals and missing pipelines are expected)

Once a reporter confirms which switch resolves the outdoor ground tiles (and its frame-time delta), flipping that default is a one-line follow-up.

Verification & AI Disclosure

  • AI-assisted: Authored with Claude Fable 5.2 and Gemini 4 Carbon.
  • Separate reviewer agents: Independently reviewed prior to opening/updating the PR by GPT-6.2 Astra (5 structured review passes; final verdict go, risk 0/4), Claude Opus 5.5 (4 adversarial review passes), and Gemini 4 Neon (opus-systems-critic review on the follow-up cache/counter/test commit).
  • Hardware & test verification (no retail game data): Tested on Windows 11 (10.0.26200), NVIDIA GeForce RTX 3090 (24 GB, driver 610.88) and D3D12 WARP (LEONIDA_D3D12_WARP=1):
    • cargo test -p leonida-gpu --lib (default, --features diagnostics, and LEONIDA_D3D12_WARP=1): all passing, including 16 new hardware/WARP tests across list::groups (including cached one_subresource query count verification), list::thin, and descriptor::host::listed_raw_tests (including fresh-thread make_listed -> LIST_SLOTS -> own_slot verification on hardware and WARP).
    • cargo test -p leonida-shader --lib (default and --features diagnostics): 404 passed, 0 failed (including emit::tests::a_card_with_waves_of_32_to_64_is_taken_for_one_of_32_only_when_asked).
    • Red -> Green mutation verification across 5 fault-injection passes confirming the new tests fail when each mechanism is reverted.
    • cargo clippy --all-targets (0 warnings on added lines), python -I tools/d3d12_switches.py --check d3d12/docs/switches.md (rc=0), tests/test_docs_*.py (rc=0), python -I scripts/check_no_game_data.py (rc=0).
    • Not verified locally: RDNA 3 / RDNA 4 hardware reproduction (listed_twins_moved_readback remains #[ignore]d locally because heap.raw == 0 on RTX 3090 / WARP), and ID3D12Debug layer barrier validation (d3d12SDKLayers.dll / Windows Graphics Tools is not installed on this machine).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5579391071 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-01T05:01:14Z. --- ## Summary Refs #2771, #2770 (`D3D12-RDNA-GBUFFER-TERRAIN-TILES`). Because #2771 (RX 7800 XT, RDNA 3) and #2770 (RX 9070 XT, RDNA 4) reproduce only on RDNA 3 / RDNA 4 hardware in outdoor scenes and our local test machine has an RTX 3090 + WARP with no retail game data, the root cause is **not** claimed as proven here. Instead of changing default runtime behaviour unmeasured, this PR lands the three concrete AMD-relevant gaps between Mandy and `monte-alt/vesper` (`7b7e556`, GPL-3.0) as **opt-in switches — all off by default** — with per-frame diagnostic counters and hardware/WARP unit tests so RDNA 3 / RDNA 4 testers can isolate the exact mechanism in a single A/B pass. With all three switches unset (the default), command-list recording, thin-list streams, descriptor slots, and shader translation are unchanged from `main`. ## Switches Added (All Off by Default) 1. **`LEONIDA_TARGET_BARRIERS=<bits>`** (`leonida-gpu/src/list/groups.rs`, `list.rs`, `list/thin.rs`, `draw.rs`, `host/place.rs`; adapted after `monte-alt/vesper` `7b7e556` `VESPER_SMART_BARRIERS`, GPL-3.0): - **Bit `1` (named texture moves):** parses the console's `ID3D12GraphicsCommandList7::Barrier` texture barrier groups (`list.rs` previously ignored `_groups` and emitted one null-resource UAV barrier) and transitions named single-subresource host textures left for reading (`RENDER_TARGET` / `DEPTH_WRITE` / `COPY_DEST` -> shader-read / copy-source state) through `HostList::ensure_state`, caching the single-subresource check (`GetDesc` + `CheckFeatureSupport`) per `HostTexture::serial` so partial barriers do not query the driver repeatedly. Capped at 31 textures per call with a once-logged warning; when bit `2` is also enabled (`=3`), calls exceeding 31 textures fall back to a full target wait for the remainder. - **Bit `2` (target waits):** upgrades resource-less texture barriers, global barriers, and pipeline syncs to `HostList::wait_for_everything` (`wait_for_all`) when the host list has recorded a draw, clear, or resolve into a target since its last target wait. - Supports `LEONIDA_THIN=1` record/replay round-trips while keeping the unset thin-list encoding identical to `main` (single word) and supports live toggling via `LEONIDA_AB=4,LEONIDA_TARGET_BARRIERS`. 2. **`LEONIDA_LIST_TWIN_MOVE=1`** (`leonida-gpu/src/descriptor.rs`, `descriptor/host.rs`, `descriptor/host/listed_raw_tests.rs`; after `monte-alt/vesper` `7b7e556`, GPL-3.0): - Applies `move_raw` in place to non-16-byte-aligned raw buffer twins inside per-thread `LIST_VIEWS` slots (where `main` only moved the single staging slot and left per-list raw twins biased or null), and adds the moved-in-list count to the raw-twins frame diagnostic line. Supports live toggling via `LEONIDA_AB=4,LEONIDA_LIST_TWIN_MOVE`. 3. **`LEONIDA_HOST_WAVE32=1`** (`leonida-shader/src/emit/mod.rs`, `emit/lower.rs`; after `monte-alt/vesper` `7b7e556` `VESPER_RDNA_WAVE32`, GPL-3.0): - On RDNA hosts (`32..64` wave lanes), tells the shader translator to target 32-lane waves (matching the wave-32 forms run on NVIDIA) and keys the shader cache on both the effective lane count and switch value. - **Important behaviour note for A/B runs:** Unlike Vesper's hybrid fallback, this diagnostic switch **refuses** wave64-only shaders with `"no wave32 lowering for this wave64 program"` (`emit/mod.rs`), so missing pipelines / skipped draws are **expected** on a `LEONIDA_HOST_WAVE32=1` run. Do not read unrelated missing geometry or passes as #2771/#2770 getting worse — judge only whether the flickering black/grey ground tiles themselves disappear or change. 4. **`d3d12/docs/switches.md`:** Regenerated via `python -I tools/d3d12_switches.py --out d3d12/docs/switches.md`. ## A/B Isolation Plan for RDNA 3 / RDNA 4 (#2771, #2770) From the same outdoor save spot through the launcher (`diag` profile): ```powershell # Fastest single-run live toggle check (switches bits 1+2 on/off every 4 seconds): .\scripts\play-d3d12.ps1 -More @{ LEONIDA_AB = '4,LEONIDA_TARGET_BARRIERS' } # Individual one-variable runs: .\scripts\play-d3d12.ps1 -More @{ LEONIDA_TARGET_BARRIERS = '3' } # then '1' and '2' if '3' fixes it .\scripts\play-d3d12.ps1 -More @{ LEONIDA_LIST_TWIN_MOVE = '1' } # or LEONIDA_AB = '4,LEONIDA_LIST_TWIN_MOVE' .\scripts\play-d3d12.ps1 -More @{ LEONIDA_HOST_WAVE32 = '1' } # first run retranslates; expect "no wave32 lowering for this wave64 program" refusals / missing pipelines (check ground tiles only) ``` Useful existing zero-code controls on the same spot if needed: `LEONIDA_INDIRECT_BATCH='0'; LEONIDA_INDIRECT_WINDOW='0'`, `LEONIDA_RAW_VIEWS='0'`, and `LEONIDA_TWIN_BIAS='0'`. Key log lines to include from each run: - Startup settings line + `host wave lanes` - `the title's waits for what was drawn into targets per frame ...` (reports full target waits, skipped waits, named read textures, and in-list transitions) - `raw twins of buffer views made per frame ...` - `LEONIDA_HOST_WAVE32=1: ...` plus `"no wave32 lowering for this wave64 program"` / `DROPPED` / `no host pipeline` lines (on `LEONIDA_HOST_WAVE32=1`, wave64-only shader refusals and missing pipelines are expected) Once a reporter confirms which switch resolves the outdoor ground tiles (and its frame-time delta), flipping that default is a one-line follow-up. ## Verification & AI Disclosure - **AI-assisted:** Authored with **Claude Fable 5.2** and **Gemini 4 Carbon**. - **Separate reviewer agents:** Independently reviewed prior to opening/updating the PR by **GPT-6.2 Astra** (5 structured review passes; final verdict `go`, risk `0/4`), **Claude Opus 5.5** (4 adversarial review passes), and **Gemini 4 Neon** (`opus-systems-critic` review on the follow-up cache/counter/test commit). - **Hardware & test verification (no retail game data):** Tested on Windows 11 (`10.0.26200`), **NVIDIA GeForce RTX 3090 (24 GB, driver `610.88`)** and D3D12 WARP (`LEONIDA_D3D12_WARP=1`): - `cargo test -p leonida-gpu --lib` (default, `--features diagnostics`, and `LEONIDA_D3D12_WARP=1`): all passing, including 16 new hardware/WARP tests across `list::groups` (including cached `one_subresource` query count verification), `list::thin`, and `descriptor::host::listed_raw_tests` (including fresh-thread `make_listed` -> `LIST_SLOTS` -> `own_slot` verification on hardware and WARP). - `cargo test -p leonida-shader --lib` (default and `--features diagnostics`): `404` passed, `0` failed (including `emit::tests::a_card_with_waves_of_32_to_64_is_taken_for_one_of_32_only_when_asked`). - Red -> Green mutation verification across 5 fault-injection passes confirming the new tests fail when each mechanism is reverted. - `cargo clippy --all-targets` (`0` warnings on added lines), `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` (`rc=0`), `tests/test_docs_*.py` (`rc=0`), `python -I scripts/check_no_game_data.py` (`rc=0`). - *Not verified locally:* RDNA 3 / RDNA 4 hardware reproduction (`listed_twins_moved_readback` remains `#[ignore]`d locally because `heap.raw == 0` on RTX 3090 / WARP), and `ID3D12Debug` layer barrier validation (`d3d12SDKLayers.dll` / Windows Graphics Tools is not installed on this machine).
fiestorra commented 2026-12-01 05:26:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T05:26:10Z.


Verified on Windows with the three code commits and without the fourth, which is documentation and conflicts on its own. The workspace is green apart from the asset policy that main already fails.

main 10bed9ff2 (this branch's merge base), cargo 1.98.1:

one commit conflicts: a3df308fb  CONFLICT (content): d3d12/docs/switches.md
  (its subject: "switches.md lists LEONIDA_TARGET_BARRIERS, LEONIDA_LIST_TWIN_MOVE and ...")
so three of four applied: c2c6bc5ef, 4aac11147, 7fc86a592   -> tree 81e03b910

cargo test --workspace
  exit 101, 6.9 min
  one failure: policy::tests::repository_passes_policy      5 passed; 1 failed

That remaining failure is main failing its own asset policy on two source files over 640 KiB - not this diff; #2815 fixes it.

So the 1,567 lines of code across list/groups.rs (1,096 new), list.rs, list/thin.rs, host/place.rs, emit/mod.rs and emit/lower.rs compile and pass every test in the workspace. The 12 lines this does not cover are the docs/switches.md row for three new switches, and the conflict there is the switches table's usual one.

What I could not test: what the switches do. LEONIDA_TARGET_BARRIERS, LEONIDA_LIST_TWIN_MOVE and LEONIDA_HOST_WAVE32 need a title driving an RDNA card - this machine has a 4090, and the wave32 switch is for a card this is not. The suite passes; the behaviour those switches ask for is what its author measured and I cannot.

One thing worth saying about the shape: three switches and 1,096 new lines in one file is a lot to review, and the split this branch already has - one commit per switch plus the doc row - is the right one. If it is rebased, keep that split: the doc commit is what needs the rerere, and the code is what a reviewer should read.

AI-assisted: yes - DeepSeek v4.1 (flash), a 6.9-minute workspace run on the three-commit tree.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7301767663 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7301767663). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T05:26:10Z. --- **Verified on Windows with the three code commits and without the fourth, which is documentation and conflicts on its own. The workspace is green apart from the asset policy that `main` already fails.** **`main` `10bed9ff2` (this branch's merge base), `cargo 1.98.1`:** ``` one commit conflicts: a3df308fb CONFLICT (content): d3d12/docs/switches.md (its subject: "switches.md lists LEONIDA_TARGET_BARRIERS, LEONIDA_LIST_TWIN_MOVE and ...") so three of four applied: c2c6bc5ef, 4aac11147, 7fc86a592 -> tree 81e03b910 cargo test --workspace exit 101, 6.9 min one failure: policy::tests::repository_passes_policy 5 passed; 1 failed ``` **That remaining failure is `main` failing its own asset policy on two source files over 640 KiB - not this diff; #2815 fixes it.** **So the 1,567 lines of code across `list/groups.rs` (1,096 new), `list.rs`, `list/thin.rs`, `host/place.rs`, `emit/mod.rs` and `emit/lower.rs` compile and pass every test in the workspace.** **The 12 lines this does not cover are the `docs/switches.md` row for three new switches, and the conflict there is the switches table's usual one.** **What I could not test**: **what the switches do.** **`LEONIDA_TARGET_BARRIERS`, `LEONIDA_LIST_TWIN_MOVE` and `LEONIDA_HOST_WAVE32` need a title driving an RDNA card** - **this machine has a 4090, and the wave32 switch is for a card this is not.** **The suite passes; the behaviour those switches ask for is what its author measured and I cannot.** **One thing worth saying about the shape**: **three switches and 1,096 new lines in one file is a lot to review, and the split this branch already has - one commit per switch plus the doc row - is the right one.** **If it is rebased, keep that split: the doc commit is what needs the rerere, and the code is what a reviewer should read.** **AI-assisted:** yes - DeepSeek v4.1 (flash), a 6.9-minute workspace run on the three-commit tree. Written with an AI assistant.
KelboLive commented 2026-12-01 06:14:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T06:14:08Z.

Review: COMMENTED


The code is careful and the default path is genuinely the old one: words() returns the single count word when the bits are 0, own_slot keeps the staging-slot behaviour and leaves a listed twin biased, and host_max_wave() returns the real lanes when asked is false. The bit combinations, the thin-list round trip and the WARP paths are covered (13 list::groups, the enhanced-barrier and twin tests, all passing on this machine's GPU and on WARP), and the barrier moves/waits are per call — so an A/B phase boundary cannot leave a texture permanently in a wrong state; the worst case is a few calls from the previous phase at the boundary on thin lists, which are valid barriers. switches.md is current (--check rc 0), the shader and gpu crates are 405/0 and 607/0 here.

Three things before merge:

  1. The LEONIDA_HOST_WAVE32 experiment guidance is incomplete, and this is the one that will waste someone's run: the switch refuses wave64-only programs (emit/mod.rs:1104, "no wave32 lowering for this wave64 program"), but the A/B plan only says "any DROPPED / no host pipeline lines". Name that message and state that missing pipelines are expected on the =1 run — otherwise a tester reads a worse picture as #2771 getting worse and abandons the experiment.
  2. one_subresource queries the device per named partial barrier (list.rs:2828: GetDesc + CheckFeatureSupport) inside a switch whose frame-time delta is a reported result. Cache the answer per host texture, or state the overhead, so the A/B is not partly measuring a driver query.
  3. The real LIST_SLOTS path has no running test: LIST_SLOTS.set in make_listed is exercised only by the #[ignore]d listed_twins_moved_readback, while the unignored twin test fakes the slot range. A WARP test that makes a real list view would close it, or say in the body that the ignored test was run and passed.

Nits, both about the log rather than behaviour: the 31-texture fallback wait requires bit 2 (the groups.rs warning says so, the body implies more), and TARGET_WAITS[2] counts named textures rather than actual moves, so the "each moved … unless it was in it" line reports a count that is not the number of moves.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6126070598 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#pullrequestreview-6126070598). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T06:14:08Z. **Review:** COMMENTED --- The code is careful and the default path is genuinely the old one: `words()` returns the single count word when the bits are 0, `own_slot` keeps the staging-slot behaviour and leaves a listed twin biased, and `host_max_wave()` returns the real lanes when `asked` is false. The bit combinations, the thin-list round trip and the WARP paths are covered (13 `list::groups`, the enhanced-barrier and twin tests, all passing on this machine's GPU and on WARP), and the barrier moves/waits are per call — so an A/B phase boundary cannot leave a texture permanently in a wrong state; the worst case is a few calls from the previous phase at the boundary on thin lists, which are valid barriers. `switches.md` is current (`--check` rc 0), the shader and gpu crates are 405/0 and 607/0 here. Three things before merge: 1. **The `LEONIDA_HOST_WAVE32` experiment guidance is incomplete**, and this is the one that will waste someone's run: the switch *refuses* wave64-only programs (`emit/mod.rs:1104`, "no wave32 lowering for this wave64 program"), but the A/B plan only says "any DROPPED / no host pipeline lines". Name that message and state that missing pipelines are expected on the `=1` run — otherwise a tester reads a worse picture as #2771 getting worse and abandons the experiment. 2. **`one_subresource` queries the device per named partial barrier** (`list.rs:2828`: `GetDesc` + `CheckFeatureSupport`) inside a switch whose frame-time delta is a reported result. Cache the answer per host texture, or state the overhead, so the A/B is not partly measuring a driver query. 3. **The real `LIST_SLOTS` path has no running test**: `LIST_SLOTS.set` in `make_listed` is exercised only by the `#[ignore]`d `listed_twins_moved_readback`, while the unignored twin test fakes the slot range. A WARP test that makes a real list view would close it, or say in the body that the ignored test was run and passed. Nits, both about the log rather than behaviour: the 31-texture fallback wait requires bit 2 (the `groups.rs` warning says so, the body implies more), and `TARGET_WAITS[2]` counts named textures rather than actual moves, so the "each moved … unless it was in it" line reports a count that is not the number of moves.
zmasi commented 2026-12-01 06:31:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-01T06:31:39Z.


Thanks for the thorough review @KelboLive (and @fiestorra for the full-workspace run)! Pushed 6f7d5910c and updated the PR description to address all three items and both nits:

  1. LEONIDA_HOST_WAVE32=1 refusal guidance: Updated both the switch summary and A/B run notes in the PR description to name "no wave32 lowering for this wave64 program" (leonida-shader/src/emit/mod.rs) explicitly and state that refused wave64-only shaders / missing pipelines are expected on =1, so testers evaluate only whether the ground tiles themselves change rather than treating unrelated missing draws as a regression.
  2. one_subresource cached per host texture (list.rs): Added a lock-free 4,096-slot [AtomicU64; 4096] cache keyed by HostTexture::serial ((serial << 2) | (1 + one)) so GetDesc + CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO) runs at most once per HostTexture (absent rare hash eviction) instead of on every partial barrier, covered by a query-count assertion in list::groups::tests::a_barrier_on_a_part_of_a_texture_moves_it_only_if_that_is_all_of_it.
  3. Running make_listed -> LIST_SLOTS -> own_slot test (descriptor/host/listed_raw_tests.rs): Added un-ignored make_listed_populates_thread_list_slots_for_own_slot, which spawns a fresh worker thread (LIST_SLOTS == (0, 0)), calls heap.make_listed(...) on a real registered placed buffer view, verifies LIST_SLOTS matches LIST_VIEWS's [start, end) range, and checks own_slot across interior, boundary, and staging handles on both hardware (RTX 3090) and LEONIDA_D3D12_WARP=1.
  4. Log & counter nits (draw.rs + PR body): Clarified in the PR body that the >31-texture fallback wait applies when bit 2 is enabled (=3), and added TARGET_WAITS[3] (ensure_state_moved) so the frame log reports both {named} host textures named for reading and ({inline} transitioned in the list, the rest at submission or already in state).

AI-assisted: authored with Gemini 4 Carbon; independently reviewed with Gemini 4 Neon (opus-systems-critic). Tested on Windows 11, RTX 3090 (driver 610.88) + LEONIDA_D3D12_WARP=1.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7302975399 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7302975399). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-01T06:31:39Z. --- Thanks for the thorough review @KelboLive (and @fiestorra for the full-workspace run)! Pushed `6f7d5910c` and updated the PR description to address all three items and both nits: 1. **`LEONIDA_HOST_WAVE32=1` refusal guidance:** Updated both the switch summary and A/B run notes in the PR description to name `"no wave32 lowering for this wave64 program"` (`leonida-shader/src/emit/mod.rs`) explicitly and state that refused wave64-only shaders / missing pipelines are expected on `=1`, so testers evaluate only whether the ground tiles themselves change rather than treating unrelated missing draws as a regression. 2. **`one_subresource` cached per host texture (`list.rs`):** Added a lock-free 4,096-slot `[AtomicU64; 4096]` cache keyed by `HostTexture::serial` (`(serial << 2) | (1 + one)`) so `GetDesc` + `CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO)` runs at most once per `HostTexture` (absent rare hash eviction) instead of on every partial barrier, covered by a query-count assertion in `list::groups::tests::a_barrier_on_a_part_of_a_texture_moves_it_only_if_that_is_all_of_it`. 3. **Running `make_listed` -> `LIST_SLOTS` -> `own_slot` test (`descriptor/host/listed_raw_tests.rs`):** Added un-ignored `make_listed_populates_thread_list_slots_for_own_slot`, which spawns a fresh worker thread (`LIST_SLOTS == (0, 0)`), calls `heap.make_listed(...)` on a real registered placed buffer view, verifies `LIST_SLOTS` matches `LIST_VIEWS`'s `[start, end)` range, and checks `own_slot` across interior, boundary, and staging handles on both hardware (RTX 3090) and `LEONIDA_D3D12_WARP=1`. 4. **Log & counter nits (`draw.rs` + PR body):** Clarified in the PR body that the `>31`-texture fallback wait applies when bit `2` is enabled (`=3`), and added `TARGET_WAITS[3]` (`ensure_state_moved`) so the frame log reports both `{named} host textures named for reading` and `({inline} transitioned in the list, the rest at submission or already in state)`. AI-assisted: authored with Gemini 4 Carbon; independently reviewed with Gemini 4 Neon (`opus-systems-critic`). Tested on Windows 11, RTX 3090 (driver 610.88) + `LEONIDA_D3D12_WARP=1`.
merzleckeier commented 2026-12-01 15:24:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T15:24:18Z.


I ran two-vendor barrier and descriptor checks at 6e1b7eb3 against 88a9f133e. The Rust tree auto-merges. The only unresolved path is d3d12/docs/switches.md, so this is coverage of the merged Rust code. Win64 MSVC target, Wine 11.22 and VKD3D-Proton 3.1.0, Radeon Raphael RADV 26.3.1 and RTX 4070 SUPER 620.73.04.

Each GPU passed 18 tests across list::groups, the enhanced-barrier round trip and the listed descriptor tests. Each also passed the 26 paired-wave and twin-bias shader tests. The off-by-default wave-limit selector test passed separately. The two ignored raw-twin readbacks, when explicitly run, both stopped at the prerequisite that a raw-twin heap be available.

To exercise the readbacks, I made a local build with only the test heap sizes reduced (raw twin base 2^18 and dynamic minimum 2^15). All six listed-descriptor tests then passed on each GPU. The two readbacks returned the expected values with the switch both off and on. Both drivers retained a bias in the on arm because their descriptor layouts do not satisfy move_raw, so that part verifies fallback readback only. The test with synthetic descriptors separately covers an actual move. No RDNA3/RDNA4 terrain-repro claim. MEASURED with synthetic tests. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7315852064 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7315852064). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T15:24:18Z. --- I ran two-vendor barrier and descriptor checks at 6e1b7eb3 against 88a9f133e. The Rust tree auto-merges. The only unresolved path is d3d12/docs/switches.md, so this is coverage of the merged Rust code. Win64 MSVC target, Wine 11.22 and VKD3D-Proton 3.1.0, Radeon Raphael RADV 26.3.1 and RTX 4070 SUPER 620.73.04. Each GPU passed 18 tests across list::groups, the enhanced-barrier round trip and the listed descriptor tests. Each also passed the 26 paired-wave and twin-bias shader tests. The off-by-default wave-limit selector test passed separately. The two ignored raw-twin readbacks, when explicitly run, both stopped at the prerequisite that a raw-twin heap be available. To exercise the readbacks, I made a local build with only the test heap sizes reduced (raw twin base 2^18 and dynamic minimum 2^15). All six listed-descriptor tests then passed on each GPU. The two readbacks returned the expected values with the switch both off and on. Both drivers retained a bias in the on arm because their descriptor layouts do not satisfy move_raw, so that part verifies fallback readback only. The test with synthetic descriptors separately covers an actual move. No RDNA3/RDNA4 terrain-repro claim. MEASURED with synthetic tests. AI-assisted (Codex).
merzleckeier commented 2026-12-01 19:04:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T19:04:02Z.


Barrier and descriptor recheck after the main merge at f34bcd57 on 60f7dcd9, using Wine 11.22 / VKD3D-Proton 3.1.0. On RTX 4070 SUPER (620.73.4) and Radeon (RADV 26.3.1), the stock barrier, thin-list and listed-descriptor selection passed 22 tests per GPU with three ignored. The same selection on main passed six per GPU with two ignored. The separate Wave32 selector unit test passed.

Both optional GPU readbacks stopped at the raw-twin heap prerequisite with stock limits. With just the local heap constants reduced for the test hosts, both passed on each GPU. Listed-twin and public transfers returned expected data at the three source/target bias pairs (4/12, 8/8, 12/4). Both drivers retained the bias when relocation was requested. The moved case is covered here by the stock synthetic descriptor test.

MEASURED with synthetic buffers and shader fixtures. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7322106560 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7322106560). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T19:04:02Z. --- Barrier and descriptor recheck after the main merge at `f34bcd57` on `60f7dcd9`, using Wine 11.22 / VKD3D-Proton 3.1.0. On RTX 4070 SUPER (620.73.4) and Radeon (RADV 26.3.1), the stock barrier, thin-list and listed-descriptor selection passed 22 tests per GPU with three ignored. The same selection on main passed six per GPU with two ignored. The separate Wave32 selector unit test passed. Both optional GPU readbacks stopped at the raw-twin heap prerequisite with stock limits. With just the local heap constants reduced for the test hosts, both passed on each GPU. Listed-twin and public transfers returned expected data at the three source/target bias pairs (4/12, 8/8, 12/4). Both drivers retained the bias when relocation was requested. The moved case is covered here by the stock synthetic descriptor test. MEASURED with synthetic buffers and shader fixtures. AI-assisted (Codex).
Tauwni commented 2026-12-01 23:47:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-12-01T23:47:27Z.


Native Windows AMD complement: RDNA4 through AMD's own D3D12 driver. The runs above are RTX 4090, RTX 3090, WARP, RTX 4070 SUPER and RADV under Wine; none is the native D3D12 driver that #2770 / #2771 run on.

Radeon RX 9060 XT (RDNA4, 16 GB), driver 32.0.23033.1002, Windows 10 Pro 22H2 19045.7846, rustc 1.100.1. Head f34bcd57b merged (no commit) into main 913b88b90, merges cleanly.

cargo test (whole workspace), 2 runs each. MEASURED.

  • main alone: 755 passed, 1 failed, depth_bounds_pipeline_loads_and_filters_draws (Windows 10's in-box D3D12, #2855).
  • With this PR, switches unset: 774 passed, 1 failed, the same test. No new red.
  • With LEONIDA_TARGET_BARRIERS=7 LEONIDA_LIST_TWIN_MOVE=1 LEONIDA_HOST_WAVE32=1: 773 passed, 2 failed. The extra one is descriptor::host::listed_raw_tests::sub_dword_views_null_twins_and_recycled_raw_cbv_clears_bias.

That extra failure is the test, which does not pin the switch it checks. That test alone, one switch at a time, 3 runs each. MEASURED.

  • unset, LEONIDA_TARGET_BARRIERS=7, LEONIDA_HOST_WAVE32=1: pass 3/3.
  • LEONIDA_LIST_TWIN_MOVE=1: fails 3/3 at listed_raw_tests.rs:464, non-dword-aligned SRV twin (by=2) must be null, not reading misaligned pre-view bytes.
  • On WARP (--features diagnostics, LEONIDA_D3D12_WARP=1), the same head passes 3/3 with the switch at 1. ASSUMED: the test leaves early there, since this PR's description says heap.raw == 0 on WARP. So the red only shows where move_raw really moves the twin, which is the case on this AMD card.
  • READ IN CODE: the test checks the default, a list's off-dword twin left null. With the switch on, settle_twin (host.rs:5473) takes own_slot (host.rs:5461), then move_raw (host.rs:5501). By design move_raw also moves off-dword twins: "Off dwords too", host.rs:5502. The test does not pin the switch, unlike listed_readback, which sets it with TwinMove::set (listed_raw_tests.rs:61). So a tester on an AMD card who exports LEONIDA_LIST_TWIN_MOVE=1 for the #2770 A/B and then runs cargo test gets a red that says nothing about the card.
  • Fix, tested: Tauwni/leonida fix-2834-twin-test-pin, one commit on this head. It adds let _moved = TwinMove::set(false); at the top of that test. MEASURED on the RX 9060 XT, 3 runs each: passes with the switch at 0 and at 1. The whole leonida-gpu crate with the switch at 1: only depth_bounds fails, 2 runs.

The ignored hardware probes. On the RX 9060 XT, 3 runs each, MEASURED:

  • listed_twins_moved_readback -- --ignored: passes 3/3. The probe sets the switch on itself.
  • listed_off_alignment_raw_twin_readback -- --ignored: passes 3/3. This one sets it off.

Each prints "listed twins read right" (moved to their views: true for the first, false for the second), "public transfer correct, existing layout guard SRV=true UAV=true", for source bias 4 / target 12, 8 / 8 and 12 / 4.

So on RDNA4's native driver, list twins read correctly for dword-aligned biases, moved or not. Neither probe has an off-dword case (by = 2, 6, ...). That is the case the switch now moves too, and whether RDNA reads it right is not covered by these runs. It would be worth a case before reading the #2770 A/B. ASSUMED.

Part of these numbers was recomputed by a second agent on the same machine: the log counts, the line references, the pin fix, and the WARP run that corrected an earlier draft of this comment. AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7329775764 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7329775764). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-12-01T23:47:27Z. --- Native Windows AMD complement: RDNA4 through AMD's own D3D12 driver. The runs above are RTX 4090, RTX 3090, WARP, RTX 4070 SUPER and RADV under Wine; none is the native D3D12 driver that #2770 / #2771 run on. Radeon RX 9060 XT (RDNA4, 16 GB), driver 32.0.23033.1002, Windows 10 Pro 22H2 19045.7846, rustc 1.100.1. Head `f34bcd57b` merged (no commit) into `main` `913b88b90`, merges cleanly. **`cargo test` (whole workspace), 2 runs each.** MEASURED. - `main` alone: 755 passed, 1 failed, `depth_bounds_pipeline_loads_and_filters_draws` (Windows 10's in-box D3D12, #2855). - With this PR, switches unset: 774 passed, 1 failed, the same test. No new red. - With `LEONIDA_TARGET_BARRIERS=7 LEONIDA_LIST_TWIN_MOVE=1 LEONIDA_HOST_WAVE32=1`: 773 passed, 2 failed. The extra one is `descriptor::host::listed_raw_tests::sub_dword_views_null_twins_and_recycled_raw_cbv_clears_bias`. **That extra failure is the test, which does not pin the switch it checks.** That test alone, one switch at a time, 3 runs each. MEASURED. - unset, `LEONIDA_TARGET_BARRIERS=7`, `LEONIDA_HOST_WAVE32=1`: pass 3/3. - `LEONIDA_LIST_TWIN_MOVE=1`: fails 3/3 at `listed_raw_tests.rs:464`, `non-dword-aligned SRV twin (by=2) must be null, not reading misaligned pre-view bytes`. - On WARP (`--features diagnostics`, `LEONIDA_D3D12_WARP=1`), the same head passes 3/3 with the switch at 1. ASSUMED: the test leaves early there, since this PR's description says `heap.raw == 0` on WARP. So the red only shows where `move_raw` really moves the twin, which is the case on this AMD card. - READ IN CODE: the test checks the default, a list's off-dword twin left null. With the switch on, `settle_twin` (`host.rs:5473`) takes `own_slot` (`host.rs:5461`), then `move_raw` (`host.rs:5501`). By design `move_raw` also moves off-dword twins: "Off dwords too", `host.rs:5502`. The test does not pin the switch, unlike `listed_readback`, which sets it with `TwinMove::set` (`listed_raw_tests.rs:61`). So a tester on an AMD card who exports `LEONIDA_LIST_TWIN_MOVE=1` for the #2770 A/B and then runs `cargo test` gets a red that says nothing about the card. - Fix, tested: [Tauwni/leonida `fix-2834-twin-test-pin`](https://github.com/Tauwni/leonida/commit/d077b2261e354de353896bf4bfff66968bc78aa7), one commit on this head. It adds `let _moved = TwinMove::set(false);` at the top of that test. MEASURED on the RX 9060 XT, 3 runs each: passes with the switch at 0 and at 1. The whole `leonida-gpu` crate with the switch at 1: only `depth_bounds` fails, 2 runs. **The ignored hardware probes.** On the RX 9060 XT, 3 runs each, MEASURED: - `listed_twins_moved_readback -- --ignored`: passes 3/3. The probe sets the switch on itself. - `listed_off_alignment_raw_twin_readback -- --ignored`: passes 3/3. This one sets it off. Each prints "listed twins read right" (moved to their views: true for the first, false for the second), "public transfer correct, existing layout guard SRV=true UAV=true", for source bias 4 / target 12, 8 / 8 and 12 / 4. So on RDNA4's native driver, list twins read correctly for dword-aligned biases, moved or not. Neither probe has an off-dword case (by = 2, 6, ...). That is the case the switch now moves too, and whether RDNA reads it right is not covered by these runs. It would be worth a case before reading the #2770 A/B. ASSUMED. Part of these numbers was recomputed by a second agent on the same machine: the log counts, the line references, the pin fix, and the WARP run that corrected an earlier draft of this comment. AI-assisted: yes (Claude Code).
zmasi commented 2026-12-02 00:20:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-02T00:20:27Z.


Thanks for running both #[ignore]d hardware readback probes on a native Windows RDNA 4 RX 9060 XT @Tauwni — great to have direct confirmation that move_raw engages (moved to their views: true, SRV=true UAV=true) and passes 3/3 on RDNA 4! Folded let _moved = TwinMove::set(false); at the top of sub_dword_views_null_twins_and_recycled_raw_cbv_clears_bias in b20fd5bb6 (and synced switches.md onto main) so running cargo test with LEONIDA_LIST_TWIN_MOVE=1 exported in the environment stays clean on AMD cards.

AI-assisted: Gemini 4 Carbon.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7330430924 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7330430924). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-02T00:20:27Z. --- Thanks for running both `#[ignore]`d hardware readback probes on a native Windows RDNA 4 RX 9060 XT @Tauwni — great to have direct confirmation that `move_raw` engages (`moved to their views: true`, `SRV=true UAV=true`) and passes `3/3` on RDNA 4! Folded `let _moved = TwinMove::set(false);` at the top of `sub_dword_views_null_twins_and_recycled_raw_cbv_clears_bias` in `b20fd5bb6` (and synced `switches.md` onto `main`) so running `cargo test` with `LEONIDA_LIST_TWIN_MOVE=1` exported in the environment stays clean on AMD cards. AI-assisted: Gemini 4 Carbon.
MoonEyes commented 2026-12-02 12:28:26 +00:00 (Migrated from github.com)

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


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:7345393043 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7345393043). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:28:26Z. --- 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 17:01:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T17:01:49Z.


Ran natively on Windows 11, head 0386100f0 merged into current main (43fc605ed, merges cleanly), --features diagnostics, on an NVIDIA card and on WARP, with the D3D12 debug layer this time. The head has since moved to 01df1490c, a merge of main at 5b1fff821 with the PR's own diff unchanged. On that head I re-ran the gpu suite, the PR tests under the debug layer, and the all-switches suite (bottom of the tables). The earlier runs here had no debug layer on Windows (the PR body says it was not installed) or ran under Wine, so the barrier recording had not been through the native debug layer yet.

Suites on the merge. MEASURED.

Run Result
leonida-gpu --lib, card 793 passed, 0 failed, 60 ignored
leonida-gpu --lib, WARP 793 passed, 0 failed, 60 ignored
leonida-shader --lib 429 passed, 0 failed, 6 ignored
clippy --all-targets (gpu + shader) no warning on a line this PR adds
leonida-gpu --lib, card and WARP, new head 01df1490c 800 passed, 0 failed, 60 ignored

Debug layer, PR tests. list::groups, list::thin and descriptor::host::listed_raw_tests, with LEONIDA_D3D12_DEBUG=1. The groups tests' run() closes and executes what they record and asserts the debug layer logged nothing. I confirmed the layer was attached: a throwaway test that records a deliberately wrong barrier stops at once with the debug layer's ResourceBarrier error. MEASURED.

Run Card WARP
debug layer 22/22 pass 22/22 pass
debug layer + LEONIDA_D3D12_GBV=1 22/22 pass 22/22 pass
debug layer, new head 01df1490c 22/22 pass 22/22 pass

The barrier-move and target-wait paths (bits 1, 2 and 3, the thin round trip, clears and resolves) record nothing the debug layer rejects, on either device.

Whole gpu suite with all three switches set. LEONIDA_TARGET_BARRIERS=3 LEONIDA_LIST_TWIN_MOVE=1 LEONIDA_HOST_WAVE32=1 LEONIDA_D3D12_DEBUG=1. MEASURED.

Card WARP
leonida-gpu --lib 793 passed, 0 failed 793 passed, 0 failed
same, new head 01df1490c, 3 runs each 800 passed in 2 of 3 800 passed in 2 of 3

On the new head, one run on each device had a single red, and each was a different test: indirect::tests::host_list_window_executions_need_no_barrier_of_their_own on the card and timeline::report::tests::real_waits_are_recorded_with_who_ended_them on WARP. Both passed when rerun, and the indirect one passed 3/3 alone with each switch set on its own and with all three. I read them as load-sensitive tests on a busy machine, not as an effect of the switches.

On these two devices only the barrier switch really does anything. LEONIDA_HOST_WAVE32 needs an AMD card (told_lanes returns the real lanes otherwise). LEONIDA_LIST_TWIN_MOVE only acts where move_raw takes the descriptors, and dump_buffer_view_descriptor_bytes prints move_raw would take: SRV false UAV false on this card. The two ignored readbacks stop at "the host must allocate raw twins", as reported above. So this run is no evidence about those two switches on AMD.

Switches unset compared with main. MEASURED except where marked.

What How Result
Thin-list words for enhanced barriers throwaway test on the real env path (no TEST_BITS): words() for 0, 1, 2, 30, 31, 32, 33, 100 and 1000 barriers, null and named texture, count 0 and 1 all 36 shapes give [count], one word as on main
Recording through the list's methods throwaway test: named barrier, resource-less barrier, targets_written, pipeline sync, 4 rounds, card no full wait, one shader-write wait per call (12/12), colour and depth targets left as targets; debug layer clean
Listed raw twins throwaway test: own_slot for addresses inside this thread's LIST_SLOTS None, so settle_twin takes main's path
Translated shaders throwaway hash of every emit::emit result in the 39 leonida-shader tests that reach it, one thread, main against this merge 143 results (135 DXIL, 8 refusals), byte-identical in order. Many of these tests pin the lanes through TEST_HOST_WAVE, which returns before the changed line in host_max_wave, so the unpinned path is covered mainly by reading told_lanes

One thing that does change with the switches unset (READ IN CODE). clear_rtv, clear_dsv and resolve now always call with_state(this, |_, state| state.targets_written()). In a diagnostics build that is one more state lock, a tick() and one copystat "list call" for each clear and resolve, whatever the switch says. The recorded host commands are unchanged, but the "list calls per frame" figure of a diagnostics run moves a little against main. A groups::waits() check before it would keep the unset path as it was.

Switch values. READ IN CODE, and the PR's own the_switch_is_off_unless_it_is_a_number covers the first row.

Variable Turns on Notes
LEONIDA_TARGET_BARRIERS a u8 masked to its low two bits, trimmed 7 acts as 3, 4 and 256 as off; a log line says what the value was taken as
LEONIDA_LIST_TWIN_MOVE any value but 0 (switch::on) false or off turns it on; that is the crate's convention
LEONIDA_HOST_WAVE32 exactly 1 true, yes or 1 leave it off and print nothing, since the log line only comes when it is on

With LEONIDA_AB naming LEONIDA_TARGET_BARRIERS, the AB bit wins and alternates 3 and 0. A value such as LEONIDA_TARGET_BARRIERS=1 set alongside it is then ignored, with no log line. That matters for the A/B plan, which suggests trying 1 and 2 on their own after 3.

Overlap with #3136. git merge-tree of the two heads conflicts in leonida-gpu/src/list.rs. #3136 gives with_state an op-name argument, and this PR adds new two-argument with_state calls (targets_written, wait). Whichever lands second needs a rebase, and its new with_state calls need the op name.

Not checked: any AMD card, so the two AMD-only switches did nothing here; an in-game run (the collaborator's gate above still stands); the ignored raw-twin readbacks beyond their prerequisite; the frame-time cost of bit 2.

GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352797315 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7352797315). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T17:01:49Z. --- Ran natively on Windows 11, head `0386100f0` merged into current `main` (`43fc605ed`, merges cleanly), `--features diagnostics`, on an NVIDIA card and on WARP, with the D3D12 debug layer this time. The head has since moved to `01df1490c`, a merge of `main` at `5b1fff821` with the PR's own diff unchanged. On that head I re-ran the gpu suite, the PR tests under the debug layer, and the all-switches suite (bottom of the tables). The earlier runs here had no debug layer on Windows (the PR body says it was not installed) or ran under Wine, so the barrier recording had not been through the native debug layer yet. **Suites on the merge.** MEASURED. | Run | Result | |---|---| | `leonida-gpu --lib`, card | 793 passed, 0 failed, 60 ignored | | `leonida-gpu --lib`, WARP | 793 passed, 0 failed, 60 ignored | | `leonida-shader --lib` | 429 passed, 0 failed, 6 ignored | | `clippy --all-targets` (gpu + shader) | no warning on a line this PR adds | | `leonida-gpu --lib`, card and WARP, new head `01df1490c` | 800 passed, 0 failed, 60 ignored | **Debug layer, PR tests.** `list::groups`, `list::thin` and `descriptor::host::listed_raw_tests`, with `LEONIDA_D3D12_DEBUG=1`. The groups tests' `run()` closes and executes what they record and asserts the debug layer logged nothing. I confirmed the layer was attached: a throwaway test that records a deliberately wrong barrier stops at once with the debug layer's `ResourceBarrier` error. MEASURED. | Run | Card | WARP | |---|---|---| | debug layer | 22/22 pass | 22/22 pass | | debug layer + `LEONIDA_D3D12_GBV=1` | 22/22 pass | 22/22 pass | | debug layer, new head `01df1490c` | 22/22 pass | 22/22 pass | The barrier-move and target-wait paths (bits 1, 2 and 3, the thin round trip, clears and resolves) record nothing the debug layer rejects, on either device. **Whole gpu suite with all three switches set.** `LEONIDA_TARGET_BARRIERS=3 LEONIDA_LIST_TWIN_MOVE=1 LEONIDA_HOST_WAVE32=1 LEONIDA_D3D12_DEBUG=1`. MEASURED. | | Card | WARP | |---|---|---| | `leonida-gpu --lib` | 793 passed, 0 failed | 793 passed, 0 failed | | same, new head `01df1490c`, 3 runs each | 800 passed in 2 of 3 | 800 passed in 2 of 3 | On the new head, one run on each device had a single red, and each was a different test: `indirect::tests::host_list_window_executions_need_no_barrier_of_their_own` on the card and `timeline::report::tests::real_waits_are_recorded_with_who_ended_them` on WARP. Both passed when rerun, and the indirect one passed 3/3 alone with each switch set on its own and with all three. I read them as load-sensitive tests on a busy machine, not as an effect of the switches. On these two devices only the barrier switch really does anything. `LEONIDA_HOST_WAVE32` needs an AMD card (`told_lanes` returns the real lanes otherwise). `LEONIDA_LIST_TWIN_MOVE` only acts where `move_raw` takes the descriptors, and `dump_buffer_view_descriptor_bytes` prints `move_raw would take: SRV false UAV false` on this card. The two ignored readbacks stop at "the host must allocate raw twins", as reported above. So this run is no evidence about those two switches on AMD. **Switches unset compared with `main`.** MEASURED except where marked. | What | How | Result | |---|---|---| | Thin-list words for enhanced barriers | throwaway test on the real env path (no `TEST_BITS`): `words()` for 0, 1, 2, 30, 31, 32, 33, 100 and 1000 barriers, null and named texture, count 0 and 1 | all 36 shapes give `[count]`, one word as on `main` | | Recording through the list's methods | throwaway test: named barrier, resource-less barrier, `targets_written`, pipeline sync, 4 rounds, card | no full wait, one shader-write wait per call (12/12), colour and depth targets left as targets; debug layer clean | | Listed raw twins | throwaway test: `own_slot` for addresses inside this thread's `LIST_SLOTS` | `None`, so `settle_twin` takes `main`'s path | | Translated shaders | throwaway hash of every `emit::emit` result in the 39 `leonida-shader` tests that reach it, one thread, `main` against this merge | 143 results (135 DXIL, 8 refusals), byte-identical in order. Many of these tests pin the lanes through `TEST_HOST_WAVE`, which returns before the changed line in `host_max_wave`, so the unpinned path is covered mainly by reading `told_lanes` | **One thing that does change with the switches unset (READ IN CODE).** `clear_rtv`, `clear_dsv` and `resolve` now always call `with_state(this, |_, state| state.targets_written())`. In a diagnostics build that is one more state lock, a `tick()` and one `copystat` "list call" for each clear and resolve, whatever the switch says. The recorded host commands are unchanged, but the "list calls per frame" figure of a diagnostics run moves a little against `main`. A `groups::waits()` check before it would keep the unset path as it was. **Switch values.** READ IN CODE, and the PR's own `the_switch_is_off_unless_it_is_a_number` covers the first row. | Variable | Turns on | Notes | |---|---|---| | `LEONIDA_TARGET_BARRIERS` | a `u8` masked to its low two bits, trimmed | `7` acts as `3`, `4` and `256` as off; a log line says what the value was taken as | | `LEONIDA_LIST_TWIN_MOVE` | any value but `0` (`switch::on`) | `false` or `off` turns it **on**; that is the crate's convention | | `LEONIDA_HOST_WAVE32` | exactly `1` | `true`, `yes` or ` 1` leave it off and print nothing, since the log line only comes when it is on | With `LEONIDA_AB` naming `LEONIDA_TARGET_BARRIERS`, the AB bit wins and alternates 3 and 0. A value such as `LEONIDA_TARGET_BARRIERS=1` set alongside it is then ignored, with no log line. That matters for the A/B plan, which suggests trying `1` and `2` on their own after `3`. **Overlap with #3136.** `git merge-tree` of the two heads conflicts in `leonida-gpu/src/list.rs`. #3136 gives `with_state` an op-name argument, and this PR adds new two-argument `with_state` calls (`targets_written`, `wait`). Whichever lands second needs a rebase, and its new `with_state` calls need the op name. Not checked: any AMD card, so the two AMD-only switches did nothing here; an in-game run (the collaborator's gate above still stands); the ignored raw-twin readbacks beyond their prerequisite; the frame-time cost of bit 2. GPUs tested: one NVIDIA desktop card + WARP. AI-assisted: yes (Claude Code).
MoonEyes commented 2026-12-02 18:01:12 +00:00 (Migrated from github.com)

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


Triage of head 01df1490c (merge base 5b1fff821, 3 commits behind; git merge-tree against current main 45dc41f95: no conflicts).

11 files (+1,703/-47), mostly new list/groups.rs (+1,110), all behind opt-in switches.

CI green on the head (6 checks).

Existing verification: Verified by @fiestorra, @merzleckeier (RADV and RTX under Wine), @Tauwni (native RDNA 4 RX 9060 XT) and @Kal0s-design on 0386100f0 with the debug layer. The current head 01df1490c is a merge of main plus a regenerated switches.md; the PR's own diff is unchanged.

This check: Not re-reviewed in depth. The switches are off by default, so default behaviour is unchanged; the body states the RDNA 3/4 root cause is not proven. The size (+1,110 lines in one new file) is the main review risk; the issues it is for (#2770, #2771) still need an A/B on the reporting hardware.

I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here.

Verdict: ready (opt-in only, verified on four configurations; root cause still open by design).

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353866388 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7353866388). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:01:12Z. --- **Triage of head `01df1490c` (merge base `5b1fff821`, 3 commits behind; `git merge-tree` against current `main` `45dc41f95`: no conflicts).** 11 files (+1,703/-47), mostly new `list/groups.rs` (+1,110), all behind opt-in switches. CI green on the head (6 checks). **Existing verification:** Verified by @fiestorra, @merzleckeier (RADV and RTX under Wine), @Tauwni (native RDNA 4 RX 9060 XT) and @Kal0s-design on `0386100f0` with the debug layer. The current head `01df1490c` is a merge of `main` plus a regenerated `switches.md`; the PR's own diff is unchanged. **This check:** Not re-reviewed in depth. The switches are off by default, so default behaviour is unchanged; the body states the RDNA 3/4 root cause is not proven. The size (+1,110 lines in one new file) is the main review risk; the issues it is for (#2770, #2771) still need an A/B on the reporting hardware. I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here. **Verdict: ready** (opt-in only, verified on four configurations; root cause still open by design). AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
zmasi commented 2026-12-03 03:34:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-03T03:34:31Z.


Merged origin/main (516c9eaabf) into c60eaf13df strictly to regenerate d3d12/docs/switches.md (needs rebase); all 10 Rust files (descriptor.rs, descriptor/host.rs, draw.rs, listed_raw_tests.rs, host/place.rs, list.rs, list/groups.rs, list/thin.rs, emit/lower.rs, and emit/mod.rs) preserve 100% identical +/- changes against origin/main compared to 01df1490c4.

AI-assisted: Gemini 4 Carbon (High) and Gemini 4 Neon (XHigh).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366711181 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7366711181). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-03T03:34:31Z. --- Merged `origin/main` (`516c9eaabf`) into `c60eaf13df` strictly to regenerate `d3d12/docs/switches.md` (`needs rebase`); all 10 Rust files (`descriptor.rs`, `descriptor/host.rs`, `draw.rs`, `listed_raw_tests.rs`, `host/place.rs`, `list.rs`, `list/groups.rs`, `list/thin.rs`, `emit/lower.rs`, and `emit/mod.rs`) preserve 100% identical `+`/`-` changes against `origin/main` compared to `01df1490c4`. AI-assisted: Gemini 4 Carbon (High) and Gemini 4 Neon (XHigh).
MoonEyes commented 2026-12-03 04:29:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T04:29:41Z.


RUN (in game, one pull request), its head merged with git merge --no-ff onto main 516c9eaab: #2834 c60eaf13d. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, 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.6, mean 16.7
Rendered fps, last 120 s median 16.7
Time under 5 fps in the world 0 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. 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 pull request, on the head above. If it changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used, so the default start (every known pipeline precompiled) was not exercised. It was run alone because it does not merge together with #2789 and #3072. Its switches are opt-in and target RDNA; they were left off on this NVIDIA card, so this run covers the default path only. The precompile before the world took 528 s against about 155 s for the batches before it: something in this head changes pipelines and leaves the cache cold (cause not looked into).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367708585 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7367708585). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T04:29:41Z. --- RUN (in game, one pull request), its head merged with `git merge --no-ff` onto main `516c9eaab`: #2834 `c60eaf13d`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, 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.6, mean 16.7 | | Rendered fps, last 120 s | median 16.7 | | Time under 5 fps in the world | 0 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. 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 pull request, on the head above. If it changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used, so the default start (every known pipeline precompiled) was not exercised. It was run alone because it does not merge together with #2789 and #3072. Its switches are opt-in and target RDNA; they were left off on this NVIDIA card, so this run covers the default path only. The precompile before the world took 528 s against about 155 s for the batches before it: something in this head changes pipelines and leaves the cache cold (cause not looked into). AI-assisted (Claude Code).
zmasi commented 2026-12-03 11:25:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-03T11:25:01Z.


Merged origin/main (6e97990505, #3318) into 6a0a20c7f1 strictly to regenerate d3d12/docs/switches.md (needs rebase); all 10 Rust files have byte-identical diffs against origin/main compared to c60eaf13df.

AI-assisted: Gemini 4 Carbon (High) and Gemini 4 Neon (XHigh).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7376669861 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2834#issuecomment-7376669861). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-03T11:25:01Z. --- Merged `origin/main` (`6e97990505`, `#3318`) into `6a0a20c7f1` strictly to regenerate `d3d12/docs/switches.md` (`needs rebase`); all 10 Rust files have byte-identical diffs against `origin/main` compared to `c60eaf13df`. AI-assisted: Gemini 4 Carbon (High) and Gemini 4 Neon (XHigh).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2834:upstream-pr/2834'
git switch 'upstream-pr/2834'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2834'
git switch 'upstream-pr/2834'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2834'
git switch 'upstream-pr/2834'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2834'
git switch 'main'
git merge --squash 'upstream-pr/2834'
git switch 'main'
git merge --ff-only 'upstream-pr/2834'
git switch 'main'
git merge 'upstream-pr/2834'
git push origin 'main'
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!2834
No description provided.