leonida-gpu: size the submit-path vectors up front #2952

Open
goof787lord wants to merge 3 commits from upstream-pr/2952 into main
goof787lord commented 2026-12-01 21:08:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by goof787lord on 2026-12-01T21:08:57Z.


Sizes the vectors in list::detach and list::detach_parts from the lists named, so they stop regrowing on every submission (allocation is about 11% of submit-thread samples in a perf profile).

No behaviour change. leonida-gpu lib tests: same 4 failures as main (environment). Not measured in-game, so no speedup is claimed. A first version also reserved the declared-writes set; an independent Opus review (read-only) found that over-reserves, so it was dropped.

Clean-room: code only, check_no_game_data clean. AI-assisted: Claude Sonnet 5.5 wrote it, Claude Opus reviewed.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5594585474 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952). Originally posted by [goof787lord](https://github.com/goof787lord) on 2026-12-01T21:08:57Z. --- Sizes the vectors in list::detach and list::detach_parts from the lists named, so they stop regrowing on every submission (allocation is about 11% of submit-thread samples in a perf profile). No behaviour change. leonida-gpu lib tests: same 4 failures as main (environment). Not measured in-game, so no speedup is claimed. A first version also reserved the declared-writes set; an independent Opus review (read-only) found that over-reserves, so it was dropped. Clean-room: code only, check_no_game_data clean. AI-assisted: Claude Sonnet 5.5 wrote it, Claude Opus reviewed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
andrew-ai commented 2026-12-01 21:14:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T21:14:15Z.


Native Windows comparison of base 1fff69129 and PR 4df667e42 using identical local test instrumentation on the actual detach and detach_parts paths. Each batch used closed synthetic command lists, with repeated names in round-robin order. I checked the detached count and the entire returned index sequence. Both matched expectations for every shape on both trees.

The important size here is 5,296 bytes per slot in the temporary taken: Vec<(This, Detached)> on this x64 diagnostics build. Its final capacity in bytes was:

Input entries Distinct lists Base PR
1 1 5,296 5,296
64 64 338,944 338,944
64 4 21,184 338,944
64 1 5,296 338,944

For 64 distinct lists, the base hit a full vector on 7 pushes into taken and 5 into order (counts include the first allocation). On the PR, both vectors allocated up front and no push grew either one. With one list repeated 64 times the base already allocated just one slot in taken; the PR reserved an extra 333,648 bytes. For the separate detach_parts path, the analogous seen reservation rose from 128 to 2,048 bytes in that repeated-list case.

These are vector capacities, not resident-memory or frame-time measurements. The allocation tradeoff depends on how many distinct lists a real submission names. A histogram of total versus distinct list counts would help decide whether the large taken vector should reserve the full input length. No game files used. Coordination claim. AI-assisted with OpenAI Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7325952007 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7325952007). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T21:14:15Z. --- Native Windows comparison of base `1fff69129` and PR `4df667e42` using identical local test instrumentation on the actual `detach` and `detach_parts` paths. Each batch used closed synthetic command lists, with repeated names in round-robin order. I checked the detached count and the entire returned index sequence. Both matched expectations for every shape on both trees. The important size here is **5,296 bytes per slot** in the temporary `taken: Vec<(This, Detached)>` on this x64 diagnostics build. Its final capacity in bytes was: | Input entries | Distinct lists | Base | PR | | ---: | ---: | ---: | ---: | | 1 | 1 | 5,296 | 5,296 | | 64 | 64 | 338,944 | 338,944 | | 64 | 4 | 21,184 | 338,944 | | 64 | 1 | 5,296 | 338,944 | For 64 distinct lists, the base hit a full vector on 7 pushes into `taken` and 5 into `order` (counts include the first allocation). On the PR, both vectors allocated up front and no push grew either one. With one list repeated 64 times the base already allocated just one slot in `taken`; the PR reserved an extra 333,648 bytes. For the separate `detach_parts` path, the analogous `seen` reservation rose from 128 to 2,048 bytes in that repeated-list case. These are vector capacities, not resident-memory or frame-time measurements. The allocation tradeoff depends on how many *distinct* lists a real submission names. A histogram of total versus distinct list counts would help decide whether the large `taken` vector should reserve the full input length. No game files used. [Coordination claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7325846246). AI-assisted with OpenAI Codex (GPT-6).
KelboLive commented 2026-12-01 21:38:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T21:38:05Z.

Review: COMMENTED


The bound is correct: lists.len() is a true upper bound for seen/taken/order, so nothing can truncate, and the distinct-list case stops reallocating (list.rs:483, :590, :591).

