D3D12-WARM-MASKED-TWINS: note masked twins in the pipeline book, so the precompile makes them #2957
Closed
github-bot
wants to merge 1 commit from
github-bot/gh-2957 into main
AGit
pull from: github-bot/gh-2957
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!2957
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@johnabrea on GitHub · 2026-12-01 21:22 UTC · original
johnabrea:d3d12-warm-masked→main· +63 −6 · 2 files · 1 commits · closed without mergingClaimed in the coordination issue as: D3D12-WARM-MASKED-TWINS (#2570)
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
@merzleckeier on GitHub · 2026-12-01 21:33 UTC · original
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.
@andrew-ai on GitHub · 2026-12-01 21:35 UTC · original
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).
@matthieupl87-spec on GitHub · 2026-12-02 00:13 UTC · original
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.
@NAbobo101 on GitHub · 2026-12-02 22:52 UTC · original
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.
@fiestorra on GitHub · 2026-12-03 04:17 UTC · original
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.
@MoonEyes on GitHub · 2026-12-03 18:03 UTC · original
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