D3D12-WARM-MASKED-TWINS: note masked twins in the pipeline book, so the precompile makes them #2957
Closed
johnabrea wants to merge 1 commit from
upstream-pr/2957 into main
pull from: upstream-pr/2957
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
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.
Reference
ProjectLeonida/mandy!2957
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2957"
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?
Imported from ubiquitarianism/leonida. Originally posted by johnabrea on 2026-12-01T21:22:18Z.
Claimed in the coordination issue as: D3D12-WARM-MASKED-TWINS (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7326001250)
What and why
Since
65f372c08("gpu: honor coverage on the first masked draw"), the first draw under the console's sample mask builds its masked twin before the draw is recorded (make::masked_for), so the frame waits for that compile. This is correct for the picture. But the precompile never makes a twin:library::note_used), so it is inearly-pipelines.txt;known-pipelines.binholds only the title's own pipelines (known::noteis called fromhand_outalone), soleonida warm --usedhas no entry for that key.As a result, every twin is compiled in play, once per translation or driver change, and each one stalls the frame. On a fork that had merged
65f372c08this showed up as constant hitching right after an update. Reverting the commit there removed the hitching.This change:
host_pipeline_maskednotes the twin in the book (known::note) when it is first created, under the twin's own key, the one the used list names.0x80set on its stage number, followed by the mask's position row after the hash (u32::MAXforNone).parsemakesShader::maskedwith that mask, so the warm translates and builds the same pipeline the draw would.STAGES.getmisses); all other entries are unaffected. Old files read as before.Not covered: a twin made for differing bound formats (
make::variant) is noted as used under the variant's key, which the book does not hold. The plain pipelines' format variants have the same gap today.Tested
pipeline::known::tests::a_masked_twin_comes_back_masked: writes an entry with a masked pixel shader (position rowSome(3)andNone) and reads it back with the mask intact; an entry cut inside the position row is refused. Onmainthis test does not build (put_shaderis new), andmain'sparserefuses the0x81stage byte.cargo test -p leonida-gpu --lib --locked: 644 passed, 1 failed (watch::tests::what_the_kernel_writes_through_is_not_guarded_for_another_view, a file this PR does not touch). That test passed when run alone right after.scripts/build-nvidia.ps1(diag, with DLSS) builds.GPUs tested: NVIDIA GeForce RTX 5080, driver 621.40, Windows 11 Pro 26200 (unit tests only so far)
AI-assisted: yes. Claude Code with Claude Opus 5.5 wrote the change. Not yet reviewed by a separate reviewer agent; that will happen before this leaves draft.
Checklist
mainand merges cleanly.check_no_game_data.pyon the changed files).docs/design.md(n/a: no translator change).🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T21:33:57Z.
The recorded masked twin rebuilt in a fresh process on both adapters. I tested
699ff016on1fff69129with Wine 11.22 / VKD3D-Proton 3.1.0, using RTX 4070 SUPER (620.73.4) and Radeon RADV (26.3.1).A synthetic graphics pipeline exercised the production
host_pipeline_maskedpath twice with identical bound and declared render-target formats. Both arms created the plain and masked D3D12 PSOs. Main wrote one book entry. With this PR the book contained the plain entry and one masked entry (stage0x81, row0), sharing the same two underlying shader containers.I applied current #2654 (
f4ae7b92) to both replay arms because Wine needs the empty-library fix to saveearly-pipelines.txt. Both arms then saved the same masked key in the early list. With #2654 alone a fresh process found no corresponding book entry. With this PR it selected one entry and the productionknown::makepath built that masked PSO on both adapters.Cross-reading the books also behaved as described. The new reader made the plain entry from the older book. The older reader made the plain entry from the new book and declined only the masked entry. The three stock book tests passed. The fixture substituted DXC-compiled HLSL at the shader-translation boundary. It did not issue a draw or measure game stalls.
MEASURED with synthetic inputs, OpenAI Codex and independent raw-log verification.
Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T21:35:45Z.
Verified on-disk compatibility across an upgrade, rollback, and second upgrade on Windows. I built separate test executables from base
1fff69129and head699ff0167. Five separate processes shared one temporary cache. I used synthetic vertex and pixel containers with the production note, flush, record walkers and parser.Base wrote one plain record. The PR appended two masked records interleaved with two ordinary ones. Base reopened the same files, skipped precisely the two masked entries, and decoded each following plain record. A separate base process then appended a sixth ordinary record. When the PR reopened the book it decoded all six IDs in order, including both masks (no position row and row 3 respectively) and the ordinary record appended after rollback. All five runs also checked the shader container bytes read from disk.
This verifies record compatibility and append behavior. Driver compilation and in-game frame times were outside this check. Coordination claim. AI-assisted with OpenAI Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by matthieupl87-spec on 2026-12-02T00:13:08Z.
Retail run of the three steps from the description, at
699ff0167, diag build viabuild-nvidia.ps1. The build has one local commit outside this PR, inrun.rs, unrelated to pipelines.Rig: Ryzen 5 5600X (6 cores), 32 GB DDR4-3600, RTX 5070 Ti 16 GB, driver 621.40, Windows 11 Pro 26300. Series X profile, the title's own upscaler, 16:9, story save, the same cache folder throughout.
Steps:
warm --usedran before the window came up (about 2 min).warm-done.txtwent from 18,906 to 19,864 lines.From the logs (
host pipeline library savedat each run's end; masked twins counted from thehost mesh pipeline shaders=[…, pixel … masked]lines):made=(compiled in play)loaded=started_early=started_earlygrew by 205 andloadedby 282, whilemadedid not grow (229, including 66 twins never seen in run 1). This fits the twins being built by the precompile and loaded from the library, not compiled in play.host … pipeline shaders=line is logged for loaded and compiled pipelines alike, so I could not tell twin by twin which were loaded. A log line or counter for "masked twin compiled in play" would make this check direct.Frame pacing (frame-time log, 5 s windows): frames over 1 s: 48 in run 1, 48 in run 2. Frames over 100 ms: 369 and 871 (run 2 was longer and went through busier places). Window-title fps: median 14 in both, p90 14 and 28. This machine is CPU-bound (GPU about 20–30 % busy), so the hitches are not mainly pipeline compiles here, and these numbers neither confirm nor rule out a pacing gain.
No crash in either run; both windows were closed normally.
AI-assisted (Claude Code). Numbers from my own runs; no logs or game data attached.
Imported from ubiquitarianism/leonida. Originally posted by NAbobo101 on 2026-12-02T22:52:01Z.
Controlled before/after numbers for the idea of this PR, from a local implementation of the same thing (not this PR's head): masked twins noted when first made, then made by the precompile and put into the pipeline library. Same save restored before every run and the same scripted route, so the runs can be compared.
Rig: Ryzen 7 5700G, 32 GB, RTX 5060 8 GB, driver 621.40, Windows 11 Pro 26300. Base
mainat45dc41f95, diag build, Series X with the title's dynamic resolution,LEONIDA_PIPELINE_WAIT_MS=0. Each run: the same save copied back in, the world loaded, then about 9.5 minutes of a fixed key route (walk, step back, turn).made=(compiled in play, whole session)loaded=started_early=mainmade=is the count that tells compiled from loaded, which thehost ... pipeline shaders=lines cannot. With the same save and route it went from 165 to 14.Frame pacing did not change in a way I can separate from noise on this route: frames over 100 ms were 111, 59, 53 and 78 (the reference and run 1 should behave the same, and differ by 2x). At this spot the twins mostly came out of the driver's cache in about 15 ms each, so removing them from the list thread saves little. The gain should show where a twin is compiled cold (16 new twins made later took a median of 721 ms each), that is in new places and after a translator or driver change.
Two things this does not cover, seen in run 2 (details in #3200):
Locally I tried two follow-ups for that: the precompile makes the twin of every title pipeline an earlier run drew with (the position row taken from the vertex or mesh shader's translation), into the library; and, opt-in, the twins of every known pipeline for the driver's cache only, kept out of the library like the never-drawn title pipelines. I am measuring the second one now and can post the numbers if useful.
AI-assisted: summary prepared with help from Claude Code (Claude Opus 5.5). Numbers from my own runs' logs; no logs or game data attached.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T04:17:22Z.
VERIFY-2957 — cherry-pick limpio y 716/1, con el 1 de esta máquina
El 1 es la falla de la iGPU, la misma que en
mainsin la PR; 716 contra 715 es el test que añade.Y el cambio encaja con lo que vi esta noche en dos PRs más: anota en el libro de pipelines los «gemelos enmascarados» — pipelines que difieren sólo en la máscara de estados de render, que es el mismo problema que
#3284(formatos enlazados) y#2892(joins de descriptores): la clave de caché de una pipeline no incluye algo que la hace distinta, y el juego la vuelve a compilar o la reutiliza mal.Tres PRs, tres autores, la misma propiedad: la identidad de una pipeline depende de más cosas que el shader. Y
#3284,#2892y este, juntos, son la respuesta completa a una pregunta que ninguno de los tres se hizo solo.Lo que no verifiqué: que el juego cree los gemelos enmascarados — los tests del libro cubren la anotación, no el título; y una segunda ejecución que no recompile es la prueba que hace falta y necesita la GPU y el juego.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T18:03:54Z.
Thanks for starting this. It has been a draft with no new commit, comment or review for more than 5 hours, so I am closing it to keep the open list manageable. Nothing is lost: when it is ready, merge the latest
maininto the branch and reopen it, or open a new pull request that links this one. No promise about review timing or outcome.Generated by Claude Code
Pull request closed