Two caveats:

  1. taken is deduplicated and its slot is large (~5.3 KB per the review comment), so 64 namings of one list reserve ~338 KB instead of ~5 KB — and that capacity travels into Held::Run/Job::Run (queue.rs:194-197, queue/behind.rs:1023-1030), so a backed-up queue retains the larger allocation per pending submission. Reserving only order/seen, or capping taken, would keep most of the win without the over-reserve.
  2. Nothing tests detach/detach_parts, so the change is unobservable: I mutated all three capacities to 0 and to len-1 and the suite was unchanged. That is acceptable for a performance hint, but it means the next reader cannot tell the bound is intentional.

Not a correctness blocker. The texture::alias_cast/watch flakes reproduce on base, so they are unrelated; --test-threads=1 is 644/0. Merge is clean.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6140607361 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#pullrequestreview-6140607361). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T21:38:05Z. **Review:** COMMENTED --- The bound is correct: `lists.len()` is a true upper bound for `seen`/`taken`/`order`, so nothing can truncate, and the distinct-list case stops reallocating (`list.rs:483`, `:590`, `:591`). Two caveats: 1. **`taken` is deduplicated and its slot is large** (~5.3 KB per the review comment), so 64 namings of one list reserve ~338 KB instead of ~5 KB — and that capacity travels into `Held::Run`/`Job::Run` (`queue.rs:194-197`, `queue/behind.rs:1023-1030`), so a backed-up queue retains the larger allocation per pending submission. Reserving only `order`/`seen`, or capping `taken`, would keep most of the win without the over-reserve. 2. **Nothing tests `detach`/`detach_parts`**, so the change is unobservable: I mutated all three capacities to 0 and to `len-1` and the suite was unchanged. That is acceptable for a performance hint, but it means the next reader cannot tell the bound is intentional. Not a correctness blocker. The `texture::alias_cast`/`watch` flakes reproduce on base, so they are unrelated; `--test-threads=1` is 644/0. Merge is clean.
merzleckeier commented 2026-12-01 22:04:53 +00:00 (Migrated from github.com)

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


The extra capacity survives detach and is retained by the returned vectors.

I tested 4df667e4272b691fd9537484f66685c11073219e integrated onto main c4ca5761508f136c5530482093bb3053b0bad4fa in Wine 11.22 / VKD3D-Proton 3.1.0 on an RTX 4070 SUPER and AMD Raphael/RADV. The fixture called production detach with real closed D3D12 command lists and measured the capacity of the returned vectors (5288 * detached.capacity() + 8 * order.capacity() bytes on this build). Both adapters gave the same results.

Input Main bytes PR bytes
Empty 0 0
64 null slots 0 338,944
One list repeated 64 times 5,800 338,944
One list and 63 null slots 5,320 338,944
Four distinct lists across 13 non-null slots of 64 21,280 338,944
64 distinct lists 338,944 338,944

Both trees preserved accepted-list ordering in all six cases. A separate detach_parts case checked the same partitioning and ordering around a synthetic wait. The queue-behind path moves these returned vectors into Held::Run, so their capacity can remain live while the job is queued. The fixture measured vector capacity directly. It did not submit the queue job or measure RSS, latency, or how often these input shapes occur.

AI-assisted local testing, independently checked against the raw logs.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7327238503 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7327238503). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T22:04:53Z. --- The extra capacity survives detach and is retained by the returned vectors. I tested `4df667e4272b691fd9537484f66685c11073219e` integrated onto main `c4ca5761508f136c5530482093bb3053b0bad4fa` in Wine 11.22 / VKD3D-Proton 3.1.0 on an RTX 4070 SUPER and AMD Raphael/RADV. The fixture called production `detach` with real closed D3D12 command lists and measured the capacity of the returned vectors (`5288 * detached.capacity() + 8 * order.capacity()` bytes on this build). Both adapters gave the same results. | Input | Main bytes | PR bytes | | --- | ---: | ---: | | Empty | 0 | 0 | | 64 null slots | 0 | 338,944 | | One list repeated 64 times | 5,800 | 338,944 | | One list and 63 null slots | 5,320 | 338,944 | | Four distinct lists across 13 non-null slots of 64 | 21,280 | 338,944 | | 64 distinct lists | 338,944 | 338,944 | Both trees preserved accepted-list ordering in all six cases. A separate `detach_parts` case checked the same partitioning and ordering around a synthetic wait. The queue-behind path moves these returned vectors into `Held::Run`, so their capacity can remain live while the job is queued. The fixture measured vector capacity directly. It did not submit the queue job or measure RSS, latency, or how often these input shapes occur. AI-assisted local testing, independently checked against the raw logs.
MoonEyes commented 2026-12-02 12:32:34 +00:00 (Migrated from github.com)

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


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:7345495097 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7345495097). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:32:34Z. --- 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 15:09:04 +00:00 (Migrated from github.com)

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


