D3D12-SHADER-OPT-MERGE-WALK: keep the merge walk's tables between programs (full-archive wall -7 %) #2822

Open
bobcatchris wants to merge 2 commits from upstream-pr/2822 into main
bobcatchris commented 2026-12-01 02:05:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T02:05:24Z.


Item: D3D12-SHADER-OPT-MERGE-WALK, claimed at https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7298213349 (second attempt at the released D3D12-SHADER-OPT-MERGE-KEYS, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7297836058).

What

Module::merge (the FOLD/REUSE/FACTS/LOADS walk in emit/bitcode/opt.rs) made its three tables (known, dom_reads, lane_reads), its replacement list and its path_has_write scratch new for every round of every program. The tables now live in a MergeWalk kept in a thread-local by optimise, between rounds and between programs, cleared at the start of every round. path_has_write reuses a visited-stamp array and a frontier, the block body is compacted in place, and Key's argument lists are shared (Rc<[V]>) so a key clone is a refcount bump.

The walk makes the same decisions: same keys, same insertion and removal order, no table is iterated. This is a pure speed change; the DXIL does not change.

Measured (Ryzen 7 7800X3D, Windows 11; no game run, no GPU involved)

Full-archive leonida translate (LEONIDA_HOST_RDNA=1, local hash instrument for output identity), four alternating pairs against main d920d850d:

main this branch
user CPU, sum of 4 runs 2272.7 s 2249.1 s (-1.0 %)
wall, sum of 4 runs 195.7 s 181.9 s (-7.0 %)
kernel CPU, sum of 4 runs 297.0 s 237.4 s (-20 %)

