d3d12: a ceiling on the time of all of a frame's texture passes, opt-in (D3D12-TEXTURE-FRAME-MS) #3291
Open
github-bot
wants to merge 6 commits from
github-bot/gh-3291 into main
AGit
pull from: github-bot/gh-3291
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!3291
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3291"
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?
@OreoFR on GitHub · 2026-12-03 04:01 UTC · original
OreoFR:perf/texture-frame-ms→main· +280 −9 · 3 files · 6 commits · openItem: D3D12-TEXTURE-FRAME-MS (claimed in #2570).
What and why
The texture pass (
State::heap_textures) runs once per list. Each run has its own time limit (LEONIDA_TEXTURE_STAGE_MS, 250 ms) and there is a byte budget per frame. So while the world streams, one frame's passes together can take far longer than any one of them.LEONIDA_TEXTURE_FRAME_MS=<ms>caps their sum:during catch-up the cap is three times the value, as the span is;
what does not fit waits for the next frame;
early runs and bakes keep their own budgets.
Switch:
LEONIDA_TEXTURE_FRAME_MS=<ms>. Unset or 0 means off, as before.d3d12/docs/switches.mdis regenerated.Credit: written from the idea of TrustNo1/Darner's
DARNER_TEXSPK_PASS_MS(codefloe.com/TrustNo1/Darner, GPL-3.0-or-later like this repository; 8 ms in its launcher). The code here is our own.Darner's own number (theirs, not measured here): 39.4 → 47.0 fps walking on an RTX 4090.
Tested
cargo test -q -p leonida-gpu: 718 passed, 0 failed, 59 ignored. This includes the unit tests for the parsing and for the span left.cargo clippy -q -p leonida-gpu --all-targets -- -D warnings: clean.python -I tools/d3d12_switches.py --check d3d12/docs/switches.md: OK.scripts/check_no_game_data.pyon the changed files: OK.Branch: the change merged with main
516c9eaab.In game, PROVISIONAL. RTX 4070 Laptop 8 GB, driver 621.40, Windows 11, on the commit before the merge with the latest main.
-SeriesS -NoDlss -NoFrameGen -PrecompileUsed, BAR 0, texture budget 1024), runs in the order A B A B in one session, median frame time over the last 240 s.LEONIDA_TEXTURE_FRAME_MS=8n=2, within the gate's usual noise. The longer worst frames with the switch need a look before any default: one possibility is the deferred work landing in a single later frame.
AI-assisted (oreofr-agent, Claude Code).
🤖 Generated with Claude Code
@merzleckeier on GitHub · 2026-12-03 04:07 UTC · original · reviewed
Reviewed
188fc7faon516c9eaa. The two parser and span tests pass when compiled on Linux. I also ran two deterministic CPU-only fixtures using the same counter operations.heap_texturesreadsSPENT_NSbefore the loop and charges it only on exit. The once-per-frame guard inheap_buffersis per host heap, so different list workers can read the same remainder. In the barrier fixture, two passes each got the full 8 ms and charged 12 ms in total. Also, a frame N pass finishing after frame N+1 resets the counter charges its elapsed time to N+1. In the rollover fixture that left 1 ms of a fresh 8 ms budget before the new frame had done any work. A frame-scoped reservation or a single budget owner would make both the admission and the charge use the same frame.beganis set after the remap and due-queue work. Even at zero available span,texture_slots_duescans and sorts the due slots under the heap lock, then scans again for the census. This per-pass work is neither gated nor charged. Please avoid expensive preparation once the budget is exhausted where the queue semantics allow it, and describe the boundary as a soft limit at slot boundaries.These fixtures cover time accounting on the CPU. I did not run the Windows renderer. AI-assisted with OpenAI Codex.
@OreoFR on GitHub · 2026-12-03 04:15 UTC · original
Thanks @merzleckeier, both P2s are fixed in
288c4a81c.FrameTimeis now the frame's single time owner: one atomic word holding the frame's number and the microseconds reserved or taken.FrameTimeGuard'sDrop, on every return path): unused time goes back, overrun past the slice (at most one slot) is charged, and a settle for a frame that has ended is dropped.texture_slots_due's scan and sort and the census. Those passes are counted inHEAP_TEXTURES_FRAME_SPENT, and the slots stay due. The doc now calls the switch a soft limit, checked at slot boundaries.cargo test -p leonida-gpupasses 720. Clippy-D warningsis clean, and switches.md is unchanged and checked. Counter-tests: reverting each piece fails its tests (3, 1 and 2).(oreofr-agent, AI-assisted)
@merzleckeier on GitHub · 2026-12-03 04:17 UTC · original · reviewed
Rechecked
288c4a81on516c9eaa. All four CPU accounting tests pass, and the exhaustion return now precedes the queue scan. The fixes cover simultaneous reservations within a frame and a previous frame settling late.[P2] Reject delayed reservations from frames that have already advanced.
heap_texturessnapshotsframe::current()beforeFrameTime::reserve. If a list worker pauses between those operations and a different worker has already reserved for the next frame,reservetreats the older tag as a fresh frame and overwrites the newer reservation. Using the exact PR bookkeeping code, I held 3 ms in frame 11, then calledreservewith a delayed frame 10 snapshot. Frame 10 took 8 ms, and the next frame 11 pass received 8 ms rather than the 5 ms remaining. This is a delayed reservation, distinct from the covered delayed settlement.Please keep the active frame tag monotonic inside the compare-and-swap loop so a stale caller cannot move it backward. I tested a wrap-aware age check in the CPU fixture. All four PR tests and the two cases for a stale reservation and a 32-bit tag wrap passed with that control.
CPU-only checks. AI-assisted with OpenAI Codex.
@OreoFR on GitHub · 2026-12-03 04:26 UTC · original
Thanks @merzleckeier, fixed in
a643d5aec.The frame in
FrameTime's word now only moves forward. Areservewhose frame is older than the word's gets nothing and leaves the word as it is; only a newer frame starts afresh. The comparison (FrameTime::older) wraps the 32-bit frame numbers, and the empty word'su32::MAXcounts as the frame just before 0.Tests:
a_late_reservation_of_an_ended_frame_gets_nothingis your case: frame 11 holds 3 ms, the delayed frame-10 reserve getsNone, and frame 11 still has 5 ms. It also checks the order across the 32-bit wrap.cargo test -p leonida-gpu: 721 passed. clippy-D warnings: clean.(oreofr-agent, AI-assisted)
@merzleckeier on GitHub · 2026-12-03 04:28 UTC · original
Rechecked
a643d5ae. All five accounting tests pass when compiled on Linux. I also seeded an occupied allocator word just before the 32-bit wrap and checked the transition from frameu32::MAXto frame 0. A delayed reservation and a late settlement from the old frame leave frame 0’s reservation intact. Returning unused time from frame 0 still works.Removing the older-frame check in the CPU fixture makes the new regression fail again. This resolves my remaining frame-accounting finding. I did not repeat the renderer timing runs. AI-assisted with OpenAI Codex.
@fiestorra on GitHub · 2026-12-03 04:46 UTC · original
VERIFY-3291 — 719/1, misma falla de la iGPU, y este cambio es de los que necesitan una tabla
719 contra 715: cuatro tests nuevos.
El cambio: un techo al tiempo total de todas las pasadas de textura de un frame, opt-in — o sea, «si este frame lleva más de X en texturas, deja de hacer las que queden y sigue con lo que hay».
Y es el tipo de cambio donde un techo mal puesto es peor que ninguno: un límite que se dispara en el frame correcto ahorra un tirón; uno que se dispara siempre deja texturas sin actualizar y el jugador ve una escena vieja. El
opt-ines lo que hace que el valor por defecto no sea una apuesta, y los cuatro tests son lo que hace que el techo tenga una forma.Lo que no verifiqué: el techo disparándose en un frame real — necesita el título y una escena con muchas pasadas, y lo que los tests pueden comprobar es la contabilidad, no el tirón que se evita.
Y una cosa que le pediría al autor, porque este repositorio la tiene: una fila en
gpu-test-results/con el interruptor encendido y apagado — el techo es una decisión de producto y el dato de si merece la pena es exactamente lo que esa carpeta guarda.#2379(la herramienta de resumen) y#1741(el índice) están en la cola, y un resultado nuevo encaja en los dos.@MoonEyes on GitHub · 2026-12-03 05:01 UTC · original
RUN (in game, one pull request), its head merged with
git merge --no-ffonto maind9b618f10: #3291a643d5aec. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, 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 17.2 fps on other batches in the last day. These 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 pull request, on the head above. If it changes its head, this run no longer covers it.
Limits: one run; arrival in the world was driven by keys and not checked on pictures;
-PrecompileUsedwas used, so the default start (every known pipeline precompiled) was not exercised. It was run alone because it does not merge together with #3290. Its ceiling on the texture passes is opt-in and was left off, so this run covers the default path only, not the capped one.AI-assisted (Claude Code).
@OreoFR on GitHub · 2026-12-03 06:23 UTC · original
RUN: #3291
LEONIDA_TEXTURE_FRAME_MS=8, A/B on the accounting rewritten after review (Verified by OreoFR)a643d5aec55ef546c87f3df39fa62a684247cf71, merged withgit merge --no-ffonto maind9b618f10(merge4224e9409, no conflicts).d3d12\scripts\build-nvidia.ps1(diag).-SeriesS -NoDlss -NoFrameGen -PrecompileUsed, BAR 0,LEONIDA_TEXTURE_BUDGET_MB=1024;LEONIDA_TEXTURE_FRAME_MS=8(confirmed on each B log's settings line).HEAP_TEXTURES_FRAME_SPENTis counted but no log line prints it, so this run cannot say how often the ceiling stopped a pass. I will add it to the texture-queue counters line.-PrecompileUsedonly.Verdict: MEASURED n=2, PROVISIONAL.
It stays opt-in; the numbers do not support a default. The next step is to print the counter and run more pairs.
AI-assisted (oreofr-agent)
@MoonEyes on GitHub · 2026-12-03 07:31 UTC · original
RUN (in game, batch of two pull requests), each head merged with
git merge --no-ffonto maind9b618f10, in one build: #32916b0ee46be, #33032872ebbfb. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, 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 17.2 fps on other batches in the last day. These 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, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. #3303 moved during the run to
5942d0596, which only adds a#[test]insidemod testsofhost/menu.rs(git diff 2872ebbfb 5942d0596outside*.mdis that test alone), so this run also stands for that head.Limits: one run; arrival in the world was driven by keys and not checked on pictures;
-PrecompileUsedwas used, so the default start (every known pipeline precompiled) was not exercised. #3291's ceiling is opt-in and was left off. #3303 changes the F1 SAVE AND RESTART path, which was not exercised in game here.AI-assisted (Claude Code).
@MoonEyes on GitHub · 2026-12-03 15:30 UTC · original
In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #3290, #3291, #3293, #3296 and #3297 merged into main
b053a1813; this PR tested at its current head0aa1f75b2. Series S 1080, DLSS FG 2x,play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s, no extra switch set.AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.
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.