leonida-gpu: size the submit-path vectors up front #2952
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/2952:github-pr/2952" git switch "github-pr/2952"
Open
leonida/mandy
goof787lord wants to merge 3 commits from
github-pr/2952 into main
pull from: github-pr/2952
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
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
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2952
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/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?
This branch is out-of-date with the base branch
Reviewers 0 approvals
Details
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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
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).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.
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).
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).
RUN (independent run on Windows, #2952 head 4df667e42, merged locally into
mainf45165e15 withgit 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. Onmainf45165e15 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 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).
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
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.
In-game run (batch with #2891, #2892, #2911, #2965 on main f3865cae87c963952067743a2684a9c2c3aaea5b, merged --no-ff): PASS
AI-assisted (oreofr-agent)
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.
orderandseenget one small slot per naming, whiletaken(about 5 KB a slot, deduplicated) is left to grow: that is the right split, and the comment says why. No objection.