(The kernel drop is the bucket arrays' page faults; the last two pairs ran under background load that inflated both sides' kernel time. A first version with only the clone fix and per-optimise reuse measured neutral, see the release comment; the saving is the growth between programs.)

  • DXIL hashes of all 25,689 emitted programs identical to main; the single exception across runs was two containers of one compute program that also flip between runs of unmodified main (pre-existing nondeterminism, reported as a finding in #2570). Byte-identical output makes validator results identical by construction.
  • cargo test -p leonida-shader --lib: 403 passed, 0 failed (includes the optimiser fuzz test every_pass_leaves_what_random_programs_store).
  • cargo clippy -p leonida-shader --no-deps --all-targets: no new warnings (3 pre-existing, the same as main on this toolchain).
  • python -I scripts/check_no_game_data.py on the changed file: clean.

AI-assisted: Claude Sonnet 5.5

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5577469608 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-12-01T02:05:24Z. --- Item: D3D12-SHADER-OPT-MERGE-WALK, claimed at https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7298213349 (second attempt at the released D3D12-SHADER-OPT-MERGE-KEYS, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7297836058). ## What `Module::merge` (the FOLD/REUSE/FACTS/LOADS walk in `emit/bitcode/opt.rs`) made its three tables (`known`, `dom_reads`, `lane_reads`), its replacement list and its `path_has_write` scratch new for every round of every program. The tables now live in a `MergeWalk` kept in a thread-local by `optimise`, between rounds and between programs, cleared at the start of every round. `path_has_write` reuses a visited-stamp array and a frontier, the block body is compacted in place, and `Key`'s argument lists are shared (`Rc<[V]>`) so a key clone is a refcount bump. The walk makes the same decisions: same keys, same insertion and removal order, no table is iterated. This is a pure speed change; the DXIL does not change. ## Measured (Ryzen 7 7800X3D, Windows 11; no game run, no GPU involved) Full-archive `leonida translate` (`LEONIDA_HOST_RDNA=1`, local hash instrument for output identity), four alternating pairs against `main` d920d850d: | | `main` | this branch | |---|---|---| | user CPU, sum of 4 runs | 2272.7 s | 2249.1 s (-1.0 %) | | wall, sum of 4 runs | 195.7 s | 181.9 s (-7.0 %) | | kernel CPU, sum of 4 runs | 297.0 s | 237.4 s (-20 %) | (The kernel drop is the bucket arrays' page faults; the last two pairs ran under background load that inflated both sides' kernel time. A first version with only the clone fix and per-`optimise` reuse measured neutral, see the release comment; the saving is the growth between programs.) - DXIL hashes of all 25,689 emitted programs identical to `main`; the single exception across runs was two containers of one compute program that also flip between runs of unmodified `main` (pre-existing nondeterminism, reported as a finding in #2570). Byte-identical output makes validator results identical by construction. - `cargo test -p leonida-shader --lib`: 403 passed, 0 failed (includes the optimiser fuzz test `every_pass_leaves_what_random_programs_store`). - `cargo clippy -p leonida-shader --no-deps --all-targets`: no new warnings (3 pre-existing, the same as `main` on this toolchain). - `python -I scripts/check_no_game_data.py` on the changed file: clean. AI-assisted: Claude Sonnet 5.5
OreoFR commented 2026-12-01 02:11:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T02:11:26Z.


Verified by OreoFR on macOS 27.2.1, Apple M5, Rust (rustup), head edc3edfb0, main bf19719ab. CPU only, no game archive.

MEASURED

  • cargo test --release -p leonida-shader: main 242 passed, 0 failed, 2 ignored; main + this PR (merge-tree, no conflict) 242 passed, 0 failed, 2 ignored. The same counts with --features diagnostics. The build warning count is unchanged (2 / 2).
  • This PR adds no test, so there's no red side: this only shows that nothing the suite covers changed.

READ IN CODE

  • MergeWalk lives in a thread_local! RefCell, borrowed mutably for the whole round loop in optimise. That would panic if optimise re-entered on the same thread, but it doesn't. Outside the tests, the only caller is emit/shader.rs:706, and merge, prune, guards and chains don't call it.
  • known, dom_reads and lane_reads are cleared at the start of every round. repl is cleared and resized to insts.len().
  • path_has_write's visit stamps: seen is resized to blocks.len() per walk, and stamp only grows across programs (it is kept in the walk). A slot left over from a previous program therefore holds an older stamp and can never equal the current mark. On wraparound to 0, seen is zeroed and the stamp restarts at 1. Correct.
  • Key::Call and Key::Gep now hold Rc<[V]>. Equality and hashing go through the slice contents, so keys compare as before. The Rc is not Send, but the walk is thread-local, so that's consistent.

ASSUMED

  • "The DXIL does not change" and the -7 % wall time come from your full-archive run with a local hash instrument. Not reproducible here without the game's archive.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7298340651 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7298340651). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-01T02:11:26Z. --- Verified by OreoFR on macOS 27.2.1, Apple M5, Rust (rustup), head `edc3edfb0`, main `bf19719ab`. CPU only, no game archive. **MEASURED** - `cargo test --release -p leonida-shader`: main 242 passed, 0 failed, 2 ignored; main + this PR (merge-tree, no conflict) 242 passed, 0 failed, 2 ignored. The same counts with `--features diagnostics`. The build warning count is unchanged (2 / 2). - This PR adds no test, so there's no red side: this only shows that nothing the suite covers changed. **READ IN CODE** - `MergeWalk` lives in a `thread_local!` `RefCell`, borrowed mutably for the whole round loop in `optimise`. That would panic if `optimise` re-entered on the same thread, but it doesn't. Outside the tests, the only caller is `emit/shader.rs:706`, and `merge`, `prune`, `guards` and `chains` don't call it. - `known`, `dom_reads` and `lane_reads` are cleared at the start of every round. `repl` is cleared and resized to `insts.len()`. - `path_has_write`'s visit stamps: `seen` is resized to `blocks.len()` per walk, and `stamp` only grows across programs (it is kept in the walk). A slot left over from a previous program therefore holds an older stamp and can never equal the current mark. On wraparound to 0, `seen` is zeroed and the stamp restarts at 1. Correct. - `Key::Call` and `Key::Gep` now hold `Rc<[V]>`. Equality and hashing go through the slice contents, so keys compare as before. The `Rc` is not `Send`, but the walk is thread-local, so that's consistent. **ASSUMED** - "The DXIL does not change" and the -7 % wall time come from your full-archive run with a local hash instrument. Not reproducible here without the game's archive. AI-assisted: Claude Code
fiestorra commented 2026-12-01 02:21:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T02:21:47Z.


Verified on Windows: the crate is green with it, and the tests it touches pass with and without the change - which is what an optimisation is supposed to do, and also why this comment cannot tell you it works.

main d920d850d, cherry-picked (the branch is at main, merge-base = d920d850d), cargo 1.98.1:

cargo test -p leonida-shader
  exit 0 · test result: ok. 403 passed; 0 failed; 5 ignored    (358.89 s)

cargo test -p leonida-shader --lib emit::bitcode::opt
  with this pull request:      17 passed; 0 failed
  with opt.rs from main:       17 passed; 0 failed

So the suite does not distinguish the two trees, and that is the honest finding: "keep the merge walk's tables between" is a claim about work not done, not about answers changed, and a passing suite proves the answers did not change - which is the property you want, and it is not evidence that the tables are kept.

What would be evidence: the merge walk's cost on the same inputs. If the pull request has a measurement in its description, that is what to check, not this - and if it does not, one counter or one timing over a fixed corpus would settle it in a way the 403 tests cannot. opt:: has 17 tests and none of them measures the walk.

What I can say it did not break: 403 tests, 0 failures, 5 ignored, and the crate's slowest suite (358.89 s) is green - including the bitcode emission paths the walk sits in.

AI-assisted: yes - DeepSeek v4.1 (flash), three runs of the shader crate.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7298530952 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7298530952). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T02:21:47Z. --- **Verified on Windows: the crate is green with it, and the tests it touches pass with and without the change - which is what an optimisation is supposed to do, and also why this comment cannot tell you it works.** **`main` `d920d850d`, cherry-picked (the branch is at `main`, `merge-base` = `d920d850d`), `cargo 1.98.1`:** ``` cargo test -p leonida-shader exit 0 · test result: ok. 403 passed; 0 failed; 5 ignored (358.89 s) cargo test -p leonida-shader --lib emit::bitcode::opt with this pull request: 17 passed; 0 failed with opt.rs from main: 17 passed; 0 failed ``` **So the suite does not distinguish the two trees**, **and that is the honest finding**: **"keep the merge walk's tables between" is a claim about work not done, not about answers changed**, **and a passing suite proves the answers did not change - which is the property you want, and it is not evidence that the tables are kept.** **What would be evidence**: **the merge walk's cost on the same inputs.** **If the pull request has a measurement in its description, that is what to check, not this** - **and if it does not, one counter or one timing over a fixed corpus would settle it in a way the 403 tests cannot.** **`opt::` has 17 tests and none of them measures the walk.** **What I can say it did not break**: **403 tests, 0 failures, 5 ignored, and the crate's slowest suite (`358.89 s`) is green** - **including the bitcode emission paths the walk sits in.** **AI-assisted:** yes - DeepSeek v4.1 (flash), three runs of the shader crate. Written with an AI assistant.
ecox982745 commented 2026-12-01 03:13:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-12-01T03:13:38Z.


Independent allocation count and bitcode comparison on native Windows. I built main 90c514437 and the clean merge of edc3edfb0 into it (tree 98e61082e) in Release with Rust 1.98.1/MSVC. Both used the same scratch-only test and the 400 stock random_program seeds.

Each of two fresh processes per tree optimised the whole corpus on one thread in ascending, descending and strided seed order. A thread-local allocator probe counted requests only during Module::optimise(ALL). Its one-allocation control passed. Program generation, interpreter checks and serialization ran outside the counter.

Requests per 400-program sweep Main Main + PR
Allocations, including zeroed 469,760–469,779 390,212–390,225
Reallocations 86,003 85,723–85,729
Total 555,763–555,782 475,935–475,954

That is about 14.4% fewer allocation calls on this synthetic corpus. Every order preserved the unoptimised interpreter stores for three input patterns per seed. The optimized bitcode matched byte for byte across all orders and across both trees, including in fresh processes. This measures allocator calls in the optimiser. Wall time and retained scratch capacity are outside the measurement.

AI-assisted with OpenAI Codex (GPT-6.2 Sol).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7299479255 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7299479255). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-12-01T03:13:38Z. --- Independent allocation count and bitcode comparison on native Windows. I built main `90c514437` and the clean merge of `edc3edfb0` into it (tree `98e61082e`) in Release with Rust 1.98.1/MSVC. Both used the same scratch-only test and the 400 stock `random_program` seeds. Each of two fresh processes per tree optimised the whole corpus on one thread in ascending, descending and strided seed order. A thread-local allocator probe counted requests only during `Module::optimise(ALL)`. Its one-allocation control passed. Program generation, interpreter checks and serialization ran outside the counter. | Requests per 400-program sweep | Main | Main + PR | | --- | ---: | ---: | | Allocations, including zeroed | 469,760–469,779 | 390,212–390,225 | | Reallocations | 86,003 | 85,723–85,729 | | Total | 555,763–555,782 | 475,935–475,954 | That is about 14.4% fewer allocation calls on this synthetic corpus. Every order preserved the unoptimised interpreter stores for three input patterns per seed. The optimized bitcode matched byte for byte across all orders and across both trees, including in fresh processes. This measures allocator calls in the optimiser. Wall time and retained scratch capacity are outside the measurement. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
KelboLive commented 2026-12-01 04:46:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T04:46:12Z.

Review: COMMENTED


Verified on this box, and with the right evidence this time: the Python semantic suite is not evidence for this diff. tests/semantic/support.py:16-17 imports tools/rdna2spirv.py, the Python translator, and never loads the Rust leonida-shader crate; I ran it anyway (553 files / 6,720 tests on both head and 86c30fcea, 0 failed) and it is identical by construction.

What does support the claim:

  • cargo test -p leonida-shader --lib -> 403 passed, 0 failed, 5 ignored (296 s), including every_pass_leaves_what_random_programs_store; matches your number.
  • A differential probe (temporary, added to both worktrees, then reverted): 400 random programs x 7 pass sets (FOLD, REUSE, FACTS, LOADS, FOLD|REUSE, LOADS|FOLD, ALL), hashing Module::write() output after optimise. Head and main identical, 2,800/2,800 lines, combined hash ebacbd16065ce4dc on both. That exercises the retained tables across thousands of programs in one thread, so "the same decisions" holds for the optimiser's own output.

The mechanism reads correctly: every table is cleared before it is read (opt.rs:913-917), the stamp is monotonic with a correct wrap that zeroes seen (885-889), kept <= r makes the in-place body compaction non-destructive (1005-1087), and retention is bounded by the largest module a thread sees, not by the 25,689 programs.

One non-blocking nit: borrow_mut is held across the whole four-round loop (:282-299), including prune/guards/chains, so a future pass that called optimise from inside it would panic on the borrow rather than start a fresh walk — a one-line comment there would save the next reader an hour.

