Skip to content

Scripts: align world-load stalls with logged compiles and GPU waits - #2529

Open
razormontana wants to merge 2 commits into
xcl-dev:mainfrom
razormontana:scripts/analyze-world-load-stalls
Open

razormontana wants to merge 2 commits into
xcl-dev:mainfrom
razormontana:scripts/analyze-world-load-stalls

Conversation

@razormontana

@razormontana razormontana commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #505 and #1833. A saved XCL log can show a world-load pause while driver builds are in progress and GPU waits are being logged. The script finds the terminal zero-present samples and aligns both types of observation with the same time window, so a tester can see where to inspect the trace.

What is in it

  • scripts/world_load_stall.py reads a single saved runtime log. It summarizes the activity samples, joins numbered driver compile starts and finishes, merges their overlap with the sample window, and reports the logged Wait64 bridges and GPU wait watchdog releases.
  • With --title-exe NAME.exe, the script inspects the latest timestamped thread dump after the last sample with presents through the closing zero-present sample. It reports dump coverage and the visible XCL offsets above each thread's first matching title frame, using case-insensitive module names. The candidates describe sampled stacks.
  • scripts/test_world_load_stall.py and README.md cover the sampled boundaries, optional thread-dump parsing, and limits of the captured events.

Tested

  • Clean head c9c531ee5bce18f64fe63844502fc449a884c451, based on 6d12f58a229bc73889878a448c64dc3af25eeba0. Python 3.14.3 on Windows 11 build 22631.5335, Core i7-10700K and GeForce RTX 3070 with driver 32.0.16.1742.
  • python -B -m unittest discover -s scripts -v passed all 35 tests. Negative controls for dump selection failed when the closing timestamp was excluded, file order took precedence over timestamp, or an unterminated row counted as complete. Earlier controls caught discarded compiles already in progress at the opening sample and activity incorrectly kept after a shutdown request.
  • On the same RTX 3070 system, cargo build --offline --locked --workspace succeeded. The debug workspace run, cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output, passed 1,423 tests across 37 test targets, with 0 failed and 46 ignored. It used Rust 1.100.0 MSVC, the Windows SDK DXC and XCL_ADAPTER=3070. Cargo's pass count includes 26 SKIPPED notices (21 native-wave64 checks, 3 unsupported per-lane forms, 1 reserved cube with mips and 1 heap-window check).
  • Default CLI output matched c9abd1f byte for byte on a synthetic CRLF log and two saved RTX 3070 captures. The 68a284a capture showed four submits and 2.001 s of logged compile overlap during the final zero-present window. The 89bbbb4 capture resumed presents after an earlier pause.
  • The optional CLI found candidates in the synthetic log. In a saved capture it excluded the 826.270 s thread dump after the 824.499 s window closed. The same raw dump in a synthetic window parsed 139 of 139 rows, found visible title frames on 45 threads and reported zero candidates.
  • RavenCurseBurg independently checked compile overlap and endpoint semantics on the earlier head c9abd1f. Independent report

Not tested

  • Queue-wait events were tested with synthetic log lines. The thread-dump section was checked offline. Limited unwinds can omit title frames or XCL callers. In-game progression and live wait behavior remain unverified.

AI use

  • OpenAI Codex (GPT-6.2 Sol) wrote the script, tests, README update and draft description, and independently reviewed the code and evidence. The lead agent used OpenAI Codex (GPT-6.2) to run the workspace suite and saved-dump probe.
  • GreemSC suggested the thread-dump analysis and shared an example written with Claude Code (Claude Opus 5.5). Suggestion

Summarize terminal zero-present samples and align them with numbered driver compile intervals and logged queue wait observations. Part of xcl-dev#505.
@GreemSC

GreemSC commented Nov 25, 2026

Copy link
Copy Markdown

One addition that found both of our world-load stops, if you want it in the script: the last XCL_THREAD_DUMP_AT dump, and in it every title thread with XCL frames above its first game frame. That is a title thread XCL is holding (a compile, a readback, a CPU wait), and it is the line that named the cause each time: bind::execute_indirect → dispatch_chain::whole → driver_pso before #2404, pso_async::resolve_for_bind → build_compute after it. It needs dumps deeper than 14 frames (#1734), or the XCL callers under the driver frames are cut off.

