gpu/ambient: LDS-tile gather compute pass and scope internal UAV barriers (D3D12-GPU-AMBIENT-LDS-GATHER) #2893

Open
djrolfes wants to merge 1 commit from upstream-pr/2893 into main
djrolfes commented 2026-12-01 15:37:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-12-01T15:37:12Z.


Claimed in the coordination issue as: D3D12-GPU-AMBIENT-LDS-GATHER.

What and why

Tile the ambient::gather compute shader through workgroup shared memory (LDS) for 64× fewer global UAV reads and scope internal ambient UAV barriers (d3d12/crates/leonida-gpu/src/ambient.rs).

  • Why:
    1. On main, gather runs [numthreads(8, 2, 1)] (Dispatch(20, 45, 1)) and every one of the 14,400 (160 × 90) threads independently reads all CELLS = 2,304 entries of cells[] (cells[CELLS + 1 + i] and cells[i].rgb) from global UAV memory.
    2. Every internal transition (keep → mean, mean → ..., place → gather) emitted a global pResource = NULL UAV barrier, and Role::Resolve also emitted a pre-dispatch global UAV barrier before place + gather even though neither touches views.image.
  • Change:
    • Converts gather to [numthreads(8, 8, 1)] (Dispatch(20, 12, 1)), cooperatively loading 64-cell tiles into groupshared float4 tile_pos[64] and groupshared float3 tile_light[64] (CELLS = 64 × 36 = 2,304, an exact multiple of 64), reducing global UAV reads by 64× while guarding partial-group rows (90 % 8 == 2) with bool active = at.x < PX && at.y < PY; so inactive threads still participate in cooperative loads and GroupMemoryBarrierWithGroupSync() before returning.
    • Extends uav_barrier(list, resource: Option<&ID3D12Resource>) to scope internal cells transitions (keep → mean, after mean, place → gather) to Some(&pass.cells).
    • In Role::Resolve, defers the global uav_barrier(l, None) until immediately before pass.raise (synchronizing both pass.points written by gather and the title's views.image UAV write before raise reads/modifies views.image).
  • Evidence classification: READ IN CODE (d3d12/crates/leonida-gpu/src/ambient.rs) + live D3D12 GPU red→green test (gather_dispatches_the_partial_group) + MEASURED 300 s in-world Option-A roam gate with LEONIDA_AMBIENT=0.8 and local mid-roam video visual/flicker check.

Tested

  • python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/ambient.rs → exit 0.
  • Cross-compiled leonida-gpu unit test binary (x86_64-pc-windows-msvc) and ran live D3D12 GPU tests under Wine + VKD3D-Proton 3.2.0 (NVIDIA GeForce RTX 3070 Ti, driver 620.73.04):
    • RED on origin/main (only the new GPU test ambient::tests::gather_dispatches_the_partial_group applied, dispatching (20, 12, 1) and asserting all 160 × 90 output points receive the final tile CELLS - 1):
      running 1 test
      thread 'ambient::tests::gather_dispatches_the_partial_group' panicked:
      point 3840, channel 0: [NaN, NaN, NaN, NaN]
      test result: FAILED. 0 passed; 1 failed; 0 ignored
      
      (3840 = 24 × 160 — rows 24..90 were left unwritten under main's [numthreads(8, 2, 1)].)
    • GREEN on PR head e9e8b257b (rebased onto 3e7b34a52):
      running 4 tests
      test ambient::tests::gather_dispatches_the_partial_group ... ok
      test ambient::tests::roles_by_name ... ok
      test ambient::tests::settings ... ok
      test ambient::tests::the_passes_build ... ok
      test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 687 filtered out
      
  • 300 s in-world game gate (MEASURED on exact PR head e9e8b257b, Series S + DLSS Quality 1280×720 → 1920×1080, LEONIDA_AMBIENT=0.8, Option A mods/gate_driver mode = roam):
    • Verdict: PASS (310.35 s in-world after world entry at 74.71 s).
    • Frames & pacing: 1,580 frames after +60 s (1,648 total world presents), 9.85 median FPS (10.90 end median FPS), 405.56 ms p95 frame time, 6.964 s longest present gap (<= 10.0 s).
    • Memory & stability: 6,692 MiB peak VRAM (<= 7,400 MiB), 0 device losses (0x887A0005), 0 crashes, 0 panics, 0 faults before stop, 0 kernel NVRM: Xid errors.
    • Option A roam control: GATE CONTROL reached at t = 79.7 s (moved = 7.62 m, mode = roam), 30 GATE MARK roam ticks, 0 GATE FAIL.
    • Local visual video check: Captured 48 consecutive presented frames mid-roam with LEONIDA_AMBIENT=0.8 (reversals_ge_5 = 0, blink_pct_mean = 0.402%); visual inspection confirmed clean indirect ambient lighting with zero tile seams (including the partial bottom row 90 % 8 == 2), zero NaN/black blocks, and zero flicker during camera motion (temporary capture deleted locally; no frames attached).

GPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0).

AI-assisted: yes (authored by Gemini 4 Neon; reviewed in a separate independent review pass by Gemini 4 Neon).

Checklist

  • Based on current main (3e7b34a52) and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (check_no_game_data.py clean on both source and PR description).
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — GPU ambient stand-in compute pass optimization)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5589007985 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-12-01T15:37:12Z. --- Claimed in the coordination issue as: [`D3D12-GPU-AMBIENT-LDS-GATHER`](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7313474720). ### What and why Tile the `ambient::gather` compute shader through workgroup shared memory (LDS) for 64× fewer global UAV reads and scope internal ambient UAV barriers (`d3d12/crates/leonida-gpu/src/ambient.rs`). - **Why:** 1. On `main`, `gather` runs `[numthreads(8, 2, 1)]` (`Dispatch(20, 45, 1)`) and every one of the 14,400 (`160 × 90`) threads independently reads all `CELLS = 2,304` entries of `cells[]` (`cells[CELLS + 1 + i]` and `cells[i].rgb`) from global UAV memory. 2. Every internal transition (`keep → mean`, `mean → ...`, `place → gather`) emitted a global `pResource = NULL` UAV barrier, and `Role::Resolve` also emitted a pre-dispatch global UAV barrier before `place` + `gather` even though neither touches `views.image`. - **Change:** - Converts `gather` to `[numthreads(8, 8, 1)]` (`Dispatch(20, 12, 1)`), cooperatively loading 64-cell tiles into `groupshared float4 tile_pos[64]` and `groupshared float3 tile_light[64]` (`CELLS = 64 × 36 = 2,304`, an exact multiple of 64), reducing global UAV reads by 64× while guarding partial-group rows (`90 % 8 == 2`) with `bool active = at.x < PX && at.y < PY;` so inactive threads still participate in cooperative loads and `GroupMemoryBarrierWithGroupSync()` before returning. - Extends `uav_barrier(list, resource: Option<&ID3D12Resource>)` to scope internal `cells` transitions (`keep → mean`, after `mean`, `place → gather`) to `Some(&pass.cells)`. - In `Role::Resolve`, defers the global `uav_barrier(l, None)` until immediately before `pass.raise` (synchronizing both `pass.points` written by `gather` and the title's `views.image` UAV write before `raise` reads/modifies `views.image`). - **Evidence classification:** **READ IN CODE** (`d3d12/crates/leonida-gpu/src/ambient.rs`) + live D3D12 GPU red→green test (`gather_dispatches_the_partial_group`) + **MEASURED** 300 s in-world Option-A roam gate with `LEONIDA_AMBIENT=0.8` and local mid-roam video visual/flicker check. ### Tested - `python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/ambient.rs` → exit 0. - Cross-compiled `leonida-gpu` unit test binary (`x86_64-pc-windows-msvc`) and ran live D3D12 GPU tests under Wine + VKD3D-Proton 3.2.0 (`NVIDIA GeForce RTX 3070 Ti`, driver `620.73.04`): - **RED on `origin/main`** (only the new GPU test `ambient::tests::gather_dispatches_the_partial_group` applied, dispatching `(20, 12, 1)` and asserting all `160 × 90` output points receive the final tile `CELLS - 1`): ```text running 1 test thread 'ambient::tests::gather_dispatches_the_partial_group' panicked: point 3840, channel 0: [NaN, NaN, NaN, NaN] test result: FAILED. 0 passed; 1 failed; 0 ignored ``` (`3840 = 24 × 160` — rows `24..90` were left unwritten under `main`'s `[numthreads(8, 2, 1)]`.) - **GREEN on PR head `e9e8b257b` (rebased onto `3e7b34a52`)**: ```text running 4 tests test ambient::tests::gather_dispatches_the_partial_group ... ok test ambient::tests::roles_by_name ... ok test ambient::tests::settings ... ok test ambient::tests::the_passes_build ... ok test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 687 filtered out ``` - **300 s in-world game gate (MEASURED on exact PR head `e9e8b257b`, Series S + DLSS Quality `1280×720 → 1920×1080`, `LEONIDA_AMBIENT=0.8`, Option A `mods/gate_driver` `mode = roam`):** - **Verdict:** **PASS** (`310.35 s` in-world after world entry at `74.71 s`). - **Frames & pacing:** `1,580` frames after +60 s (`1,648` total world presents), `9.85` median FPS (`10.90` end median FPS), `405.56 ms` p95 frame time, `6.964 s` longest present gap (`<= 10.0 s`). - **Memory & stability:** `6,692 MiB` peak VRAM (`<= 7,400 MiB`), `0` device losses (`0x887A0005`), `0` crashes, `0` panics, `0` faults before stop, `0` kernel `NVRM: Xid` errors. - **Option A roam control:** `GATE CONTROL` reached at `t = 79.7 s` (`moved = 7.62 m`, `mode = roam`), `30` `GATE MARK` roam ticks, `0` `GATE FAIL`. - **Local visual video check:** Captured `48` consecutive presented frames mid-roam with `LEONIDA_AMBIENT=0.8` (`reversals_ge_5 = 0`, `blink_pct_mean = 0.402%`); visual inspection confirmed clean indirect ambient lighting with zero tile seams (including the partial bottom row `90 % 8 == 2`), zero NaN/black blocks, and zero flicker during camera motion (temporary capture deleted locally; no frames attached). GPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0). AI-assisted: yes (authored by Gemini 4 Neon; reviewed in a separate independent review pass by Gemini 4 Neon). ### Checklist - [x] Based on current `main` (`3e7b34a52`) and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (`check_no_game_data.py` clean on both source and PR description). - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — GPU ambient stand-in compute pass optimization)
merzleckeier commented 2026-12-01 15:58:40 +00:00 (Migrated from github.com)

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


