WIP: D3D12-WARM-MASKED-TWINS: note masked twins in the pipeline book, so the precompile makes them #2957
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/2957:github-pr/2957" git switch "github-pr/2957"
Draft
leonida/mandy
johnabrea wants to merge 2 commits from
github-pr/2957 into main
pull from: github-pr/2957
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/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/2952
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!2957
Loading…
Reference in a new issue
No description provided.
Delete branch "github-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?
This pull request is marked as a work in progress.
This pull request cannot be merged because it is marked as being a work in progress.
Reviewers 0 approvals
Details
This pull request can be merged automatically.
This pull request is marked as a work in progress.
This pull request cannot be merged because it is marked as being a work in progress.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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 65f372c08 this 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
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.
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).
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.
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.
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.
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