kernelx: XCL_TRACE_WAITS names what the title's waiting threads wait on #924
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!924
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-924"
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?
@Xeltax on GitHub · 2026-11-24 08:26 UTC · original
Xeltax:trace-waits→main· +408 −1 · 3 files · 2 commits · openXCL_TRACE_WAITS=1: at each thread dump (XCL_THREAD_DUMP_AT, a crash), XCL lists the title's threads that have waited 2 s or more on the title's own events and semaphores. For each one it gives the handles, where in the title each handle was made, and when and from where it was last set or released ("never" when the title never signaled it). The thread stacks say where each thread is; this says which object a waiting thread is waiting for, and so which other thread it depends on. Part of #505.What is in it
a2b5007: each dump starts with the size of the tracer's two tables (handles known, threads waiting), after a Wine run in this thread saw host memory grow with the variable set.crates/xcl/src/hle/waits.rs(new):CreateEventA/W,CreateEventExW,CreateSemaphoreW,CreateSemaphoreExW,SetEvent,ReleaseSemaphore,CloseHandle,WaitForSingleObject(Ex)andWaitForMultipleObjects(Ex). Each calls Windows, then records the handle's maker and last signaler, and the calling thread's wait.long_waits()builds the report lines. A handle not made through these imports is named by its kernel type (NtQueryObject). Polls (timeout 0) are not recorded as waits.crates/xcl/src/hle/mod.rs: with the variable set, the wrappers join kernelx's exports, so the title's kernel-family imports reach them. Without it, the import table is unchanged.crates/xcl/src/eh.rs:dump_threadslogs the list after the thread stacks.a_thread_waiting_on_an_event_nobody_set_is_listed_until_the_event_is_seta_poll_is_not_a_wait_and_semaphores_count_releasesan_object_made_elsewhere_is_named_by_its_kernel_typeWhat it showed on the retail title of #505 (RTX 4080,
main1ec4c98+ this change,XCL_THREAD_DUMP_AT=88,98, A pressed throughXCL_PRESS_AT; frames stop at ~74 s,+0x23cf683at ~104 s)The dumps give one chain of waits, from the main thread down to a compute bind:
+0x23cf735) waits on semaphore0xff8. The frame-loop thread released it 619 times, from+0x23cf2c9, the last time at 73.6 s.+0x23cf104; it makes the firstListX #101call) waits from ~85 s until the abort at+0x43c3d5d. It waits on an event of a 128-entry ring made at start (+0x43c39dc, one event per entry). The title never sets that event throughSetEvent.+0x43c4314 ← +0x43c4591) builds compute pipelines in its binds during the stall: 31 builds on its own thread between 74 and 96.6 s, per the log lines.XCL_PSO_WAIT_MS=50) merged locally, the frame-loop thread's wait ends after ~25 s.This agrees with the compute-bind waits that
throny(#232),leondood1298andemusynths(#505) found in thread stacks. The new part is the objects and which thread each wait depends on.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4ona2b5007: 719 passed, 0 failed, 41 ignored. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).dc0fb78failedplaced_title_textures_share_vram_and_preserve_pixelsand the two tests whose mutex it poisons (#718, #343). Those fail the same way onmain09940bbon this machine; this change does not touch them.cargo test -p xcl --lib waits: the 3 new tests pass.XCL_TRACE_WAITS=1: the runs above.Regression run (60 s,
XCL_TRACE_WAITSunset)main:
PR:
Not tested
SleepConditionVariable*,SleepEx,WaitOnAddress, and handles waited on inside system DLLs.SetEventnorID3D12Fence::SetEventOnCompletion(checked with a local hook that is not part of this PR).@throny: here is the branch, as you offered to run it.
AI use
🤖 Generated with Claude Code
@Xeltax on GitHub · 2026-11-24 10:30 UTC · original
Thanks for the run, @frozht. I can't reproduce the growth on Windows, and the tracer's own tables stay small:
Commit with and without the variable (RTX 4080, Windows 11,
1ec4c98+ this change, world loading):XCL_TRACE_WAITSThe tables themselves. I pushed
a2b5007, which makes each dump start with the size of the two tables. On Windows, withXCL_THREAD_DUMP_AT=60,120and the abort at 115 s, they held 851 and 878 handles, and 42 and 44 waiting threads. Both are keyed by handle and by thread, and an entry goes withCloseHandleor when its wait returns.So if the 7 GB you see comes from this code, it is not these tables. Could you rerun
a2b5007under Wine withXCL_THREAD_DUMP_AT=60?RtlCaptureStackBackTrace, which every recorded wait calls once to find the title's caller. If that is it, recording the caller only for waits that last could be the fix. I'd rather measure first.AI use: Claude Code (Claude Opus 5.5) ran the comparison and wrote this reply.
@SlopTart on GitHub · 2026-11-24 10:37 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
dc0fb78onto main02bfd1d, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 719 passed, 11 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). XCL_TRACE_WAITS naming green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@frozht on GitHub · 2026-11-24 10:23 UTC · original · edited 2026-11-24 11:13 UTC
Correction: this report was wrong. The memory growth was not caused by #924.
Between runs, the earlier-run pipeline list (
used-pipelines.txt, which #690 preloads) grew from 397 to 1010 entries. Preloading 1010 entries runs the same build out of memory at about 170 s withXCL_TRACE_WAITSunset. With the list trimmed back to 397, memory is 7.6 GB at 300 s. The run I reported here preloaded the larger list, so it says nothing aboutXCL_TRACE_WAITS. Sorry for the noise. I'll post a new result here only after a run with the same list.Previous text:XCL_TRACE_WAITS=1grows host memory: 16 GB at 121 s against 8.7 GB, OOM at 318 s.@throny on GitHub · 2026-11-25 08:53 UTC · original
Test report for exact head
a2b5007. No other report on this head yet, and it carriesgoal:world-load.Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4ona2b5007as it is (its own base): 719 passed, 0 failed, 41 ignored, first run.SKIPPED: 2 lines (no wave64 on this adapter, and the like).scripts/smoke.ps1, the retail title, 60 s, release builds,main568e7dbfirst, then this head (XCL_TRACE_WAITSunset, so the default path):main:
PR:
Not tested:
XCL_TRACE_WAITS=1on a title run, AMD, the head merged onto currentmain.AI use: Claude Code (Claude Opus 5.5) ran this and wrote the report; the diff was read for safety by a Claude Opus 5.5 sub-agent before it was built.
@DavidM1911 on GitHub · 2026-11-25 09:30 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@4usphs on GitHub · 2026-11-25 11:52 UTC · original
AMD run on the exact head
a2b5007(a2b5007319), as pushed on its base09940bb(not merged onto currentmain), on two AMD adapters with native 64-lane waves: RDNA4 and the console's generation, RDNA2.Tested
XCL_TRANSLATED_CACHE=0; adapter picked withXCL_ADAPTER.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:gfx1036), driver 32.0.21045.29003: 716 passed, 3 failed, 41 ignoredSKIPPEDtests on either adapter.a_thread_waiting_on_an_event_nobody_set_is_listed_until_the_event_is_set,a_poll_is_not_a_wait_and_semaphores_count_releases,an_object_made_elsewhere_is_named_by_its_kernel_typerun and pass on both adapters.placed_title_textures_share_vram_and_preserve_pixelsat its cubemap reuse check,transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memory): the intermittent failure of #718, which takes the other two with it (#673), not this PR. They pass on their own on this head, andcargo test -p xcl --lib -- --test-threads=4on the base09940bbfails the same 3 on both adapters.Not tested
AI use
@ClosetPie107 on GitHub · 2026-11-25 12:28 UTC · original
Linux / AMD RDNA4 (RADV) test report for head
a2b5007merged locally ontomain1a0bbe3(clean merge).Environment
experimental-11.0-20261112), vkd3d-proton v3.1 (#257+dxil-spirv53aac418), DXVKv3.1.1-209, DXC1.9.2609.5,x86_64-pc-windows-gnucross-compileTested (debug test binary under Wine,
--test-threads=1 --nocapture)hle::waits::tests: 3 passed, 0 failed, 0 ignored, 0 skipped (0.01 s).Not tested: full workspace suite, retail title run, native Windows.
AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.
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.