Nonuniform gather readback across both adapters at e9e8b257 + 0ff8a532f. All four ambient unit tests passed on each GPU. I then ran main's 8×2 gather and this PR's 8×8 tiled gather against the same 2,304 synthetic cells with varying positions, RGB and weights (including zero weights) and a null depth SRV. Both readbacks wrote all 14,400 points (172,800 finite floats).

Adapter (Wine 11.22 / VKD3D-Proton 3.1.0) Comparison to main
RTX 4070 SUPER, 620.73.04 All 172,800 floats bit-identical
Radeon Raphael, RADV 26.3.1 Maximum absolute difference 2.98e-7

The readback required an actual D3D12 device. Dispatching only 11 tiled groups vertically as a negative control left exactly the last two rows (3,840 floats) unwritten on each GPU. This exercises the gather kernel and partial-group coverage. The full ambient pass sequence and frame-time effect were outside the fixture.

MEASURED with synthetic inputs. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7316830502 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#issuecomment-7316830502). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T15:58:40Z. --- Nonuniform gather readback across both adapters at e9e8b257 + 0ff8a532f. All four ambient unit tests passed on each GPU. I then ran main's 8×2 gather and this PR's 8×8 tiled gather against the same 2,304 synthetic cells with varying positions, RGB and weights (including zero weights) and a null depth SRV. Both readbacks wrote all 14,400 points (172,800 finite floats). | Adapter (Wine 11.22 / VKD3D-Proton 3.1.0) | Comparison to main | | --- | --- | | RTX 4070 SUPER, 620.73.04 | All 172,800 floats bit-identical | | Radeon Raphael, RADV 26.3.1 | Maximum absolute difference 2.98e-7 | The readback required an actual D3D12 device. Dispatching only 11 tiled groups vertically as a negative control left exactly the last two rows (3,840 floats) unwritten on each GPU. This exercises the gather kernel and partial-group coverage. The full ambient pass sequence and frame-time effect were outside the fixture. MEASURED with synthetic inputs. AI-assisted (Codex).
KelboLive commented 2026-12-01 17:30:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T17:30:25Z.

Review: COMMENTED


Tiling is faithful: accumulation order is unchanged (base 0→2304 step 64, j 0→63), 20×12 groups of 8×8 covers 160×96 ⊇ 160×90, and active plus both group barriers keep the 90 % 8 == 2 tail legal; CELLS = 2304 = 36×64 keeps the tile loads in range. Barrier scoping is sound: keep→mean and place→gather touch only cells, and the global barrier before raise still orders gather's points and the title's image write ahead of raise's read-modify-write (ambient.rs:614), with the post-raise barrier kept — I found no new raise/resolve race. 632/0/59 on the crate, and the new test passes on the real adapter and on WARP.

The test, however, pins the kernel, not the wiring:

  • It hardcodes its own Dispatch(20,12,1) (ambient.rs:969) instead of the call-site grid, so shrinking the production dispatch to 20×11 leaves all 632 tests green — I verified it.
  • It never calls after(), so deleting the pre-gather cells barrier also leaves the suite green — verified.
  • It returns silently when no device exists (:915), so on a host without one it is a no-op rather than a SKIP.

Sharing one grid const between the call site and the test would make the full-coverage assertion guard the wiring, and calling after() would give the barrier a test.

Two notes:

  • CELLS % 64 == 0 is an unstated invariant (an out-of-range load if CX ever stops being 64) — a static assert would pin it.
  • "64× fewer global UAV reads" is per-thread; the total is 60× (14,400 → 15,360 threads, 33.2 M → 0.55 M cell loads). Worth correcting in the body.

Merge: the only conflict is the appended test at the end of mod tests, because #2904 merged at 17:14Z and already appended the_colour_drops_compile; keep both (and the two closing braces). If #2908 lands first, switch the new test's host() to require_host() so it SKIPs loudly.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6136493488 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#pullrequestreview-6136493488). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T17:30:25Z. **Review:** COMMENTED --- Tiling is faithful: accumulation order is unchanged (base 0→2304 step 64, `j` 0→63), 20×12 groups of 8×8 covers 160×96 ⊇ 160×90, and `active` plus both group barriers keep the `90 % 8 == 2` tail legal; `CELLS = 2304 = 36×64` keeps the tile loads in range. Barrier scoping is sound: `keep→mean` and `place→gather` touch only `cells`, and the global barrier before `raise` still orders gather's `points` *and* the title's image write ahead of raise's read-modify-write (`ambient.rs:614`), with the post-raise barrier kept — I found no new raise/resolve race. 632/0/59 on the crate, and the new test passes on the real adapter and on WARP. The test, however, pins the **kernel, not the wiring**: - It hardcodes its own `Dispatch(20,12,1)` (`ambient.rs:969`) instead of the call-site grid, so shrinking the production dispatch to 20×11 leaves all 632 tests green — I verified it. - It never calls `after()`, so deleting the pre-gather `cells` barrier also leaves the suite green — verified. - It returns silently when no device exists (`:915`), so on a host without one it is a no-op rather than a SKIP. Sharing one grid const between the call site and the test would make the full-coverage assertion guard the wiring, and calling `after()` would give the barrier a test. Two notes: - `CELLS % 64 == 0` is an unstated invariant (an out-of-range load if `CX` ever stops being 64) — a static assert would pin it. - "64× fewer global UAV reads" is per-thread; the total is **60×** (14,400 → 15,360 threads, 33.2 M → 0.55 M cell loads). Worth correcting in the body. Merge: the only conflict is the appended test at the end of `mod tests`, because **#2904 merged at 17:14Z** and already appended `the_colour_drops_compile`; keep both (and the two closing braces). If #2908 lands first, switch the new test's `host()` to `require_host()` so it SKIPs loudly.
Kal0s-design commented 2026-12-01 17:50:37 +00:00 (Migrated from github.com)

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


Checked on native Windows 11 with the native D3D12 driver (no VKD3D), rustc 1.98.1.

Heads-up: this now conflicts with main (d2a564b66). fe612066a added the_colour_drops_compile at the end of ambient.rs's tests, in the same spot as gather_dispatches_the_partial_group. It is only the two tests touching; keeping both resolves it. I resolved it that way locally and tested the result.

Head e9e8b257b + main d2a564b66, conflict resolved by keeping both tests:

  • cargo test -p leonida-gpu --lib ambient:: on the card: 5 passed, 0 failed.
  • The same with LEONIDA_D3D12_WARP=1 (software adapter): 5 passed. gather_dispatches_the_partial_group also passes there, so the partial last row is written on WARP too.

Barrier scoping. I went through which UAV each pass writes. keep, mean and place write only cells, gather writes only points, and raise writes the title's view. So scoping the keep -> mean -> ... and place -> gather barriers to pass.cells covers every dependency. The global barrier before raise covers points and the title's view. Radiance still starts with the global barrier, which keep needs since it reads the title's radiance UAV. I see no missing wait.

What the LDS tiling buys on a native driver. Same random 2,304 cells and null depth SRV on both sides; gather alone, run 201 times in one list with a UAV barrier between dispatches. Best of 5 rounds, minus a 1-dispatch list. Two runs each:

per gather dispatch
main (8x2, Dispatch(20, 45, 1)) 0.191 / 0.201 ms
this PR (8x8 + LDS, Dispatch(20, 12, 1)) 0.079 / 0.087 ms

That is about 2.3-2.4x faster for the dispatch, about 0.11 ms a frame when the pass runs. These are wall-clock times around a synchronous submit, not GPU timestamps, so treat them as approximate.

One wording note on the description: the "RED on origin/main" is the new test dispatching (20, 12, 1) against main's 8x2 shader. main itself dispatches (20, 45, 1) and covers all 90 rows, so that run shows the test needs the PR's group size. It is not a defect on main.

Not checked: the game.

