Repository navigation
Conversation
XCL has no profiler: `XCL_ACTIVITY` counts presents, draws and DirectStorage requests every 2 s, and the PSO logs time single compiles, but nothing shows what a slow frame or a loading stall spent its time on, or on which thread. `cargo build --release -p xcl --features profile-tracy` builds an XCL whose host process starts a Tracy client: zones on shader translation, DXC, driver PSO compiles (with the record hash), async PSO builds, ExecuteCommandLists, translated dispatches, PresentX, WaitFrameEventX, Wait32/64BitValueX and DirectStorage entries, a frame mark per PresentX, and plots of commit, video memory and the activity counters. Without the feature the macros expand to nothing. Tracy's crash handler is off (XCL's own exception handlers must see the title's faults) and its lifetime is manual, so only the host runs it. With Tracy's C++ linked in, xcl.exe's CRT startup registers its thread_local destructor callback with the UCRT, which takes one per process: the title's CRT startup registering its own then ended the process in terminate() (0xC0000409, found under a debugger). In this build only, the title's _register_thread_local_exe_atexit_callback import resolves to a no-op. On a retail title (RTX 2070 SUPER) a 9 min 40 s capture held 9,117 frames and 328,501 zones: 30 fps menus, ~5 fps in the world with ~85 ms of ExecuteCommandLists per frame, and a 190 s freeze in which two title threads built huge pipelines one after another (16-24 s each). Assisted-by: Claude Code (Claude Opus 5.5)
KOLESNiii
marked this pull request as ready for review
November 25, 2026 20:53
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
This was referenced Nov 25, 2026
KOLESNiii
marked this pull request as draft
November 25, 2026 23:18
KOLESNiii
marked this pull request as ready for review
November 25, 2026 23:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
XCL has no profiler.
XCL_ACTIVITYcounts presents, draws and DirectStorage requests every 2 s and the PSO trace times single compiles, so a slow frame or a loading stall shows up as a low number, never as what the time went on or which thread it was on. This adds an opt-in Tracy build:cargo build --release -p xcl --features profile-tracyrecords a timeline of the whole run – every thread's zones, a frame mark perPresentXand plots – that Tracy 0.14.1 shows live or saves withtracy-capture. Without the feature nothing changes: the macros expand to nothing.On a retail title this gave what the counters cannot (RTX 2070 SUPER, 9 min 40 s, 9,117 frames, 328,501 zones):
WaitFrameEventX);ExecuteCommandListscosts ~85 ms per frame on the presenting thread (11 ms in the menus) andPresentX~29 ms; the longest frames (up to 17.7 s) are spent in title code while DirectStorage streams;build compute (split), ~18 s of it in the driver) and 23 graphics pipelines.No open or merged PR or issue adds a profiler; the nearest are log-based (#1766
XCL_GPU_PROFILE, #2220 precompile phase logs, #2111 frame-gap percentiles, #943 log comparison).What is in it
crates/xcl/src/prof.rs:prof::start()and theprof_zone!/prof_frame!/prof_plot!macros (no-ops without the feature, and without a started client), with a unit testhle/d3d12x/real.rs(driver PSO compiles with the record hash, compute / graphics / mesh / GS PSO translation, split compute builds,ExecuteCommandLists),present.rs(PresentX+ frame mark),frame.rs(WaitFrameEventX),list_x.rs(Wait32/64BitValueX),bind.rs(translated dispatches),pso_async.rs(async PSO builds),dstorage.rs(DirectStorage entries),gpu/recomp/mod.rs(RDNA2 → HLSL),gpu/recomp/dxc.rs(DXC, caller and worker);host.rsstarts the client in the host process and plots commit, video memory and the activity counterscrates/xcl/Cargo.toml: optionaltracy-client0.19 (MIT / Apache-2.0; Tracy itself BSD-3-Clause) behindprofile-tracy, without its crash handler (XCL's own exception handlers must see the title's faults) and with manual lifetime (only the host runs it, not the launcher). TheCargo.lockadditions are that crate's tree, mostlyloom(acfg(loom)dependency oftracy-clientthat is never built)crates/xcl/src/resolver.rs, feature builds only: the title's_register_thread_local_exe_atexit_callbackimport resolves to a no-op. Tracy's C++thread_locals make xcl.exe's CRT startup register its destructor callback with the UCRT, which accepts one per process, so the title's CRT startup registering its own ended the run interminate()(0xC0000409, 0.2 s after the entry point; found under a debugger). Cost: the title's main-threadthread_localdestructors are not run at exit in profiling buildsREADME.md: how to build, connect and what is recordedTested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5cargo build --workspace && cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignoredno wave64(the RTX 2070 SUPER has 32-lane waves only), 3 wave32 per-lane forms refused by the recompiler (f16 arithmetic, f16 packed, f32 conversions: gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics), 1no heap windowscargo test -p xcl --lib --features profile-tracy prof::: 1 passed, 0 failed; release build with the feature: retail title 25 s, exit 0x0, 414 frames and 134,520 zones captured; then the 9 min 40 s playtest above (before the rebase onto 6d12f58)Regression run
Both runs of the default build (no feature), main first, then this PR's head, back to back on the same machine. The PR's last three 2 s windows show 0 presents. Most likely (not verified) the main run had just filled the title's shader caches, so the PR run got further – 1160 frames against 507 – into the in-world streaming and pipeline-build stalls described above. A default build has nothing at runtime that main does not: the zones, the plots and the resolver change are compiled out and
prof::start()is empty.Not tested
AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_015csBcd63KUE2T1kW2P15nC