d3d12: 300-800 ms freezes in the world come from one list-translation thread busy in a single list call (3 stall traces) #3105
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
Reference
No Branch/Tag specified
main
github-pr/3295
beta
docs/changelog-3483-3500
github-pr/3294
github-pr/2975
github-pr/2815
feat/gate-driver-start
feat/skip-pipelines-release
perf/lazy-compare
perf/mwaitx-wait
test/prio-ceiling-main
fix/ab-cpu-stdout
fix/gate-old-crashes
diag/ab-cpu
test/main-0312
github-pr/3291
diag/indirect-clamp-census
feat/barrier-enhanced
perf/texture-frame-ceiling
perf/dstorage-threads
fix/console-queue-dma-tables
fix/port-descriptors-record-parts
fix/frame-waits-fence
fix/console-sampler-words
fix/graphics-userdata-spill
fix/xg-reserved-layout-rotation
fix/barrier-console-flags
fix/switches-wait-test-child
test/list-value-waits
test/lot-gxdk-0412
fix/bvh-compacted-size
docs/i18n-quickstarts
feat/native-pipeline-slots
fix/clippy-leonida-gpu
fix/list-value-producers
fix/descriptor-page-straddle
fix/xmem-low-window
fix/ffx-jitter-never-zero
fix/run-stdout-closed
github-pr/2892
github-pr/2896
feat/warm-save-every
github-pr/2980
github-pr/2994
github-pr/3005
github-pr/3010
github-pr/3136
github-pr/3303
github-pr/3220
github-pr/3143
github-pr/3330
github-pr/3226
github-pr/3187
carry/3395
github-pr/2946
github-pr/2947
github-pr/2945
github-pr/2983
github-pr/3001
github-pr/3372
github-pr/3128
github-pr/3296
github-pr/2588
github-pr/3119
github-pr/3378
fix/crash-diagnostics
feat/dlss-mip-bias
fix/retired-out-of-order
fix/dxr-postbuild-barrier
fix/amd-relay-default
fix/removed-report-wait
feat/heap-twin
feat/vram-margin
github-pr/2472
github-pr/3123
github-pr/3088
assets/annonce-v1
github-pr/2794
github-pr/3300
github-pr/3304
github-pr/3308
github-pr/3367
github-pr/3369
fix/launcher-dlss-diagnostics
github-pr/3269
github-pr/2957
github-pr/3205
fix/crash-zero-guard
github-pr/3185
github-pr/3099
github-pr/3104
github-pr/3348
github-pr/3379
github-pr/3377
perf/darner-title-priority-ceiling
github-pr/3376
gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github-pr/3373
github-pr/3368
github-pr/3198
gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github-pr/3346
github-pr/3375
github-pr/2958
github-pr/3151
github-pr/3307
github-pr/3278
github-pr/3374
fix/runtime-test-conservative-fixtures
github-pr/3366
ci/shard-semantic-linux
github-pr/3354
docs/fg-limit-fps-switch
github-pr/3365
fix/read-file-hard-link
github-pr/3364
fix/book-slot-heap-never-read
github-pr/3361
github-pr/3263
github-pr/3360
github-pr/3353
github-pr/3331
fix/alias-later-queued-submissions
github-pr/3352
github-pr/3228
github-pr/3349
claude/gallant-sagan-aamatr
github-pr/3200
github-pr/3132
github-pr/3323
github-pr/3332
github-pr/3340
github-pr/3311
github-pr/3334
github-pr/3297
github-pr/3256
github-pr/2567
github-pr/2851
d3d12/agility-sdk-621
github-pr/3164
github-pr/3114
github-pr/3050
github-pr/3113
github-pr/3326
github-pr/3144
github-pr/2642
github-pr/3072
github-pr/2789
github-pr/2643
github-pr/3009
github-pr/3035
github-pr/3031
github-pr/2686
github-pr/2834
github-pr/3321
github-pr/3325
github-pr/3290
github-pr/3324
github-pr/3130
claude/fervent-curie-m19lnr
github-pr/3309
github-pr/3305
github-pr/3306
github-pr/3302
github-pr/3301
github-pr/3345
github-pr/3211
github-pr/3027
github-pr/3286
github-pr/3235
github-pr/3265
github-pr/3275
codex/skip-no-hit-ray-passes
github-pr/2823
github-pr/2911
github-pr/3262
github-pr/3125
github-pr/3206
github-pr/3250
github-pr/3238
github-pr/3188
github-pr/2952
github-pr/3217
github-pr/3168
t3/preserve-fsr-sdk-restart-path
t3/propagate-host-failure-hresult
github-pr/3209
t3/launcher-custom-parameters
github-pr/3207
github-pr/3183
github-pr/3160
github-pr/3201
ci/less-to-run
github-pr/2930
github-pr/2797
github-pr/2999
perf/native-compute-shader-forms
github-pr/3191
github-pr/3011
github-pr/3019
github-pr/2996
gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
claude/blissful-franklin-ukp7ag
github-pr/3141
github-pr/3156
github-pr/3150
github-pr/3153
github-pr/3163
github-pr/3142
github-pr/3139
github-pr/2841
github-pr/3069
github-pr/3098
github-pr/3107
github-pr/3071
github-pr/2774
github-pr/2889
github-pr/3075
github-pr/2661
github-pr/3064
github-pr/3054
github-pr/3049
github-pr/2855
github-pr/2943
github-pr/3016
github-pr/2887
github-pr/3006
github-pr/3003
github-pr/2993
notes/card-time-and-plant-flicker
github-pr/2989
feat/vulkan-rs
github-pr/2985
github-pr/2951
github-pr/2982
github-pr/752
github-pr/792
github-pr/2877
github-pr/2654
github-pr/2893
github-pr/2948
github-pr/2944
github-pr/2919
github-pr/2915
archive/ci/less-to-run/20261202T1121Z
github-pr/2800
github-pr/2822
github-pr/2833
github-pr/2840
github-pr/2831
github-pr/2832
github-pr/2801
github-pr/2890
github-pr/2891
github-pr/2664
github-pr/2807
rt-call-trace
github-pr/2755
perf/ahead-split
github-pr/2587
github-pr/2698
github-pr/2609
github-pr/3219
docs/readme-runtime-proposal
github-pr/2017
github-pr/1741
github-pr/1667
codex/coord-claim-check-20261124-7e48
v1.1.0
v1.0.1
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#3105
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
What happens
In the open world the picture freezes for 0.3 to 2 s every so often (in a 3.5 min sample: 51 frames over 100 ms, 5 over 1 s). I caught three of them with the stall trace (
LEONIDA_TIMELINE_STALL_MS=250). All three are the same: oneleonida-list-Nthread is inside a single "a long list call" for the whole freeze and is running, not waiting (0 to 20 ms of recorded waits inside it). The submitting thread, the uploads-ahead and views threads, and the title's present all wait behind it. The pipeline workers are idle. No error.Commit
5ec08c383 (built with
d3d12\scripts\build-nvidia.ps1, diag profile, featuresdiagnostics,dlss,mimalloc)System
Windows 11 Pro 10.0.26200, AMD Ryzen 7 9800X3D, 64 GB RAM, NVIDIA GeForce RTX 5090 32 GB, driver 621.40
Where
runtime (
d3d12/runtime,leonida.exe, in the running game)Command and steps
Series X, the title's own upscaler at a fixed 0.6667 into a 4K output, no frame generation. Load a save in the open world and drive or walk around; in that 3.5 min sample, 21 of 30 five-second windows in the world had a frame over 100 ms. One trace per start (the stall mode is one-shot), three starts, the same save.
leonida-list-3leonida-submit,leonida-ahead,uploads ahead 0/1,leonida-views-1..3; the title's present 775 msleonida-list-5leonida-list-4277.5 ms (WaitOnAddress, linked toleonida-list-5); the other list threads ~270 ms, linked to the title's threadsleonida-list-1What the traces rule out, as far as stall mode can see:
leonida-pipelines-Nworkers sat in oneWaitOnAddressfrom before the freeze to after it, in trace 1. Only in trace 1 did the list thread wake the pipeline workers as its call began (and was woken back byleonida-pipelines-5after 3.2 ms); traces 2 and 3 have no such hand-off. The run'srecording per frame ... ms waiting for pipelinesis 0 in almost every 5-second window with a stutter.streaming: a request/inflating/unpacking BCPackkeep running during the freeze (trace 1: 395 requests, 242 ms), and nothing waits on them.the library did not load itlines in any of these runs (so not #2781).One more thing from trace 1's run: the log is silent from all threads for the 750 ms of the freeze (no periodic lines either), then resumes.
Stall mode records no stacks, so I can't tell which code inside the list call takes the time. I can run the timed mode or anything else you'd like (a
LEONIDA_*switch to try, a test build) and send the.txtsummaries.The investigation and this report were AI-assisted (Claude Opus 5.5).
Output
Great traces — all six clues in your three stall dumps line up cleanly in the source, and two quick checks on the
-Logfile you already saved from Trace 1 can separate the remaining two culprits without even relaunching.Why stall mode showed
0 msof waits,0"the library did not load it"lines, and750 msof log silence"a long list call"recorded0 msof waits onleonida-list-N(timeline/hooks.rs,list.rs):"a long list call"wrapslist::with_state(Statecommands only).timeline::hooks::wrap_imports()patches onlyleonida.exe's own static PE import table (WaitOnAddress,WaitForSingleObject,EnterCriticalSection, etc.). Direct COM vtable calls intod3d12core.dll/nvwgf2umx.dll/win32u.dll(CreateCommittedResource,CreateHeap,MakeResident/D3DKMTMakeResident,CreateGraphicsPipelineState,ID3D12Fence::SetEventOnCompletion(..., NULL)) and driver-internal locks record0Kind::Waitand0Kind::Kernelevents.leonida-list-4in Trace 2) blocks on a RustMutex/RwLock/OnceLockheld byleonida-list-5,stdcallsleonida.exe's hookedWaitOnAddress— producing Trace 2's exact277.54 msWaitOnAddresslinked toleonida-list-5.D3D12-TIMELINE-STALL-LIST-OPin flight right now soLEONIDA_TIMELINE_STALL_MSrecords the exact list command op, caller return site, and bound pipeline key prefix on"a long list call"instead of a generic label.)-Logfor"the library did not load it"found nothing (pipeline/library.rs:615):"the library did not load it"is only pushed intohost::trail(the 64-entry in-memory ring dumped on device removal) — it is never written to-Login a normal run. Actual runtime PSO compiles loghost pipelineorhost mesh pipeline(pipeline/host.rs).750 ms(host.rsMeter::frame):leonida-meteris only signaled from insidePresent. WhilePresentwaited775 msbehindleonida-submit->leonida-list-3, noPresentcompleted to wakeleonida-meter.The two candidates inside
list::with_statethat match all three tracesMakeResident(D3DKMTMakeResident) under a global Rust table lock onleonida-list-N:uploads ahead 1spent~616 msin unhookedCopyQueuefence completion (texture/ahead.rsSetEventOnCompletion(..., NULL)) and unblocked at the exact same momentleonida-list-3finished — the signature of WDDM residency/paging work (amplified here byLEONIDA_REAPER='0'keeping retired resources resident).texture::staging()(texture.rs) still holds globaltexture::STAGINGacrosspool::staging(64 MiB upload-pool growth ->CreateCommittedResource+MakeResident+Map, whichpool.rsnotes took270–961 msunder VRAM pressure) and oversizedhost.upload_buffer(total), andshadow::lookup/shadow::loose(shadow.rs) holdBUFFERS.write()/LOOSE.write()acrossCreateCommittedResource+MakeResident(blocking peerleonida-list-Mthreads inWaitOnAddressas in Trace 2).leonida-list-N(draw.rs->pipeline/make.rsmasked_for):make::readyonleonida-pipelines-0..N),make::masked_for(LEONIDA_SAMPLE_MASK=1, LOD-fade draws) callsp.make()synchronously onleonida-list-NunderPending.made: OnceLock— leaving all 12leonida-pipelines-*workers completely idle, recording0 msinwaiting for pipelines, and blocking any second list thread hitting the same masked pipeline inWaitOnAddress(Trace 2). Notice in Trace 1leonida-list-3woke fromleonida-pipelines-5after3.21 ms(host_pipeline_for) right as the782 mscall began (masked_forruns on the very next line ofprepare_forwhensample_mask != FULL_MASK).Two quick checks (first one needs no relaunch)
-Logfrom Trace 1 around the freeze:host pipelineorhost mesh pipelineline print right as the~780 msgap ended? (If yes -> Candidate 2masked_for.)frame times over ...summary line after the freeze, what didwaits for new memory to be resident ... ms a framereport? (If it spiked -> Candidate 1MakeResident.)LEONIDA_REAPER='0'and addingLEONIDA_WAIT_RESIDENT='0'(isolates Candidate 1), orLEONIDA_SAMPLE_MASK='0'(isolates Candidate 2), or run timed modeLEONIDA_TIMELINE='120,30,<traces>\timed.json'withoutLEONIDA_TIMELINE_STALL_MSto capture stacks onlist calls of 50 us or more.AI-assisted (Gemini 4 Carbon High).
Thanks, that was quick to check. Both checks are done on 5ec08c383, the same build, save and settings as the report. They point at candidate 2, the masked twin built on the list thread.
1. The saved logs. In the three trace runs I looked at every stretch where the log went silent for 600 ms or more. 10 of those 14 end with a
host mesh pipeline shaders=[..., pixel ... masked]line within 30 ms, and that includes all 4 silences over 1 s. Only about 5% of the pipeline lines in those logs are masked ones (237 to 275 of about 4,900 per run). In the 5-second windows holding those freezes,waits for new memory to be residentwas 0.28 to 0.40 ms a frame, so it didn't spike. (A longer run with Frame Generation at 2x showed the same thing: 5 of its 6 silences over 1 s end with a masked line.) One limit: stall mode keeps no clock time, so I can't tie these log silences to the three traced freezes exactly.2.
LEONIDA_SAMPLE_MASK=0, with everything else as in the report's command, including a stall trace:LEONIDA_SAMPLE_MASK=0The trace from this run (
stall-04, 551.6 ms) has a different shape from the three in the report. A long list call accounts for only 4.85 ms of it. The chain is 503 ms onleonida-pipelines-9, outside our spans, so the frame waited on an ordinary pipeline build (I run withLEONIDA_PIPELINE_WAIT_MS=1000), not on a list thread.Caveats: the sample-mask run came a few hours after the trace runs, so more pipelines may have been in the library already (it still made 1.6 to 2.9 a window). The trace runs also differ among themselves (5.9, 2.8 and 2.0 frames over 100 ms a minute). The clear change is in the long freezes, not in short hitches. I didn't try
LEONIDA_WAIT_RESIDENT=0or the reaper on, since check 2 already pointed one way. I'm happy to test a build that makes the masked twin on the pipeline workers, or that waits for it the way normal pipelines are waited for.The investigation and this reply were AI-assisted (Claude Opus 5.5).
Thanks again @TripyFox for running both trace checks above and isolating the
0.6–2.3 sopen-world silences to synchronoushost mesh pipeline ... maskedsample-mask twin builds onleonida-list-*!Opened #3200 (
d1a91afd1, stacked on #3132) to routepipeline::make::masked_forthroughreadyontoleonida-pipelines-*workers with#3132's live-waiter priority donation andLEONIDA_PIPELINE_WAIT_MSbounded wait: fast/cached masked twins still finish before the first LOD-fade draw, while multi-second cold driver compiles time out cleanly and fall back to the already-built unmasked PSO until the worker finishes publishing the twin.The slow-operation tags in #3136 could be extended with spans for synchronous texture preparation inside
DispatchMesh, upload-list lock wait, and PSO wait. I would put DirectStorage activity on the same timeline and logPresententry and return so a pause before the call can be distinguished from time spent inside it.Synthetic trace. In a 100 ms gap between
Presentcalls, texture preparation runs at10-55 ms, a second thread waits for the upload-list lock at20-80 ms, and recorded I/O runs at20-22 ms. PSO wait is 0 ms. The two CPU-side spans overlap by 35 ms.Follow-up using
Presententry and return markers. One local diagnostic trace captured a 2.06 s frame interval. About 2.02 s elapsed before enteringPresent, and 41 ms elapsed inside the call.A single buffer-copy update accounted for about 1.95 s on the critical path. The update thread accumulated about 1.89 s of kernel-mode CPU time in that interval. PSO wait recorded for that frame was 0 ms. Timing the buffer-copy update separately from the
Presentcall would help attribute other long gaps in the same way.Read-only audit of the three stall traces against
main(no game run, no build). The evidence points to one cause for the 300–800 ms list-call freezes, and it is already the design of the open #3200.The traces say a list thread was running, not waiting. In all three, one
leonida-list-Nthread is inside a single"a long list call"span for essentially the whole freeze; the hooked waits inside are 19.7 / 0 / 0 ms, no fence wait, pipeline workers idle,waiting for pipelines≈ 0. The log silence isMeter::framenot being signalled becausePresentwas behind that thread.The path.
DrawIndexedInstanced→prepare→graphics_pipeline(draw.rs:2549-2563) →host_pipeline_masked→make::masked_for(pipeline/make.rs:471-486) →p.make()at:482-484, which runsHostPipeline::new(pipeline/host.rs:658) — masked-shader translation plusCreateGraphicsPipelineState(host.rs:1088) — on the recording thread. It bypassesmake::ready/wait_with, soLEONIDA_PIPELINE_WAIT_MS,WAIT_ONCE,C::PipelineWaitUsand the frame budget do not apply, and the workers stay idle. A peer list thread on the samePendingwaits onbuilt(trace 2'sWaitOnAddress). Once made, later draws are cheap: a first-sight hitch per LOD-fade pipeline/format variant, not a steady cost.Why the A/B is decisive:
LEONIDA_SAMPLE_MASK=0returns beforewith_state!(list.rs:2501-2504), soState::pixel_maskstaysNoneandgraphics_pipelinenever callsmasked_for— it removes the path by construction. Log correlation: 10 of 14 silences ≥600 ms and all 4 >1 s end within 30 ms of ahost mesh pipeline ... maskedline, which is only ~5% of pipeline lines.One probe to close the remaining gap: wrap the
p.make()block inmasked_forwith a span labelled from the pre-call claim state —masked twin: built herewhen this thread takes the claim,masked twin: waited for anotherotherwise. If the list-call span is ~782 ms and this child is ~780 ms, (d) is attributed; if it is ~1 ms, the time is in bind/heap/lock/COM work instead.Caveat for #3200: routing the twin through
ready/waitbounds it at the general pipeline budget. The reporter runsLEONIDA_PIPELINE_WAIT_MS=1000, so a 782 ms compile would still be waited for — #3200 removes the >1 s cases, not necessarily the 300–800 ms ones. To remove those, the twin needs a dedicated short budget (e.g. 50 ms, falling back to the unmasked pipeline for that draw) or no wait at all on first draw; the no-wait variant trades the first LOD-fade frame's masked shader, which65f372c08was avoiding. The short-budget variant is the safer compromise.Not every freeze is this:
stall-04is an ordinary 503 ms build on a pipeline worker, and the issue's synthetic trace has a 1.95 s buffer-copy update. Unproven: the exact three traces are inferred from the A/B + path, not sampled; and the split inside the 300–800 ms between translation and the driver PSO compile is unknown (the span would give the total only).