GPUs tested: one hardware adapter (native D3D12 driver) and WARP.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319935767 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#issuecomment-7319935767). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-01T17:50:37Z. --- Checked on native Windows 11 with the native D3D12 driver (no VKD3D), rustc 1.98.1. **Heads-up: this now conflicts with `main`** (`d2a564b66`). `fe612066a` added `the_colour_drops_compile` at the end of `ambient.rs`'s tests, in the same spot as `gather_dispatches_the_partial_group`. It is only the two tests touching; keeping both resolves it. I resolved it that way locally and tested the result. Head `e9e8b257b` + `main` `d2a564b66`, conflict resolved by keeping both tests: - `cargo test -p leonida-gpu --lib ambient::` on the card: 5 passed, 0 failed. - The same with `LEONIDA_D3D12_WARP=1` (software adapter): 5 passed. `gather_dispatches_the_partial_group` also passes there, so the partial last row is written on WARP too. **Barrier scoping.** I went through which UAV each pass writes. `keep`, `mean` and `place` write only `cells`, `gather` writes only `points`, and `raise` writes the title's view. So scoping the `keep -> mean -> ...` and `place -> gather` barriers to `pass.cells` covers every dependency. The global barrier before `raise` covers `points` and the title's view. Radiance still starts with the global barrier, which `keep` needs since it reads the title's radiance UAV. I see no missing wait. **What the LDS tiling buys on a native driver.** Same random 2,304 cells and null depth SRV on both sides; `gather` alone, run 201 times in one list with a UAV barrier between dispatches. Best of 5 rounds, minus a 1-dispatch list. Two runs each: | | per `gather` dispatch | |---|---| | `main` (`8x2`, `Dispatch(20, 45, 1)`) | 0.191 / 0.201 ms | | this PR (`8x8` + LDS, `Dispatch(20, 12, 1)`) | 0.079 / 0.087 ms | That is about 2.3-2.4x faster for the dispatch, about 0.11 ms a frame when the pass runs. These are wall-clock times around a synchronous submit, not GPU timestamps, so treat them as approximate. One wording note on the description: the "RED on `origin/main`" is the new test dispatching `(20, 12, 1)` against `main`'s `8x2` shader. `main` itself dispatches `(20, 45, 1)` and covers all 90 rows, so that run shows the test needs the PR's group size. It is not a defect on `main`. Not checked: the game. GPUs tested: one hardware adapter (native D3D12 driver) and WARP. AI-assisted: yes (Claude Code).
lixonik commented 2026-12-01 21:36:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-01T21:36:29Z.


RUN

Independent native Windows 10 + RTX 5070 (Blackwell) verification of #2893 (7c7e99b48) vs main (1e3e316c5).

Verdict

  • Unit tests: cargo test --locked -p leonida-gpu --lib ambient:: -- --nocapture: 5 passed, 0 failed (including the_passes_build, the_colour_drops_compile, and gather_dispatches_the_partial_group).
  • In-world stability & GPU cost (LEONIDA_AB=20,LEONIDA_AMBIENT_ON): 0 errors / 0 device lost on both runs; all three ambient stand-in roles initialized cleanly (Resolve 1280x720, Air 80x46, Reflect 1280x720, level=0.8). On settled standing frames (~4,400--4,550 draws), the GPU-side card_busy cost of turning LEONIDA_AMBIENT_ON on (on minus off) dropped from +0.70 ms on main to +0.07 ms on #2893, while whole-frame median was unchanged (no clear difference, as expected on a CPU-bound Series S frame where card busy ~26--27 ms < submitting thread ~36--37 ms, gpu_wait 0.0 ms).

Setup

  • Hardware / OS: NVIDIA GeForce RTX 5070 12 GB (driver 621.40), Ryzen 9 5950X (16C/32T), 64 GiB RAM, Windows 10 Pro 22H2 (build 19045).
  • Build & settings: diag profile (diagnostics,dlss,mimalloc), Series S profile, -NoFrameGen, standing in the world from the same save snapshot, -More @{ LEONIDA_AB = '20,LEONIDA_AMBIENT_ON' }.

Measurements (MEASURED)