RUN (in game, batch of six render-path pull requests), each head merged with git merge --no-ff onto main f45165e15, in one build: #2952 4df667e42, #2969 535c14094, #2877 f98e8ccf9, #2965 c62d57344, #2774 0dea1a13f, #2815 5ac7975c6. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.

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

For reference, the same machine and route rendered 13.3 to 15.2 fps today on main with single pull requests. A Rust build ran beside the game for part of the run, so the fps are a check that nothing fell over, not a measurement of a gain.

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

Limits: one run; free system memory was low (median 1.1 GB); arrival in the world was driven by keys and not checked on pictures. An earlier attempt of the same batch stopped at once because the game window lost focus ("title suspended"); it is not counted.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7349814892 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7349814892). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T15:09:04Z. --- RUN (in game, batch of six render-path pull requests), each head merged with `git merge --no-ff` onto main `f45165e15`, in one build: #2952 `4df667e42`, #2969 `535c14094`, #2877 `f98e8ccf9`, #2965 `c62d57344`, #2774 `0dea1a13f`, #2815 `5ac7975c6`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 14.9, mean 14.2 | | Rendered fps, last 120 s | median 14.6 | For reference, the same machine and route rendered 13.3 to 15.2 fps today on main with single pull requests. A Rust build ran beside the game for part of the run, so the fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch. If one of these pull requests changes its head, this run no longer covers it. Limits: one run; free system memory was low (median 1.1 GB); arrival in the world was driven by keys and not checked on pictures. An earlier attempt of the same batch stopped at once because the game window lost focus ("title suspended"); it is not counted. AI-assisted (Claude Code).
MoonEyes commented 2026-12-02 15:56:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T15:56:45Z.