I could not replay the 25,689-program archive (this machine has no work folder with programs, and I did not copy game data), so that part of the body is still your run only.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6125267777 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#pullrequestreview-6125267777). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T04:46:12Z. **Review:** COMMENTED --- Verified on this box, and with the right evidence this time: **the Python semantic suite is not evidence for this diff.** `tests/semantic/support.py:16-17` imports `tools/rdna2spirv.py`, the Python translator, and never loads the Rust `leonida-shader` crate; I ran it anyway (553 files / 6,720 tests on both head and `86c30fcea`, 0 failed) and it is identical by construction. What does support the claim: - `cargo test -p leonida-shader --lib` -> **403 passed, 0 failed, 5 ignored** (296 s), including `every_pass_leaves_what_random_programs_store`; matches your number. - A differential probe (temporary, added to both worktrees, then reverted): 400 random programs x 7 pass sets (`FOLD`, `REUSE`, `FACTS`, `LOADS`, `FOLD|REUSE`, `LOADS|FOLD`, `ALL`), hashing `Module::write()` output after `optimise`. **Head and main identical, 2,800/2,800 lines**, combined hash `ebacbd16065ce4dc` on both. That exercises the retained tables across thousands of programs in one thread, so "the same decisions" holds for the optimiser's own output. The mechanism reads correctly: every table is cleared before it is read (`opt.rs:913-917`), the stamp is monotonic with a correct wrap that zeroes `seen` (`885-889`), `kept <= r` makes the in-place body compaction non-destructive (`1005-1087`), and retention is bounded by the largest module a thread sees, not by the 25,689 programs. One non-blocking nit: `borrow_mut` is held across the whole four-round loop (`:282-299`), including `prune`/`guards`/`chains`, so a future pass that called `optimise` from inside it would panic on the borrow rather than start a fresh walk — a one-line comment there would save the next reader an hour. I could not replay the 25,689-program archive (this machine has no work folder with programs, and I did not copy game data), so that part of the body is still your run only.
merzleckeier commented 2026-12-01 11:58:08 +00:00 (Migrated from github.com)

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


Independent integration check of edc3edfb0 on bf30e2585. emit/bitcode/opt.rs conflicted with the merged hoist and FxHash changes. I resolved it locally by preserving the hoist before each reuse round and using the main branch’s FxHash maps in the reused scratch state.

After that resolution, 246 native Rust shader tests passed and 2 were ignored. On the base and the combined version, 400 synthetic optimizer inputs in forward and reverse order produced byte-identical output across all 800 translations. This checks compatibility of the conflict resolution. Timing was outside this run.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310433304 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7310433304). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T11:58:08Z. --- Independent integration check of `edc3edfb0` on `bf30e2585`. `emit/bitcode/opt.rs` conflicted with the merged hoist and FxHash changes. I resolved it locally by preserving the hoist before each reuse round and using the main branch’s FxHash maps in the reused scratch state. After that resolution, 246 native Rust shader tests passed and 2 were ignored. On the base and the combined version, 400 synthetic optimizer inputs in forward and reverse order produced byte-identical output across all 800 translations. This checks compatibility of the conflict resolution. Timing was outside this run. AI-assisted with OpenAI Codex.
bobcatchris commented 2026-12-01 18:25:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T18:25:47Z.


Merged main (d359a2f85, no rebase/force-push) and resolved the conflict in d3d12/crates/leonida-shader/src/emit/bitcode/opt.rs:

  • Preserved hoist_handles() before each merge() round and switched MergeWalk's maps to FxHashMap<Key, V>.
  • Scoped WALK's RefCell::borrow_mut() strictly around self.merge(...) so hoist_handles/prune/guards/chains cannot hit a re-entrant borrow (addressing @KelboLive's nit).
  • Verified locally on Windows (Rust 1.98.1): cargo test --locked -p leonida-shader --lib bitcode::opt (18 passed, 0 failed) and python -I scripts/check_no_game_data.py (clean).