Build In-world summary (d3d12_run_fps.py) d3d12_ab_compare.py phases (median, on minus off) Settled card_busy (on vs off, draws ~4,400--4,550) Errors / Device lost
main (1e3e316c5) 34 world samples, median 23.4 fps (42.6 ms), 4,437 draws, gpu_wait 0.0 ms -0.800 +- 1.331 ms (5 pairs, 3 dropped; no clear difference) phases 12--16: off 26.8 / 26.4 / 26.0 ms vs on 27.0 / 27.2 ms (4 adjacent pairs: +0.700 +- 0.208 ms) 0 / 0
PR #2893 (7c7e99b48) 41 world samples, median 23.0 fps (43.5 ms), 4,433 draws, gpu_wait 0.0 ms -0.133 +- 0.384 ms (3 pairs, 5 dropped; no clear difference) phases 10--15: off 27.3 / 26.6 / 26.3 ms vs on 27.2 / 26.8 / 26.4 ms (3 non-overlapping pairs: +0.067 +- 0.088 ms; incl. phase 9: +0.467 +- 0.232 ms over 6 adjacent pairs) 0 / 0

(Note: whole-frame medians across the two separate runs are within run-to-run variance on a CPU-bound Series S frame; the card_busy on - off within-run delta isolates the GPU cost of the ambient pass itself.)

AI-assisted: Antigravity

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7326517237 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#issuecomment-7326517237). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-01T21:36:29Z. --- RUN Independent native Windows 10 + RTX 5070 (Blackwell) verification of `#2893` (`7c7e99b48`) vs `main` (`1e3e316c5`). ### Verdict - **Unit tests:** `cargo test --locked -p leonida-gpu --lib ambient:: -- --nocapture`: **5 passed, 0 failed** (including `the_passes_build`, `the_colour_drops_compile`, and `gather_dispatches_the_partial_group`). - **In-world stability & GPU cost (`LEONIDA_AB=20,LEONIDA_AMBIENT_ON`):** **0 errors / 0 device lost** on both runs; all three ambient stand-in roles initialized cleanly (`Resolve` 1280x720, `Air` 80x46, `Reflect` 1280x720, `level=0.8`). On settled standing frames (~4,400--4,550 draws), the GPU-side `card_busy` cost of turning `LEONIDA_AMBIENT_ON` on (`on minus off`) dropped from **+0.70 ms** on `main` to **+0.07 ms** on `#2893`, while whole-frame median was unchanged (`no clear difference`, as expected on a CPU-bound Series S frame where `card busy ~26--27 ms < submitting thread ~36--37 ms`, `gpu_wait 0.0 ms`). ### Setup - **Hardware / OS:** NVIDIA GeForce RTX 5070 12 GB (driver `621.40`), Ryzen 9 5950X (16C/32T), 64 GiB RAM, Windows 10 Pro 22H2 (build 19045). - **Build & settings:** `diag` profile (`diagnostics,dlss,mimalloc`), Series S profile, `-NoFrameGen`, standing in the world from the same save snapshot, `-More @{ LEONIDA_AB = '20,LEONIDA_AMBIENT_ON' }`. ### Measurements (`MEASURED`) | Build | In-world summary (`d3d12_run_fps.py`) | `d3d12_ab_compare.py phases` (`median`, on minus off) | Settled `card_busy` (`on` vs `off`, draws ~4,400--4,550) | Errors / Device lost | |---|---|---|---|---| | `main` (`1e3e316c5`) | 34 world samples, median 23.4 fps (42.6 ms), 4,437 draws, `gpu_wait 0.0 ms` | `-0.800 +- 1.331 ms` (5 pairs, 3 dropped; `no clear difference`) | phases 12--16: off `26.8 / 26.4 / 26.0 ms` vs on `27.0 / 27.2 ms` (4 adjacent pairs: `+0.700 +- 0.208 ms`) | 0 / 0 | | PR `#2893` (`7c7e99b48`) | 41 world samples, median 23.0 fps (43.5 ms), 4,433 draws, `gpu_wait 0.0 ms` | `-0.133 +- 0.384 ms` (3 pairs, 5 dropped; `no clear difference`) | phases 10--15: off `27.3 / 26.6 / 26.3 ms` vs on `27.2 / 26.8 / 26.4 ms` (3 non-overlapping pairs: `+0.067 +- 0.088 ms`; incl. phase 9: `+0.467 +- 0.232 ms` over 6 adjacent pairs) | 0 / 0 | *(Note: whole-frame medians across the two separate runs are within run-to-run variance on a CPU-bound Series S frame; the `card_busy` `on - off` within-run delta isolates the GPU cost of the ambient pass itself.)* AI-assisted: Antigravity
MoonEyes commented 2026-12-02 12:30:55 +00:00 (Migrated from github.com)

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


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:7345454721 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#issuecomment-7345454721). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:30:55Z. --- 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).
MoonEyes commented 2026-12-02 18:01:01 +00:00 (Migrated from github.com)

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


Triage of head 7c7e99b48 (merge base 1e3e316c5, 340 commits behind; git merge-tree against current main 45dc41f95: no conflicts).

1 file: d3d12/crates/leonida-gpu/src/ambient.rs (+143/-26).

