leonida-gpu: size the submit-path vectors up front #2952
Open
github-bot
wants to merge 3 commits from
github-bot/gh-2952 into main
AGit
pull from: github-bot/gh-2952
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2952
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2952"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@goof787lord on GitHub · 2026-12-01 21:08 UTC · original
goof787lord:d3d12-submit-allocs→main· +5 −2 · 1 files · 3 commits · openSizes 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
@andrew-ai on GitHub · 2026-12-01 21:14 UTC · original
Native Windows comparison of base
1fff69129and PR4df667e42using identical local test instrumentation on the actualdetachanddetach_partspaths. 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:For 64 distinct lists, the base hit a full vector on 7 pushes into
takenand 5 intoorder(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 intaken; the PR reserved an extra 333,648 bytes. For the separatedetach_partspath, the analogousseenreservation 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
takenvector should reserve the full input length. No game files used. Coordination claim. AI-assisted with OpenAI Codex (GPT-6).@KelboLive on GitHub · 2026-12-01 21:38 UTC · original · reviewed
The bound is correct:
lists.len()is a true upper bound forseen/taken/order, so nothing can truncate, and the distinct-list case stops reallocating (list.rs:483,:590,:591).Two caveats:
takenis 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 intoHeld::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 onlyorder/seen, or cappingtaken, would keep most of the win without the over-reserve.detach/detach_parts, so the change is unobservable: I mutated all three capacities to 0 and tolen-1and 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/watchflakes reproduce on base, so they are unrelated;--test-threads=1is 644/0. Merge is clean.@merzleckeier on GitHub · 2026-12-01 22:04 UTC · original
The extra capacity survives detach and is retained by the returned vectors.
I tested
4df667e4272b691fd9537484f66685c11073219eintegrated onto mainc4ca5761508f136c5530482093bb3053b0bad4fain Wine 11.22 / VKD3D-Proton 3.1.0 on an RTX 4070 SUPER and AMD Raphael/RADV. The fixture called productiondetachwith 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.Both trees preserved accepted-list ordering in all six cases. A separate
detach_partscase checked the same partitioning and ordering around a synthetic wait. The queue-behind path moves these returned vectors intoHeld::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 on GitHub · 2026-12-02 12:32 UTC · original
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:mainSHA it was merged onto;mainalone 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 on GitHub · 2026-12-02 15:09 UTC · original
RUN (in game, batch of six render-path pull requests), each head merged with
git merge --no-ffonto mainf45165e15, in one build: #29524df667e42, #2969535c14094, #2877f98e8ccf9, #2965c62d57344, #27740dea1a13f, #28155ac7975c6. 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.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 on GitHub · 2026-12-02 15:56 UTC · original
RUN (independent run on Windows, #2952 head
4df667e42, merged locally intomainf45165e15withgit 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_capacityinlist::detach_partsandlist::detach, so nothing observable changes and no test can fail.Green (whole batch, one tree, Windows 11, debug profile as
d3d12.ymlruns 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.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. Onmainf45165e15alone, 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 toVec::new()or towith_capacity(0)behaves the same (equivalent mutants). The hint is only an upper bound (takenandorderhold at most one entry per non-null list,seenone 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 on GitHub · 2026-12-02 18:29 UTC · original
Verification triage of #2952
Head
4df667e42is 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 isaction_requiredand 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
@MoonEyes on GitHub · 2026-12-02 21:35 UTC · original
RUN (independent run on Windows, head
61f6ec4221caeb28003018bc4ee83d8e840ff544, merged intomain26c152ce321782c6626d28a5c97288f4eeeac020withgit 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 largetakenvector indetach. Net diff againstmain:d3d12/crates/leonida-gpu/src/list.rs, +5/-2.Vec::with_capacity(lists.len())forseenindetach_partsand fororderindetach, plus a comment on whytakenstill grows.Green
cargo test -p leonida-gpu --release --locked --lib(ind3d12/, merged tree): 703 passed, 0 failed, 59 ignored.--features diagnosticsand the Python tests were not run.Red
main's version of the file.with_capacity(lists.len())replaced bywith_capacity(0): suite 703/0, survives. Same class as going back toVec::new()(not run, same behaviour).Review
docs/switches.md. Same pushes in the same order, no unsafe touched.lists.len()is an upper bound forseenandorder, so nothing can truncate. Cost is one allocation of at mostlists.len()small entries.takenvector reserved in full and kept alive by the queued job) is addressed by61f6ec422:takenis no longer reserved. Theordercapacity still travels with the returned vector; at 8 bytes per entry this is small (64 entries = 512 bytes).leonida-gpu/src/list.rs(timeline/stall attribution); a textual conflict is possible, not tested here.4df667e42, not on61f6ec422. The newest commit changes only a reservation and a comment, but the gate is per exact head.Not covered
--features diagnosticsrun.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 covers4df667e42).AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
@OreoFR on GitHub · 2026-12-02 22:53 UTC · original
In-game run (batch with #2891, #2892, #2911, #2965 on main
f3865cae87, merged --no-ff): PASS61f6ec4221AI-assisted (oreofr-agent)
@fiestorra on GitHub · 2026-12-03 03:04 UTC · original
VERIFY-2952 — Windows nativo: 41 tests de
listpasan, y el cambio es una reserva, no un comportamientoCinco líneas en
d3d12/crates/leonida-gpu/src/list.rs:Y el diff es exactamente lo que su título dice:
Vec::new()→Vec::with_capacity(lists.len())paraseen,orderreservado entero, y un comentario que explica por qué la reserva no es la misma para los dos —takense deduplica, sus huecos son grandes (unos 5 KB) y crece según se encuentran listas;ordertiene 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()deVec::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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.