RUN (independent run on Windows, #2952 head 4df667e42, merged locally into main f45165e15 with git merge --no-ff, as part of a batch of six)

The in-game run of the batch is already posted on this pull request; this comment is the test side only (no game data, no game files).

Red: not applicable. The change only passes capacity hints to Vec::with_capacity in list::detach_parts and list::detach, so nothing observable changes and no test can fail.

Green (whole batch, one tree, Windows 11, debug profile as d3d12.yml runs it):

  • cargo test --workspace --exclude xtask --locked: 1708 passed, 0 failed, 75 ignored (leonida-gpu lib 691 passed / 59 ignored, leonida-shader lib 248 / 2 ignored, leonida app 44, leonida-formats 47, leonida-menu 48, leonida-pe 36).
  • cargo test -p leonida-gpu --features diagnostics --test replay --locked: 1 passed.
  • cargo test -p xtask --locked: 7 passed.
  • Caveat, not from this batch: the leonida-gpu lib fails one test intermittently. In 3 full runs of this tree a different one failed each time (texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers, watch::tests::a_write_opens_the_view_it_goes_through, pipeline::make::tests::overlapping_waits_cost_the_frame_its_budget_once); each passes alone and a later full run was 691/0. On main f45165e15 alone, 2 of 3 runs failed on the alias_cast test and one was 691/0.

Mutations: two reasoned, not run, because they cannot be killed: with_capacity(lists.len()) back to Vec::new() or to with_capacity(0) behaves the same (equivalent mutants). The hint is only an upper bound (taken and order hold at most one entry per non-null list, seen one per list), so it cannot be too small.

Review: no defect. Same pushes in the same order, no unsafe touched, default behaviour identical. The cost is one allocation of lists.len() entries even when every list is null, negligible next to the regrowth it removes. The body claims no speedup and none was measured here either (the ~11% allocation share is from the author's profile, not reproduced).

Not covered: the allocation saving itself (needs a profile on a submit-heavy scene).

Verdict: PARTIAL. Safe and correct by reading, behaviour unchanged, but no test or mutation can pin it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351191075 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7351191075). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T15:56:45Z. --- RUN (independent run on Windows, #2952 head 4df667e42, merged locally into `main` f45165e15 with `git merge --no-ff`, as part of a batch of six) The in-game run of the batch is already posted on this pull request; this comment is the test side only (no game data, no game files). **Red:** not applicable. The change only passes capacity hints to `Vec::with_capacity` in `list::detach_parts` and `list::detach`, so nothing observable changes and no test can fail. **Green** (whole batch, one tree, Windows 11, debug profile as `d3d12.yml` runs it): - `cargo test --workspace --exclude xtask --locked`: 1708 passed, 0 failed, 75 ignored (leonida-gpu lib 691 passed / 59 ignored, leonida-shader lib 248 / 2 ignored, leonida app 44, leonida-formats 47, leonida-menu 48, leonida-pe 36). - `cargo test -p leonida-gpu --features diagnostics --test replay --locked`: 1 passed. - `cargo test -p xtask --locked`: 7 passed. - Caveat, not from this batch: the leonida-gpu lib fails one test intermittently. In 3 full runs of this tree a different one failed each time (`texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers`, `watch::tests::a_write_opens_the_view_it_goes_through`, `pipeline::make::tests::overlapping_waits_cost_the_frame_its_budget_once`); each passes alone and a later full run was 691/0. On `main` f45165e15 alone, 2 of 3 runs failed on the alias_cast test and one was 691/0. **Mutations:** two reasoned, not run, because they cannot be killed: `with_capacity(lists.len())` back to `Vec::new()` or to `with_capacity(0)` behaves the same (equivalent mutants). The hint is only an upper bound (`taken` and `order` hold at most one entry per non-null list, `seen` one per list), so it cannot be too small. **Review:** no defect. Same pushes in the same order, no unsafe touched, default behaviour identical. The cost is one allocation of `lists.len()` entries even when every list is null, negligible next to the regrowth it removes. The body claims no speedup and none was measured here either (the ~11% allocation share is from the author's profile, not reproduced). **Not covered:** the allocation saving itself (needs a profile on a submit-heavy scene). **Verdict: PARTIAL.** Safe and correct by reading, behaviour unchanged, but no test or mutation can pin it. AI-assisted (Claude Code).
MoonEyes commented 2026-12-02 18:29:21 +00:00 (Migrated from github.com)

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


Verification triage of #2952

Head 4df667e42 is already verified: andrew-ai and merzleckeier ran native Windows comparisons, and MoonEyes posted an in-game run and an independent run on this exact head (2026-12-02). The PR merges cleanly. CI has not run on this head: every suite is action_required and needs a maintainer to approve the workflows. No new run here (Windows-only). Verdict: ready once CI is approved and passes (already verified on this head).

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354671115 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7354671115). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:29:21Z. --- **Verification triage of #2952** Head `4df667e42` is already verified: andrew-ai and merzleckeier ran native Windows comparisons, and MoonEyes posted an in-game run and an independent run on this exact head (2026-12-02). The PR merges cleanly. CI has **not run** on this head: every suite is `action_required` and needs a maintainer to approve the workflows. No new run here (Windows-only). **Verdict: ready once CI is approved and passes (already verified on this head).** AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 21:35:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:35:03Z.


RUN (independent run on Windows, head 61f6ec4221caeb28003018bc4ee83d8e840ff544, merged into main 26c152ce321782c6626d28a5c97288f4eeeac020 with git merge --no-ff)

The merge was clean, no conflict. The head is not the one earlier comments tested: it is now 61f6ec422, three commits (078504efa, 4df667e42, 61f6ec422). The last commit drops the up-front reserve of the large taken vector in detach. Net diff against main: d3d12/crates/leonida-gpu/src/list.rs, +5/-2. Vec::with_capacity(lists.len()) for seen in detach_parts and for order in detach, plus a comment on why taken still grows.

Green

  • cargo test -p leonida-gpu --release --locked --lib (in d3d12/, merged tree): 703 passed, 0 failed, 59 ignored.
  • No diagnostics code and no Python test is touched, so --features diagnostics and the Python tests were not run.

Red

  • The PR adds no test, so no test can fail on main's version of the file.
  • Mutation 1: both new with_capacity(lists.len()) replaced by with_capacity(0): suite 703/0, survives. Same class as going back to Vec::new() (not run, same behaviour).
  • The hint is only a capacity, so these are equivalent mutants. They cannot be killed by a behaviour test; only a capacity measurement could pin them.

Review

  • Default behaviour: no switch added, nothing to regenerate in docs/switches.md. Same pushes in the same order, no unsafe touched.
  • Bound: lists.len() is an upper bound for seen and order, so nothing can truncate. Cost is one allocation of at most lists.len() small entries.
  • Earlier reviewer concern (the 5 KB-per-slot taken vector reserved in full and kept alive by the queued job) is addressed by 61f6ec422: taken is no longer reserved. The order capacity still travels with the returned vector; at 8 bytes per entry this is small (64 entries = 512 bytes).
  • Ordering, lifetimes, fences: not affected.
  • Claim: the PR body carries no item ID or issues/14, 1608 or 2570 link. A reviewer comment on the PR links a 2570 claim. Worth adding to the body.
  • Open reviewer questions: the over-reserve question is answered by the last commit. A histogram of total versus distinct list counts per submission was asked for and not posted.
  • Overlap: #3136 also touches leonida-gpu/src/list.rs (timeline/stall attribution); a textual conflict is possible, not tested here.
  • In-game runs: a 330 s batch run (no device loss, no crash) and local fixtures were posted on 4df667e42, not on 61f6ec422. The newest commit changes only a reservation and a comment, but the gate is per exact head.
  • CI: no checks reported on this branch when I looked.

Not covered

  • The allocation saving (about 11% of submit-thread samples, author's profile) was not reproduced; no profile of a submit-heavy scene was run.
  • No in-game run, no RSS or frame-time measurement, no --features diagnostics run.
  • No overlap merge test with #3136.

Verdict: PARTIAL. Correct and safe by reading; lib suite green and behaviour unchanged, but the change is unobservable to tests. In-game run still required on head 61f6ec422 (the posted run covers 4df667e42).

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359486660 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7359486660). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:35:03Z. --- RUN (independent run on Windows, head `61f6ec4221caeb28003018bc4ee83d8e840ff544`, merged into `main` `26c152ce321782c6626d28a5c97288f4eeeac020` with `git merge --no-ff`) The merge was clean, no conflict. The head is not the one earlier comments tested: it is now `61f6ec422`, three commits (`078504efa`, `4df667e42`, `61f6ec422`). The last commit drops the up-front reserve of the large `taken` vector in `detach`. Net diff against `main`: `d3d12/crates/leonida-gpu/src/list.rs`, +5/-2. `Vec::with_capacity(lists.len())` for `seen` in `detach_parts` and for `order` in `detach`, plus a comment on why `taken` still grows. **Green** - `cargo test -p leonida-gpu --release --locked --lib` (in `d3d12/`, merged tree): 703 passed, 0 failed, 59 ignored. - No diagnostics code and no Python test is touched, so `--features diagnostics` and the Python tests were not run. **Red** - The PR adds no test, so no test can fail on `main`'s version of the file. - Mutation 1: both new `with_capacity(lists.len())` replaced by `with_capacity(0)`: suite 703/0, survives. Same class as going back to `Vec::new()` (not run, same behaviour). - The hint is only a capacity, so these are equivalent mutants. They cannot be killed by a behaviour test; only a capacity measurement could pin them. **Review** - Default behaviour: no switch added, nothing to regenerate in `docs/switches.md`. Same pushes in the same order, no unsafe touched. - Bound: `lists.len()` is an upper bound for `seen` and `order`, so nothing can truncate. Cost is one allocation of at most `lists.len()` small entries. - Earlier reviewer concern (the 5 KB-per-slot `taken` vector reserved in full and kept alive by the queued job) is addressed by `61f6ec422`: `taken` is no longer reserved. The `order` capacity still travels with the returned vector; at 8 bytes per entry this is small (64 entries = 512 bytes). - Ordering, lifetimes, fences: not affected. - Claim: the PR body carries no item ID or issues/14, 1608 or 2570 link. A reviewer comment on the PR links a 2570 claim. Worth adding to the body. - Open reviewer questions: the over-reserve question is answered by the last commit. A histogram of total versus distinct list counts per submission was asked for and not posted. - Overlap: #3136 also touches `leonida-gpu/src/list.rs` (timeline/stall attribution); a textual conflict is possible, not tested here. - In-game runs: a 330 s batch run (no device loss, no crash) and local fixtures were posted on `4df667e42`, not on `61f6ec422`. The newest commit changes only a reservation and a comment, but the gate is per exact head. - CI: no checks reported on this branch when I looked. **Not covered** - The allocation saving (about 11% of submit-thread samples, author's profile) was not reproduced; no profile of a submit-heavy scene was run. - No in-game run, no RSS or frame-time measurement, no `--features diagnostics` run. - No overlap merge test with #3136. **Verdict: PARTIAL.** Correct and safe by reading; lib suite green and behaviour unchanged, but the change is unobservable to tests. In-game run still required on head `61f6ec422` (the posted run covers `4df667e42`). AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
OreoFR commented 2026-12-02 22:53:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T22:53:49Z.