CI green on the head (6 checks).

Existing verification: @merzleckeier compared main's and this gather on 2,304 synthetic cells on two GPUs; @lixonik verified this head natively (RTX 5070, 5 ambient tests). The conflict @Kal0s-design reported on d2a564b66 is gone: it merges cleanly into current main.

This check: Not re-reviewed in depth. Render-path change (an LDS-tiled compute pass): @MoonEyes's in-game gate asks for a 300 s run on the current head, and none is posted for 7c7e99b48.

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: blocked (code verified; still needs the in-game run on the current head that the render-path gate asks for).

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353863410 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#issuecomment-7353863410). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:01:01Z. --- **Triage of head `7c7e99b48` (merge base `1e3e316c5`, 340 commits behind; `git merge-tree` against current `main` `45dc41f95`: no conflicts).** 1 file: `d3d12/crates/leonida-gpu/src/ambient.rs` (+143/-26). CI green on the head (6 checks). **Existing verification:** @merzleckeier compared main's and this gather on 2,304 synthetic cells on two GPUs; @lixonik verified this head natively (RTX 5070, 5 ambient tests). The conflict @Kal0s-design reported on `d2a564b66` is gone: it merges cleanly into current `main`. **This check:** Not re-reviewed in depth. Render-path change (an LDS-tiled compute pass): @MoonEyes's in-game gate asks for a 300 s run on the current head, and none is posted for `7c7e99b48`. 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: blocked** (code verified; still needs the in-game run on the current head that the render-path gate asks for). AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 18:21:41 +00:00 (Migrated from github.com)

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


RUN (in game, batch of seventeen render-path pull requests), each head merged with git merge --no-ff onto main 3c106eb2f, in one build: #3111 15b579756, #2948 5284c6eae, #2698 1f188c4f7, #2946 44bf554fe, #3001 d924cbb65, #2832 0c861595a, #2915 58e8535cf, #2822 d359a2f85, #2896 c9c6b103d, #2983 8278ef1b9, #3115 ba5121192, #2945 d2c08c14f, #2975 74512d658, #2951 26da88e8e, #2800 b6ebcedd4, #2893 7c7e99b48, #3113 fa1460b6b (and #3097 0d7a451ab, merged since). 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 (43 samples) median 14.6, mean 12.7
Rendered fps, last 120 s median 13.7
Time under 5 fps in the world 13 % (short drops, lowest sample 0.3 fps)

The drops under 5 fps line up with shaders being translated while walking (about 500 translations in the last 330 s): this batch changes the shader translation, so the shader cache built by earlier runs did not apply and the pipeline precompile alone took about 45 minutes. The batch-5 run on the same machine and route had no sample under 5 fps (median 16.4). I read this as cold-cache stutter, not as a regression of a single pull request, but this run cannot tell them apart.

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; arrival in the world was driven by keys and not checked on pictures. A first attempt of this batch is not counted: the run script gave up waiting for the game window after 40 minutes of precompile.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354444436 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#issuecomment-7354444436). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:21:41Z. --- RUN (in game, batch of seventeen render-path pull requests), each head merged with `git merge --no-ff` onto main `3c106eb2f`, in one build: #3111 `15b579756`, #2948 `5284c6eae`, #2698 `1f188c4f7`, #2946 `44bf554fe`, #3001 `d924cbb65`, #2832 `0c861595a`, #2915 `58e8535cf`, #2822 `d359a2f85`, #2896 `c9c6b103d`, #2983 `8278ef1b9`, #3115 `ba5121192`, #2945 `d2c08c14f`, #2975 `74512d658`, #2951 `26da88e8e`, #2800 `b6ebcedd4`, #2893 `7c7e99b48`, #3113 `fa1460b6b` (and #3097 `0d7a451ab`, merged since). 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 (43 samples) | median 14.6, mean 12.7 | | Rendered fps, last 120 s | median 13.7 | | Time under 5 fps in the world | 13 % (short drops, lowest sample 0.3 fps) | The drops under 5 fps line up with shaders being translated while walking (about 500 translations in the last 330 s): this batch changes the shader translation, so the shader cache built by earlier runs did not apply and the pipeline precompile alone took about 45 minutes. The batch-5 run on the same machine and route had no sample under 5 fps (median 16.4). I read this as cold-cache stutter, not as a regression of a single pull request, but this run cannot tell them apart. 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; arrival in the world was driven by keys and not checked on pictures. A first attempt of this batch is not counted: the run script gave up waiting for the game window after 40 minutes of precompile. AI-assisted (Claude Code).
fiestorra commented 2026-12-03 04:51:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T04:51:52Z.