AI-assisted: Gemini 4 Neon (including an independent read-only reviewer pass).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7320930980 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7320930980). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-12-01T18:25:47Z. --- Merged `main` (`d359a2f85`, no rebase/force-push) and resolved the conflict in `d3d12/crates/leonida-shader/src/emit/bitcode/opt.rs`: - Preserved `hoist_handles()` before each `merge()` round and switched `MergeWalk`'s maps to `FxHashMap<Key, V>`. - Scoped `WALK`'s `RefCell::borrow_mut()` strictly around `self.merge(...)` so `hoist_handles`/`prune`/`guards`/`chains` cannot hit a re-entrant borrow (addressing @KelboLive's nit). - Verified locally on Windows (Rust 1.98.1): `cargo test --locked -p leonida-shader --lib bitcode::opt` (18 passed, 0 failed) and `python -I scripts/check_no_game_data.py` (clean). AI-assisted: Gemini 4 Neon (including an independent read-only reviewer pass).
imShangLi commented 2026-12-02 04:50:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T04:50:58Z.


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

Verdict: PASS. A production-only allocation/performance refactor of the D3D12 shader optimiser's merge walk. It is
behaviour-preserving: the whole leonida-shader suite gives the identical result on the merge base and on the pull
request (246 passed, 0 failed, 2 ignored on both), and it introduces no new test — so there is nothing red/green to
show, and none is claimed.

Head d359a2f8, base the current main (8422def7), merge base 27613ab6, 1 file, +82/−35:
d3d12/crates/leonida-shader/src/emit/bitcode/opt.rs.

1. What it changes

Module::merge (the single dominator-tree walk behind the FOLD/REUSE/FACTS/LOADS passes) rebuilt its scratch
storage on every call. The pull request hoists that scratch into one MergeWalk struct held in a thread_local!,
cleared at the start of every round instead of reallocated, so a thread translating thousands of programs grows the
tables once:

thread_local! {
    static WALK: std::cell::RefCell<MergeWalk> = std::cell::RefCell::new(MergeWalk::default());
}
...
changed |= WALK.with(|w| self.merge(passes, &mut w.borrow_mut()));

merge takes &mut MergeWalk and clears/resizes each table (repl.clear(); repl.resize(...),
walk.known.clear(), …) rather than vec![None; ...] / FxHashMap::default(). Three concrete wins inside it:

  • path_has_write reuses one seen: Vec<u32> with a monotonically bumped stamp (reset only on u32 wrap) instead
    of allocating vec![false; has_write.len()] and a fresh Vec::new() stack on every call.
  • The block body is compacted in place (body[kept] = i; kept += 1; … body.truncate(kept)) instead of building a
    second Vec::with_capacity(body.len()) per block.
  • Key::Call(u32, Vec<V>)/Key::Gep(Ty, V, Vec<V>) become Rc<[V]>, so a key holds its argument list by reference
    count: Key::Call(*f, args.as_slice().into()). Since a walk keeps every key twice (in known and in the block's
    list of what it added), cloning a key is now a refcount bump, not a copy of the list.

The borrow of WALK is taken only around the merge call — the comment notes this is so the other passes
(hoist_handles, prune) cannot hit a re-entrant borrow. Everything in MergeWalk is written and read inside one
merge round; nothing carries over that a later round reads.

2. The new test checks the property that matters

There is no new test. scripts/red_green.py classifies every hunk of the diff as touching production code (none
is a whole test file or a #[cfg(test)]-only hunk), so the red side is "not constructible: the pull request changes no
test". That is the correct outcome for a pure refactor and I did not manufacture a test for it. The property that
matters here — same optimisation decisions, no behavioural drift — is what the full-suite comparison in §3 checks.

3. What the tests do here

python3 -I scripts/red_green.py 2822 --crate leonida-shader (own work-dir and target dir):

Side Result
red not constructible — the pull request changes no test
green (base + pull request merged) cargo ran; 254 tests, all ok, none failed
verdict red not constructible (exit 1 — expected, not a failure of the pull request)

Because red is not constructible, red_green can only report the green side. I therefore ran the whole crate suite
myself on both the merge base and the head, on clean target dirs (see §4 for why clean matters):

Commit cargo test -p leonida-shader
merge base 27613ab6 246 passed; 0 failed; 2 ignored
head d359a2f8 (pr2822) 246 passed; 0 failed; 2 ignored

Identical counts, and the same two tests ignored on both sides (emit::bitcode::tests::bench_write, a benchmark run
only under --ignored; emit::lower::tests::a_missing_value_stays_missing_through_two_live_joins, gated on
LEONIDA_STRICT_JOINS). No regression, no flake.

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

I hit no failure attributable to this pull request. Two things I want on the record:

  • source_hash_tests can fail spuriously when a target dir is shared across worktrees. While iterating I reused
    one CARGO_TARGET_DIR for several checkouts. build.rs bakes LEONIDA_SHADER_SOURCE_HASH into the test binary at
    compile time, but the test recomputes the hash from the src/ on disk at run time, so a stale binary carries a
    baked hash that no longer matches the checked-out tree. This produced
    the_source_hash_leaves_the_test_modules_out / every_test_module_is_built_for_tests_only FAIL on main, on the
    merge base and on the pull request alike. Re-running each commit with its own clean target dir passes 246/246 on
    both sides (§3). It is an artefact of my harness, not of the code under test — and it reproduces on plain main,
    which is what rules out the pull request.
  • The red side cannot be built by design. "red not constructible" is red_green's correct answer to a change with
    no test hunk; it is not a defect in the pull request.

5. What I did not check

  • No GPU and no running title. This is a compiler/optimiser change verified by cargo test only. I did not
    translate any real shader corpus through it, nor run the translated shaders on any GPU. docs/design.md's rule that
    a change be confirmed "by a GPU test, a Mesa/LLVM reference, or a count over the corpus" is not satisfied by
    what I did: I ran no corpus count, so I cannot say whether the refactor leaves translated output bit-identical —
    only that the crate's own unit tests pass unchanged.
  • No Windows build and no cargo clippy/cargo fmt gate; I ran cargo test on Linux only.
  • No performance measurement. The pull request claims an allocation/throughput win ("grows them once"). I verified
    it is structurally fewer allocations by reading the diff, but I did not benchmark it, so I make no claim about
    how large the win is or that it is measurable on any workload.
  • Thread-safety under the real multi-threaded optimise. MergeWalk is per-thread thread_local, which is sound,
    and the borrow is scoped to merge only; but I reasoned about this from the code, I did not run it under a
    multi-threaded stress or a data-race detector.
  • The Rc<[V]> change's effect on the wider crate. Key is pub(crate)-internal to the optimiser, and the full
    suite passes, but I did not audit every construction site of Key::Call/Key::Gep outside opt.rs by hand.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7335323717 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7335323717). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-02T04:50:58Z. --- ## VERIFY-2822 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), no GPU device, no game files **Verdict: PASS.** A production-only allocation/performance refactor of the D3D12 shader optimiser's merge walk. It is behaviour-preserving: the whole `leonida-shader` suite gives the **identical** result on the merge base and on the pull request (246 passed, 0 failed, 2 ignored on both), and it introduces no new test — so there is nothing red/green to show, and none is claimed. Head `d359a2f8`, base the current `main` (`8422def7`), merge base `27613ab6`, **1 file**, +82/−35: `d3d12/crates/leonida-shader/src/emit/bitcode/opt.rs`. ### 1. What it changes `Module::merge` (the single dominator-tree walk behind the `FOLD`/`REUSE`/`FACTS`/`LOADS` passes) rebuilt its scratch storage on every call. The pull request hoists that scratch into one `MergeWalk` struct held in a `thread_local!`, cleared at the start of every round instead of reallocated, so a thread translating thousands of programs grows the tables once: ```rust thread_local! { static WALK: std::cell::RefCell<MergeWalk> = std::cell::RefCell::new(MergeWalk::default()); } ... changed |= WALK.with(|w| self.merge(passes, &mut w.borrow_mut())); ``` `merge` takes `&mut MergeWalk` and clears/resizes each table (`repl.clear(); repl.resize(...)`, `walk.known.clear()`, …) rather than `vec![None; ...]` / `FxHashMap::default()`. Three concrete wins inside it: - `path_has_write` reuses one `seen: Vec<u32>` with a monotonically bumped `stamp` (reset only on `u32` wrap) instead of allocating `vec![false; has_write.len()]` and a fresh `Vec::new()` stack on every call. - The block body is compacted **in place** (`body[kept] = i; kept += 1; … body.truncate(kept)`) instead of building a second `Vec::with_capacity(body.len())` per block. - `Key::Call(u32, Vec<V>)`/`Key::Gep(Ty, V, Vec<V>)` become `Rc<[V]>`, so a key holds its argument list by reference count: `Key::Call(*f, args.as_slice().into())`. Since a walk keeps every key twice (in `known` and in the block's list of what it added), cloning a key is now a refcount bump, not a copy of the list. The borrow of `WALK` is taken only around the `merge` call — the comment notes this is so the other passes (`hoist_handles`, `prune`) cannot hit a re-entrant borrow. Everything in `MergeWalk` is written and read inside one `merge` round; nothing carries over that a later round reads. ### 2. The new test checks the property that matters There is **no new test**. `scripts/red_green.py` classifies every hunk of the diff as touching production code (none is a whole test file or a `#[cfg(test)]`-only hunk), so the red side is "not constructible: the pull request changes no test". That is the correct outcome for a pure refactor and I did not manufacture a test for it. The property that matters here — *same optimisation decisions, no behavioural drift* — is what the full-suite comparison in §3 checks. ### 3. What the tests do here `python3 -I scripts/red_green.py 2822 --crate leonida-shader` (own work-dir and target dir): | Side | Result | |---|---| | red | **not constructible** — the pull request changes no test | | green (base + pull request merged) | cargo ran; **254 tests, all `ok`**, none failed | | verdict | `red not constructible` (exit 1 — expected, not a failure of the pull request) | Because red is not constructible, red_green can only report the green side. I therefore ran the whole crate suite myself on **both** the merge base and the head, on **clean** target dirs (see §4 for why clean matters): | Commit | `cargo test -p leonida-shader` | |---|---| | merge base `27613ab6` | `246 passed; 0 failed; 2 ignored` | | head `d359a2f8` (pr2822) | `246 passed; 0 failed; 2 ignored` | Identical counts, and the same two tests ignored on both sides (`emit::bitcode::tests::bench_write`, a benchmark run only under `--ignored`; `emit::lower::tests::a_missing_value_stays_missing_through_two_live_joins`, gated on `LEONIDA_STRICT_JOINS`). No regression, no flake. ### 4. Any failure I saw, and why it is not this pull request I hit **no failure attributable to this pull request**. Two things I want on the record: - **`source_hash_tests` can fail spuriously when a target dir is shared across worktrees.** While iterating I reused one `CARGO_TARGET_DIR` for several checkouts. `build.rs` bakes `LEONIDA_SHADER_SOURCE_HASH` into the test binary at compile time, but the test recomputes the hash from the `src/` on disk at run time, so a stale binary carries a baked hash that no longer matches the checked-out tree. This produced `the_source_hash_leaves_the_test_modules_out` / `every_test_module_is_built_for_tests_only` FAIL on `main`, on the merge base and on the pull request alike. Re-running each commit with its own **clean** target dir passes 246/246 on both sides (§3). It is an artefact of my harness, not of the code under test — and it reproduces on plain `main`, which is what rules out the pull request. - **The red side cannot be built by design.** "red not constructible" is red_green's correct answer to a change with no test hunk; it is not a defect in the pull request. ### 5. What I did not check - **No GPU and no running title.** This is a compiler/optimiser change verified by `cargo test` only. I did not translate any real shader corpus through it, nor run the translated shaders on any GPU. `docs/design.md`'s rule that a change be confirmed "by a GPU test, a Mesa/LLVM reference, or a count over the corpus" is **not** satisfied by what I did: I ran no corpus count, so I cannot say whether the refactor leaves translated output bit-identical — only that the crate's own unit tests pass unchanged. - **No Windows build** and no `cargo clippy`/`cargo fmt` gate; I ran `cargo test` on Linux only. - **No performance measurement.** The pull request claims an allocation/throughput win ("grows them once"). I verified it is *structurally* fewer allocations by reading the diff, but I did **not** benchmark it, so I make no claim about how large the win is or that it is measurable on any workload. - **Thread-safety under the real multi-threaded `optimise`.** `MergeWalk` is per-thread `thread_local`, which is sound, and the borrow is scoped to `merge` only; but I reasoned about this from the code, I did not run it under a multi-threaded stress or a data-race detector. - **The `Rc<[V]>` change's effect on the wider crate.** `Key` is `pub(crate)`-internal to the optimiser, and the full suite passes, but I did not audit every construction site of `Key::Call`/`Key::Gep` outside `opt.rs` by hand.
MoonEyes commented 2026-12-02 12:27:39 +00:00 (Migrated from github.com)

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


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:7345372858 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7345372858). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:27:39Z. --- 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 14:13:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T14:13:25Z.