In-game run (batch with #2891, #2892, #2911, #2965 on main f3865cae87, merged --no-ff): PASS

  • head 61f6ec4221
  • RTX 4070 Laptop 8 GB, driver 621.40, Series S, no DLSS, no frame generation, BAR 0, texture budget 1024; 300 s in the world walking (W + J/L turns), 0 device removed, no crash, clean close; 25.2 fps / 39.7 ms over the last 296 s.

AI-assisted (oreofr-agent)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361300200 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7361300200). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T22:53:49Z. --- In-game run (batch with #2891, #2892, #2911, #2965 on main f3865cae87c963952067743a2684a9c2c3aaea5b, merged --no-ff): **PASS** - head 61f6ec4221caeb28003018bc4ee83d8e840ff544 - RTX 4070 Laptop 8 GB, driver 621.40, Series S, no DLSS, no frame generation, BAR 0, texture budget 1024; 300 s in the world walking (W + J/L turns), 0 device removed, no crash, clean close; 25.2 fps / 39.7 ms over the last 296 s. AI-assisted (oreofr-agent)
fiestorra commented 2026-12-03 03:04:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:04:57Z.


VERIFY-2952 — Windows nativo: 41 tests de list pasan, y el cambio es una reserva, no un comportamiento

Cinco líneas en d3d12/crates/leonida-gpu/src/list.rs:

cargo test -p leonida-gpu --lib list     41 passed; 0 failed; 8 ignored

Y el diff es exactamente lo que su título dice: Vec::new() → Vec::with_capacity(lists.len()) para seen, order reservado entero, y un comentario que explica por qué la reserva no es la misma para los dos — taken se deduplica, sus huecos son grandes (unos 5 KB) y crece según se encuentran listas; order tiene una entrada pequeña por nombrado.

Lo que puedo decir de un cambio así, que es honesto y no es mucho: no hay comportamiento que verificar — ningún test puede distinguir Vec::new() de Vec::with_capacity(n) en el resultado; la única diferencia es cuántas veces se realoja. Los 41 tests prueban que no rompe nada, que es todo lo que un cambio de reserva puede prometer.

Y una cosa que sí vale la pena decir: el comentario del cambio es mejor que el cambio — dice cuál de los dos vectores se reserva y por qué el otro no, que es la parte que se pierde en un «size vectors up front» genérico; quien lea esto en seis meses sabrá si puede hacer lo mismo con el siguiente Vec::new() que encuentre.

Lo que no probé: que la reserva mejore el tiempo — haría falta un perfil de una escena con muchas listas, y eso necesita el título.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366179731 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2952#issuecomment-7366179731). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T03:04:57Z. --- ## VERIFY-2952 — Windows nativo: 41 tests de `list` pasan, y el cambio es una reserva, no un comportamiento **Cinco líneas en `d3d12/crates/leonida-gpu/src/list.rs`**: ``` cargo test -p leonida-gpu --lib list 41 passed; 0 failed; 8 ignored ``` **Y el diff es exactamente lo que su título dice**: **`Vec::new()` → `Vec::with_capacity(lists.len())` para `seen`**, **`order` reservado entero**, **y un comentario que explica por qué la reserva no es la misma para los dos** — **`taken` se deduplica, sus huecos son grandes (unos 5 KB) y crece según se encuentran listas; `order` tiene una entrada pequeña por nombrado.** **Lo que puedo decir de un cambio así, que es honesto y no es mucho**: **no hay comportamiento que verificar** — **ningún test puede distinguir `Vec::new()` de `Vec::with_capacity(n)` en el resultado**; **la única diferencia es cuántas veces se realoja.** **Los 41 tests prueban que no rompe nada, que es todo lo que un cambio de reserva puede prometer.** **Y una cosa que sí vale la pena decir**: **el comentario del cambio es mejor que el cambio** — **dice *cuál* de los dos vectores se reserva y *por qué* el otro no**, **que es la parte que se pierde en un «size vectors up front» genérico**; **quien lea esto en seis meses sabrá si puede hacer lo mismo con el siguiente `Vec::new()` que encuentre.** **Lo que no probé**: **que la reserva mejore el tiempo** — **haría falta un perfil de una escena con muchas listas, y eso necesita el título.** Written with an AI assistant.
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/2952:upstream-pr/2952'
git switch 'upstream-pr/2952'

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