VERIFY-2893 — en su rama 3 fallos, sobre main sólo 1 (el de la iGPU): los otros dos eran de su base

Un fichero, +143/−26, seis días abierto. El método del AGENTS.md, que hoy ya me ha salvado dos veces:

en su head:    cargo test -p leonida-gpu --lib     642 passed; 3 failed
               ✓ la de la iGPU
               ✗ assertion failed: published(two, two + BLOCK)

cherry-pick sobre 516c9eaab               exit 0, sin conflicto
sobre main:    cargo test -p leonida-gpu --lib     716 passed; 1 failed
               la única falla es la de la iGPU

Los dos fallos que no eran de la iGPU desaparecen al aplicar el cambio sobre main: published(two, two + BLOCK) era un test de su base que main ya arregló, y el otro venía con él.

Lo que la PR hace: un pase de cómputo que recoge el LDS en mosaico para el ambiente (gpu/ambient), y acota los barriers UAV internos a su ámbito. 143 líneas de shader/compute en un fichero: el tipo de cambio que no se puede revisar leyendo el diff sin el contexto del pase, y por eso lo verificado es lo que la suite dice y lo que no.

Lo que no verifiqué: el ambiente renderizado — necesita el título, y el mosaico de LDS es exactamente el tipo de cambio que se ve en la imagen y no en un test.

Y lo que esto añade al método: «3 fallos» en una rama de seis días no es «3 fallos en el PR», y la diferencia entre los dos números es el cherry-pick — el segundo comando de esta noche que convierte un rojo alarmante en un dato limpio.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368124101 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#issuecomment-7368124101). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T04:51:52Z. --- ## VERIFY-2893 — en su rama 3 fallos, **sobre `main` sólo 1 (el de la iGPU)**: los otros dos eran de su base **Un fichero, +143/−26, seis días abierto.** **El método del `AGENTS.md`, que hoy ya me ha salvado dos veces**: ``` en su head: cargo test -p leonida-gpu --lib 642 passed; 3 failed ✓ la de la iGPU ✗ assertion failed: published(two, two + BLOCK) cherry-pick sobre 516c9eaab exit 0, sin conflicto sobre main: cargo test -p leonida-gpu --lib 716 passed; 1 failed la única falla es la de la iGPU ``` **Los dos fallos que no eran de la iGPU desaparecen al aplicar el cambio sobre `main`**: **`published(two, two + BLOCK)`** era **un test de su base que `main` ya arregló**, **y el otro venía con él.** **Lo que la PR hace**: **un pase de cómputo que recoge el `LDS` en mosaico para el ambiente** (**`gpu/ambient`**), **y acota los *barriers* UAV internos a su ámbito.** **143 líneas de shader/compute en un fichero**: **el tipo de cambio que no se puede revisar leyendo el diff sin el contexto del pase**, **y por eso lo verificado es lo que la suite dice y lo que no.** **Lo que no verifiqué**: **el ambiente renderizado** — **necesita el título, y el mosaico de `LDS` es exactamente el tipo de cambio que se ve en la imagen y no en un test.** **Y lo que esto añade al método**: **«3 fallos» en una rama de seis días no es «3 fallos en el PR»**, **y la diferencia entre los dos números es el `cherry-pick`** — **el segundo comando de esta noche que convierte un rojo alarmante en un dato limpio.**
MoonEyes commented 2026-12-03 17:26:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T17:26:34Z.


In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2915, #2896, #2893 and #2889 merged into main 09273248c; this PR tested at its current head 7c7e99b48. Series S 1080, DLSS FG 2x, play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s, screen kept on.

  • Result: PASS. No device lost, no crash, no unhandled exception; the run ended on its time limit.
  • Median over the last 240 s: 15.8 fps (main alone today: 15.8-17.5); 25.1 frames per 1000 over 100 ms, above today's usual 16-20, from one run only.
  • Covered: a normal launch and walk with this PR's code in the build. It does not isolate this PR's own change from the three others in the batch.

AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7386515413 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2893#issuecomment-7386515413). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T17:26:34Z. --- In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2915, #2896, #2893 and #2889 merged into main `09273248c`; this PR tested at its current head `7c7e99b48`. Series S 1080, DLSS FG 2x, `play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed`, scripted walk, 330 s, screen kept on. - Result: **PASS**. No device lost, no crash, no unhandled exception; the run ended on its time limit. - Median over the last 240 s: 15.8 fps (main alone today: 15.8-17.5); 25.1 frames per 1000 over 100 ms, above today's usual 16-20, from one run only. - Covered: a normal launch and walk with this PR's code in the build. It does not isolate this PR's own change from the three others in the batch. AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.
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/2893:upstream-pr/2893'
git switch 'upstream-pr/2893'

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