D3D12.X: XCL_GPU_PROFILE logs the console programs that take GPU time #1766
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!1766
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1766"
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?
@wondercrash on GitHub · 2026-11-24 20:23 UTC · original
wondercrash:pr/gpu-profile→main· +522 −6 · 7 files · 1 commits · openDiagnostics only, off by default. Nothing in XCL measures GPU time per draw or dispatch, so a run where the GPU is busy but the title crawls cannot say which console programs the time goes to. With
XCL_GPU_PROFILE=1every draw, dispatch and ExecuteIndirect of console code gets a GPU timestamp pair, and every 2 s the log names the 15 console programs that took the most GPU time.This is how we found why a retail title's intro cutscene ran at 0.3-0.5 fps with the GPU at 98-100 %: full-screen compute passes of 150-580 ms each (e.g.
CS 79d178afa02abd49 Dispatch; 8x8x1 threads, wave32, ...: 1 call(s), longest 161.6 ms (320x180x1 groups)), which led to the cause (a separate change).Related, and different: #1065 (
XCL_GPU_TIMING) timesExecuteCommandListson the CPU; #1323 (XCL_GPU_CULPRIT) marks dispatches to name the ones a stalled queue has not finished; #1592 names the pipeline at a DRED fault; #996 is about timestamps on hosts without GPU timestamps. None measures GPU time per program.What is in it
crates/xcl/src/hle/d3d12x/gpu_profile.rs(new):begin/endrecordEndQuery(TIMESTAMP)before and after the op and aResolveQueryDataof the pair into a readback ring (2^17 pairs; one query heap and one readback buffer, made at the first timed op); a reporter thread takes the written pairs every 100 ms and logs every 2 s (every 20 s also the totals since the start): hash, kind, calls, total and longest ms, the group counts of the longest call, and for compute the thread group size, wave64 / split form, code and DXIL size. Ticks are converted with a title queue'sGetTimestampFrequency(note_queue). Tests:a_pair_counts_once_both_stamps_are_written_and_in_order,programs_are_ranked_by_their_total_and_keep_their_longest_call.bind.rs,console_list.rs: the timed call sites (Dispatch, console-list Dispatch, both ExecuteIndirect paths, DrawInstanced, DrawIndexedInstanced). The ExecuteIndirect span includes #1791'sfresh_indirect_arguments.real.rs: with the profile on, a translated pipeline's console shader hashes are kept (PSO_SHADERS, as for the frame trace) and a compute program's shape is noted; title queues are noted at submit (list_x.rskickoff_xtoo).gpu/recomp/pso.rs:compute_shape(thread group size, wave64, code size of a console CS).LazyLockread.Limits (in the module doc): queues that overlap on the GPU are each charged in full, so the sum can exceed wall time; bundles get no stamps; a recording run again without a Reset is counted once; the resolve waits on the GPU for the op to finish, so with the profile on a queue runs its ops one after the other (the numbers are per op, not the frame time).
Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4:5a3fc0conmain6020a33,--no-fail-fast): 1151 passed, 5 failed, 46 ignored (no new build warnings);main6020a33: 1150 passed, 4 failed, 46 ignored.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState:0x8007000E, seeds 70, 545, 1019, 1507), the same when run alone onmain. The fifth on this PR,offline_compute_pipeline_is_reused_by_a_second_process, failed once in the full run and passed when run alone on this PR and onmain.V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).XCL_GPU_PROFILE=1, on our integration branch (main+ other PRs) with the same code:GPU timestamps at 1000000000 Hz; from 60 s the 2 s blocks read 1.9-2.1 s of GPU time per 2 s (e.g.last 2.0 s: 1920.5 ms of GPU time in 2905 op(s) of console code (3253 in flight, 0 lost, 0 out of order)), with the programs above at the top. In a later run with those programs changed, the same blocks showed79d178going from ~156 ms to a few ms.Regression run
.\scripts\smoke.ps1 -Game <retail title> -Seconds 60, no input (both runs stay on the start screen), profile off as in any run without the variable,mainfirst, same machine:Not tested
main+ this PR alone; on this PR's head the profile was only checked by the suite. The regression pair runs with the profile off.AI use
mainand ran the suite; omp with Claude Sonnet 5.5 rebased it onto6020a33; omp with Claude Opus 5.5 reran the suite and the regression pair. The title runs are ours, on the hardware above.@futurepro62 on GitHub · 2026-11-24 21:22 UTC · original · edited 2026-11-24 21:44 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
c433edb(on its base85e3826).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 875 passed, 0 failed, 42 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.a_pair_counts_once_both_stamps_are_written_and_in_order,programs_are_ranked_by_their_total_and_keep_their_longest_call.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 877 passed, 0 failed, 42 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)).--skipon NVIDIA. Both fail on main7f7e768too, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns their skips into failures.heap_window_out_of_memory_falls_back_to_the_switch_formskips whenXCL_HEAP_WINDOWSis unset (#1651), andshaders::tests::pso_measurement_compiles_an_exact_synthetic_recordskips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not setXCL_REQUIRE_GPU, so there both just print SKIPPED.Not tested
AI use
@JJAutoCompare on GitHub · 2026-11-25 03:43 UTC · original
PR #1766 compatibility verification on Intel Arc A770
Tested
Clean detached head
c433edbe8d7565b3d8c4413374bba2804a3f66e7on STOR-WINLAB, Windows 11 Enterprise Evaluation build 26200.9974, Ryzen 7 3800X, Intel Arc A770 16 GiB, driver 32.0.101.9175 (no FP64, wave range 8–32). Rust 1.100.0 (0ef1bc386), DXC/DXIL 1.9.2609.5, unoptimized profiles with debug info disabled.cargo build --workspaceandcargo test --workspace --no-runsucceeded. All test execution used the shared Arc lock.cargo test -p xcl --lib gpu_profile::tests -- --nocapturepassed 2 tests covering timestamp-pair validation and program ranking by total ticks with longest-call tracking.cargo test -p xcl --test gpu_compute_e2e console_wave64_compute_through_the_pso_hook_dispatch_and_read_back -- --nocapturepassed on Arc withXCL_GPU_PROFILE=1. The translated shader's readback matched and the queue hook logged 19.2 MHz.cargo test -p xcl --lib timestamps_outside_unified_memory_land_after_the_queue -- --nocapturepassed.cargo test -p xcl --test e2e test_title_runs_and_game_folder_is_untouched -- --nocapturewith profiling enabled initialized the profiler and logged the timestamp clock. The title failed itsRSSetDepthBiasXpixel check and exited before the first two-second reporting window. The same pixel failure occurred with profiling disabled.Full workspace suite
cargo test --workspace --no-fail-fast -- --test-threads=4with profiling disabled exited 101. The 20 summaries inpr1766-suite.logtotal 859 passed, 18 failed, 42 ignored. The log contains 4SKIPPEDlines, excluded from coverage.Not tested
Per-program timing rows and long-run profiling, retail-title smoke or a main-branch baseline, sample-data paths, the D3D12 debug layer (DLL absent), and other adapters.
AI use
T3 Code / Codex (
gpt-6.2-sol,reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified counts againstpr1766-suite.logand published this report.@upipibi on GitHub · 2026-11-25 09:39 UTC · original · edited 2026-11-25 09:50 UTC
NVIDIA test report for
5a3fc0c(part of #2057's stack). RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug. The PR is merged ontomain568e7db, full build (cargo build --workspace && cargo build --workspace --tests).cargo test --workspace --no-fail-fast -- --test-threads=4: 1155 passed, 1 failed, 46 ignored.hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime, the playback-timing test of #1600. A different XAudio2 voice test fails from run to run on this machine; onmain9e3831eearlier today it wasopus_source_voice_decodes_and_manages_lifetime. It's not from this change.test_title_runs_and_game_folder_is_untouchedpasses.no wave64, plusper-lane form: refused,no heap windows,cannot disable the driver cacheand Developer Mode off.main568e7dbon the same machine: 1153 passed, 1 failed with a--tests-only build. The one failure was that e2e test, which needs the full build; with it,cargo test -p xcl --test e2egives 3 passed, 0 failed.AI-assisted (Claude Code). Synthetic tests only; no title run.
@Daydream3r on GitHub · 2026-11-25 11:32 UTC · original
Independent RTX 5070 Ti measurements on pinned main + local #1766 port. The three requested #505 program times and successful world rendering remain unconfirmed.
Tree:
main f087b998d0d51a9f11bbfa0761967a63e778edd9+ local port of #1766 at5a3fc0cee469d5f39afb2c86589f1ca4d86fbefb. Only patch context changed to retain main'snote_resubmits; not the exact PR head. No #1323/#1580 in this tree.RTX 5070 Ti 16 GB / 621.01; Ryzen 7 9800X3D, 64 GB; Windows 11 Pro 25H2 26200.6584; Rust 1.100.0 MSVC, DXC/DXIL 1.9.2609.5. Debug tests, release game runs.
Build/tests
cargo test --workspace --locked --no-fail-fast -- --test-threads=4:Baseline failures also repeated separately with one test thread: four
gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0,1,2,3}(seeds 70/545/1019/1507,CreateComputePipelineState 0x8007000E);rerouted_disk_entries_follow_the_direct_translator(68 vs 1);pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa(85 becomes 28). Separately verified exact #2233 removes the latter two: paired test report.Game runs
Retail 1.0.2.1, same profile executable, isolated saved-data/cache copies seeded identically from a prior clean-main run.
XCL_GPU_PROFILE=1 XCL_HEAP_WINDOWS=1 XCL_COHERENT_HEAPS=0 XCL_COHERENT_MB=512 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_TRACE=1 XCL_PRESS_A_AT=15,18,...,90. Direct first, HLSL second, selective-skip last. NVIDIA cache not cleared; no cold-cache or speedup claim. No general PSO wait budget/preload override. External memory/time guard did not trigger.XCL_DIRECT_DXIL=1XCL_PSO_IMAGE_SKIP=1All three: exit 0 at cap, no crash/device removal or GPU-wait timeout. Direct/HLSL loading then black window checked; no world rendering confirmed. Final image of the selective-skip run not captured. Default HLSL includes main's automatic enormous-program rerouting. HLSL/skip add stock thread snapshots at 100/200/280 s; direct has none.
Last cumulative profile blocks, respectively:
Example cumulative split-wave64 row:
1e32f25121c1552fhas 1654 calls / 72.8 ms total / 0.6 ms longest in direct and 1608 / 86.5 / 0.6 in HLSL (longest groups 5x5x33). Inputs/counts differ. HLSL71f4ac8ad5eba33c: 2 calls, 82.2 ms total, 41.1 ms longest, groups 1x1x1.50625695d2e6cbe7,206ed63b96be21a1,a9f2cd53943d5dc4appear in none of the printed top-15 rows. Only completed pairs are ranked; absence does not prove a shader did not run. A built PSO is not an executed dispatch. Profiling serializes each queue's operations and overlapping queues are charged in full.HLSL snapshots at 200.040/280.041 s show the same unnamed thread in
pso_async::resolve_wait -> bind::execute_indirect, with DXC/NVIDIA compilation elsewhere (matched saved PDB; stock unwind limits). GPU utilization snapshots around 118/228/297 s: 13/12/14 percent. This does not identify the awaited PSO. Selective skip exercised #2176's path (at least 33 pending pipelines reported left out), without confirmed world rendering. DirectStorage failed-request activity sums: 0 / 706 / 1762 (0x89240009), additional confounders rather than proof of bad archives.Not tested: fully precompiled pack, per-lane arm, AMD/Intel/native wave64, DRED/Aftermath. These observations do not replace official clean-head smoke checks or imply merge approval. Raw logs and game/cache/shader binaries stay local.
AI use: Codex desktop, GPT-6 (exact variant not exposed), source inspection, local port, actual builds/tests/runs, extraction, offline symbol resolution and this report.
@DavidM1911 on GitHub · 2026-11-26 06:17 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.