Repository navigation
Conversation
A thread dump shows where each thread is, not what a waiting thread waits for. In the retail title's world-loading stall (xcl-dev#505) most title threads sit in WaitForSingleObject called straight from the title, so the stacks alone cannot tell which thread depends on which. With XCL_TRACE_WAITS=1 the title's event and semaphore imports (CreateEvent*, CreateSemaphore*, SetEvent, ReleaseSemaphore, CloseHandle, WaitForSingleObject(Ex), WaitForMultipleObjects(Ex)) go through wrappers in hle::waits that record each handle's maker and last signaler and each thread's current wait. Every thread dump then lists the title's threads waiting 2 s or more, with those details; a handle made elsewhere is named by its kernel type. Without the variable the import table is unchanged. On the retail title this showed the frame-loop thread (+0x23cf104) waiting at +0x43c3d5d on an event of a 128-entry ring made at +0x43c39dc, never set through SetEvent, while that ring's worker (+0x43c4314) built compute pipelines in its binds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Correction: this report was wrong. The memory growth was not caused by #924. Between runs, the earlier-run pipeline list (
|
A test run under Wine (xcl-dev#924) saw the process's host memory grow much faster with the variable set than without it. On Windows the commit with and without it is the same at 20 to 100 s. The tracer's two tables are keyed by handle and by thread and should stay small; printing their sizes with every dump shows whether they are what grows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the run, @frozht. I can't reproduce the growth on Windows, and the tracer's own tables stay small:
So if the 7 GB you see comes from this code, it is not these tables. Could you rerun
AI use: Claude Code (Claude Opus 5.5) ran the comparison and wrote this reply. |
|
Linux / AMD RDNA3 datapoint. Merged state: head Full suite, Not tested: retail titles (none here), Windows, RDNA4. 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 AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
XCL_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 (Tests: placed_title_textures_share_vram_and_preserve_pixels fails now and then at its cubemap reuse check (main 9ce2070) #718, Tests: gpu_sparse_vram_descriptors_buffers_and_xmem fails beside the title-texture tests since #288 #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