Ran natively on Windows 11, head d359a2f85 merged into current main (128648cfe, merges cleanly now, opt.rs auto-merged), Rust 1.98.1 from rust-toolchain.toml, --locked. I looked at what earlier comments did not cover: stale state when the kept tables move between programs of very different sizes, a panic in the middle of a walk, and wall time.

Suite and lint on the merge

Check Result
cargo test -p leonida-shader --lib 428 passed, 0 failed, 9 ignored (3 of the ignored are my throwaway probes below)
cargo clippy -p leonida-shader --no-deps --all-targets 6 warnings, all in emit/valu_tests.rs (from main), none in opt.rs

Kept tables against fresh tables (throwaway tests, not committed)

The reference for each program is the same program optimised on a newly spawned thread, so its MergeWalk starts empty. The program under test is optimised on one long-lived thread that has already run everything before it. I compared Module::write() bytes.

Probe What it does Result
Mixed sizes 400 generated programs in a rotating big / tiny / medium / small order (1 to 638 blocks, so a small program always follows a big one), pass sets rotating through FOLD, REUSE, FACTS, LOADS, FOLD|REUSE, LOADS|FOLD, ALL, with a zero-block Module::default() optimised every 5th program (80 in all) 400/400 byte-identical to the fresh thread
Panic mid-walk, then reuse 200 big programs (4 nested levels) with one operand in the last non-empty block pointed past insts, so resolve panics partway through the walk with the tables already filled (catch_unwind; a backtrace check confirmed every panic came from inside Module::merge). Each panic is followed on the same thread by a smaller valid program 138 panics (the other 62 picked an instruction kind I don't poison and were skipped). After each panic the RefCell was not left borrowed and the next program was byte-identical to the fresh thread, 138/138

So nothing I could provoke leaks from one program into the next. That covers a larger program before a smaller one, a zero-block module (it returns before touching the walk), and a walk abandoned by a panic. The reason is in the code: every table is cleared or resized before it is read, and seen only ever holds stamps older than the next mark.

Wall time (release, synthetic corpus)

Module::optimise(ALL) over the 400 programs above, timing only the optimise loop. 10 repetitions per run, 5 alternating runs per tree, so 50 samples each, on one thread:

main merge
min 109.0 ms 101.5 ms
median 143.5 ms 146.6 ms
mean 155.8 ms 164.1 ms

There's no difference I can call real on this corpus: min is 7 % lower, median 2 % higher, and other jobs were building on the machine. That doesn't contradict the body's full-archive figure (−7 % wall, −20 % kernel), which comes from thousands of real programs where the saving is growth avoided between programs. It just means a small synthetic corpus doesn't show it, and I can't confirm the speedup from here.

Not checked: the full-archive translation and its DXIL hashes (no game data here), multi-threaded optimise, retained memory per thread, and the in-game run asked for above.

GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7348189229 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7348189229). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T14:13:25Z. --- Ran natively on Windows 11, head `d359a2f85` merged into current `main` (`128648cfe`, merges cleanly now, `opt.rs` auto-merged), Rust 1.98.1 from `rust-toolchain.toml`, `--locked`. I looked at what earlier comments did not cover: stale state when the kept tables move between programs of very different sizes, a panic in the middle of a walk, and wall time. **Suite and lint on the merge** | Check | Result | |---|---| | `cargo test -p leonida-shader --lib` | 428 passed, 0 failed, 9 ignored (3 of the ignored are my throwaway probes below) | | `cargo clippy -p leonida-shader --no-deps --all-targets` | 6 warnings, all in `emit/valu_tests.rs` (from `main`), none in `opt.rs` | **Kept tables against fresh tables (throwaway tests, not committed)** The reference for each program is the same program optimised on a newly spawned thread, so its `MergeWalk` starts empty. The program under test is optimised on one long-lived thread that has already run everything before it. I compared `Module::write()` bytes. | Probe | What it does | Result | |---|---|---| | Mixed sizes | 400 generated programs in a rotating big / tiny / medium / small order (1 to 638 blocks, so a small program always follows a big one), pass sets rotating through `FOLD`, `REUSE`, `FACTS`, `LOADS`, `FOLD\|REUSE`, `LOADS\|FOLD`, `ALL`, with a zero-block `Module::default()` optimised every 5th program (80 in all) | 400/400 byte-identical to the fresh thread | | Panic mid-walk, then reuse | 200 big programs (4 nested levels) with one operand in the last non-empty block pointed past `insts`, so `resolve` panics partway through the walk with the tables already filled (`catch_unwind`; a backtrace check confirmed every panic came from inside `Module::merge`). Each panic is followed on the same thread by a smaller valid program | 138 panics (the other 62 picked an instruction kind I don't poison and were skipped). After each panic the `RefCell` was not left borrowed and the next program was byte-identical to the fresh thread, 138/138 | So nothing I could provoke leaks from one program into the next. That covers a larger program before a smaller one, a zero-block module (it returns before touching the walk), and a walk abandoned by a panic. The reason is in the code: every table is cleared or resized before it is read, and `seen` only ever holds stamps older than the next mark. **Wall time (release, synthetic corpus)** `Module::optimise(ALL)` over the 400 programs above, timing only the optimise loop. 10 repetitions per run, 5 alternating runs per tree, so 50 samples each, on one thread: | | `main` | merge | |---|---|---| | min | 109.0 ms | 101.5 ms | | median | 143.5 ms | 146.6 ms | | mean | 155.8 ms | 164.1 ms | There's no difference I can call real on this corpus: min is 7 % lower, median 2 % higher, and other jobs were building on the machine. That doesn't contradict the body's full-archive figure (−7 % wall, −20 % kernel), which comes from thousands of real programs where the saving is growth avoided between programs. It just means a small synthetic corpus doesn't show it, and I can't confirm the speedup from here. Not checked: the full-archive translation and its DXIL hashes (no game data here), multi-threaded `optimise`, retained memory per thread, and the in-game run asked for above. GPUs tested: n/a (CPU-only tests). AI-assisted: yes (Claude Code).
MoonEyes commented 2026-12-02 18:01:16 +00:00 (Migrated from github.com)

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


Triage of head d359a2f85 (merge base 27613ab6b, 369 commits behind; git merge-tree against current main 45dc41f95: no conflicts).

1 file: d3d12/crates/leonida-shader/src/emit/bitcode/opt.rs (+82/-35).

CI green on the head (6 checks).

Existing verification: Verified on this head by @imShangLi (Linux: identical suite result with and without), @Kal0s-design (native, stale-state checks across programs of different sizes), earlier by @OreoFR, @fiestorra and @ecox982745 (identical bitcode on 400 random programs, fewer allocations).

This check: Not re-reviewed in depth: a behaviour-preserving allocation refactor (the merge walk keeps its tables between programs). Identical bitcode over random programs is the right evidence for it.

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 (behaviour-preserving refactor with identical-output evidence).

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353867326 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7353867326). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:01:16Z. --- **Triage of head `d359a2f85` (merge base `27613ab6b`, 369 commits behind; `git merge-tree` against current `main` `45dc41f95`: no conflicts).** 1 file: `d3d12/crates/leonida-shader/src/emit/bitcode/opt.rs` (+82/-35). CI green on the head (6 checks). **Existing verification:** Verified on this head by @imShangLi (Linux: identical suite result with and without), @Kal0s-design (native, stale-state checks across programs of different sizes), earlier by @OreoFR, @fiestorra and @ecox982745 (identical bitcode on 400 random programs, fewer allocations). **This check:** Not re-reviewed in depth: a behaviour-preserving allocation refactor (the merge walk keeps its tables between programs). Identical bitcode over random programs is the right evidence for it. 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** (behaviour-preserving refactor with identical-output evidence). 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:26 +00:00 (Migrated from github.com)

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


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:7354436374 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7354436374). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:21:26Z. --- 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).
MoonEyes commented 2026-12-03 18:03:49 +00:00 (Migrated from github.com)

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


In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2822, #2800, #2664 and #2661 merged into main 09273248c; this PR tested at its current head d359a2f85. 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: 16.8 fps (main alone today: 15.8-17.5); 19.1 frames per 1000 over 100 ms; 6 pauses over 1 s (usual: 1-4).
  • Precompilation took 896 s, against ~160 s for the batches before it on the same cache. Something in this batch changes the translated shaders' cache keys (likely #2822 or #2800, which change the shader optimizer), so every player would rebuild the whole cache once. Not yet isolated per PR.
  • 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:7387538602 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2822#issuecomment-7387538602). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T18:03:49Z. --- In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2822, #2800, #2664 and #2661 merged into main `09273248c`; this PR tested at its current head `d359a2f85`. 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: 16.8 fps (main alone today: 15.8-17.5); 19.1 frames per 1000 over 100 ms; 6 pauses over 1 s (usual: 1-4). - Precompilation took **896 s, against ~160 s** for the batches before it on the same cache. Something in this batch changes the translated shaders' cache keys (likely #2822 or #2800, which change the shader optimizer), so every player would rebuild the whole cache once. Not yet isolated per PR. - 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/2822:upstream-pr/2822'
git switch 'upstream-pr/2822'

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