import re

def held_title_threads(dump_lines, title_exe="game_scarlett_master.exe"):
    """(tid, xcl offsets above the first game frame, that game frame) for each title thread XCL holds"""
    held = []
    for line in dump_lines:
        m = re.match(r"thread (\d+) '([^']*)': (.*)", line)
        if not m:
            continue
        frames = m.group(3).split(" < ")
        first_game = next((i for i, f in enumerate(frames) if f.startswith(title_exe + "+")), None)
        if first_game is None:
            continue  # not a title thread
        xcl = [f.split("+", 1)[1] for f in frames[:first_game] if f.startswith("xcl.exe+")]
        if xcl:
            held.append((m.group(1), xcl, frames[first_game]))
    return held

(dump_lines are the thread N 'name': a < b < … lines after a thread dump (N threads): line.) The offsets symbolize with llvm-symbolizer --obj=xcl.exe --pdb=xcl.pdb <0x140000000 + offset> (the image base) against the build that ran. With #2244's Wait64 cells behind line next to it, a cell whose recorded value is above what was submitted points at the same held thread.

AI use: Claude Code (Claude Opus 5.5) wrote the function (from our own run analysis) and this comment.

@RavenCurseBurg

RavenCurseBurg commented Nov 25, 2026 •

Copy link
Copy Markdown

Rechecked c9c531ee5bce18f64fe63844502fc449a884c451 with the new thread-dump option. The earlier interval oracle still matched 512 shuffled synthetic logs and 16 saved-log CLI replays. For the new option, I independently generated 192 logs with timestamp ties, partial/empty dumps, bare addresses, mixed-case module names, and XCL frames on either side of a title frame. Parsed row counts, visible-title counts, thread IDs and offset lists matched the generated expectations in every case. I checked 12 of those saved logs via the CLI both with and without --title-exe (24 CLI runs).

Focused tied-timestamp regression. Two dumps have the closing sample’s millisecond timestamp. The later, incomplete dump wins, and only its XCL offset above the first title frame appears. Choosing the first tied dump or scanning past that first title frame each failed the new assertion. python -B -m unittest discover -s scripts -p "test_*.py" passed 35 tests on this head and 36 with the fixture. The earlier endpoint fixture also combined cleanly; all 12 focused stall tests passed with both additions.

Windows 11 26100.9711, i7-13700, Python 3.14.3. Synthetic log text only. OpenAI Codex (GPT-6) wrote the fixture and ran the checks.

Earlier compile-overlap and endpoint checks

I checked c9abd1fe0518063504907baddde78ab44792ff10 against an independent quarter-second occupancy calculation. For 512 shuffled synthetic logs (seed 2529), I counted occupied ticks directly for completed compiles and for the upper bound including unfinished ones. The matched duration, upper bound, intersecting counts and wait-event counts agreed in every case. I sent 16 of the logs through python -B scripts/world_load_stall.py <saved-log>; the full reports matched the in-process results.

Focused regression fixture. A compile ending at the opening sample and a compile starting at the closing sample contribute zero duration. A point event at the closing sample counts. The fixture failed independently when I excluded that endpoint or counted a zero-duration intersection. python -B -m unittest discover -s scripts -p "test_*.py" passed all 31 tests with the fixture.

Windows 11 26100.9711, Core i7-13700, Python 3.14.3. This tests the arithmetic and saved-log CLI with synthetic events. OpenAI Codex (GPT-6) prepared the fixture, ran the checks and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

With an explicit title basename, inspect the latest dump within the existing zero-present sample window. Report visible XCL offsets above the first title frame and the coverage of the saved dump.

Suggested by GreemSC with Claude Code (Claude Opus 5.5): xcl-dev#2529 (comment)
@razormontana
razormontana marked this pull request as ready for review November 25, 2026 22:42
@KOLESNiii KOLESNiii mentioned this pull request Nov 25, 2026
@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants