d3d12: add opt-in GPU timing and AS compaction handshake trace #532
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/532"
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?
Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T20:13:25Z.
Summary
Adds opt-in per-pipeline GPU timing attribution (
TUXBOX_GPU_TIMING=1) and acceleration-structure compaction handshake tracing (TUXBOX_TRACE_AS_COMPACTION=1) intuxbox-d3d12:runtime/d3d12/src/gpu_timing.rs,commands.rs,commands/recording.rs,commands/ray_dispatch.rs,commands/submit.rs,diagnostics/gpu_trace.rs,docs/ENVIRONMENT.md): AddsListTimerand fence-backed batch retirement (gpu_timing::submit/reapusingretire_fence, logging the top 20 pipelines every 10 seconds whenTUXBOX_GPU_TIMING=1). Brackets compute dispatches, graphics/mesh/indirect draws, andDispatchRays, and enablesdiagnostics::gpu_trace::namewhenTUXBOX_GPU_TIMING=1without modifying pipeline creation modules.runtime/d3d12/src/diagnostics/compaction.rs,diagnostics.rs,commands/raytracing.rs,device/blas.rs,docs/ENVIRONMENT.md): Records compaction postbuild queries (note_request), copy handshakes (note_copy), and published guest addresses (blas::published) whenTUXBOX_TRACE_AS_COMPACTION=1.runtime/d3d12/src/tests/gpu_timing.rs,runtime/d3d12/src/tests/diagnostics_compaction.rs): Verifies timing helper defaults and compaction diagnostic state.Note:
submit.rs,recording.rs,ray_dispatch.rs, andblas.rsoverlap with open PRs#507,#512, and#406.Prepared with AI assistance; all changes were reviewed and verified with host checks, Wine unit tests, and both NVIDIA and AMD GPUs.
Tested
Run the checks relevant to this change.
No new Lanes scenario was added because both
TUXBOX_GPU_TIMING=1andTUXBOX_TRACE_AS_COMPACTION=1are opt-in diagnostic paths off by default; default execution (10/10D3D12 regressions and126/126verify tests) passes with zero regressions on both NVIDIA and AMD, and diagnostic formatting/state helpers are covered bytests/gpu_timing.rsandtests/diagnostics_compaction.rs.GPU, driver and backend:
10de:1e84), driver620.73.04, GE-Proton11-14 (vkd3d-proton)1002:13c0), RADV / Mesa26.3.1, GE-Proton11-14 (vkd3d-proton)Commands run and their results:
Checks
CI runs the Python unit tests, the shader compiler, DXBC, and XG layout tests, and a Windows typecheck of
tuxbox-d3d12.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T21:41:56Z.
Thanks. Opt-in GPU timing is useful next to the frame log. It conflicts with
mainnow (commands/recording.rs,diagnostics/gpu_trace.rsanddocs/ENVIRONMENT.md, probably with #541's marker names). Could you rebase it? Then we'll put it through the check.Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T22:24:36Z.
@brcly Rebased #532 onto
main(6bab5478, commit7ec2a41b), preserving #541's PIX marker /markers_wanted()updates ingpu_trace.rs/recording.rs/docs/ENVIRONMENT.mdand #512'sconsume_tablesinrecording.rs.DXC=<dxc> python3 tuxbox.py check --no-gpu(9/9) andcargo check --tests --target x86_64-pc-windows-msvcontuxbox-d3d12passed. ProjectScarlett was not re-run since the rebase.Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-30T01:32:41Z.
Rebased onto
main(f482572a, commit072ec7d57a3f) with no functional changes from7ec2a41b, and ran the changed GPU checks on NVIDIA (headlessxvfb-runwithWAYLAND_DISPLAY=""):WAYLAND_DISPLAY="" TUXBOX_CHECK_JOBS=2 DXC=<dxc> xvfb-run -a -s "-screen 0 2560x1440x24" python3 tuxbox.py check --changed --adapter 10de:1e84 --proton <proton> --prefix <prefix> --windows-dxc <windows-dxc>10de:1e84), driver620.73.04,GE-Proton11-14Lanes and fixtures on the GPU(d3d12-*,guest-frame,present,lanes,lanes-*) and allD3D12 regression controls(22/22) passed (13 passed, 0 failed, 0 not run).Evidence: TuxBox check of 072ec7d57a3f, no uncommitted changes, GPU 10de:1e84: 13 passed, 0 failed, 0 not runImported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T03:02:32Z.
The AMD check you were missing, on
072ec7d5: AMD iGPU (1002:13c0, RADV, Mesa 26.0.8, GE-Proton11-14, Linux), fullpython tuxbox.py check: 199 pass, 0 fail. ProjectScarlett was not run on this commit.Evidence: TuxBox check of
072ec7d57a, no uncommitted changes, GPU 1002:13c0: 14 passed, 0 failed, 0 not runImported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T04:12:19Z.
Heads-up: main just landed a large cleanup (up to
e5d2e913), so this PR needs a rebase.rustfmt.toml).unwrap(), lossyascasts and undocumentedunsafeoutside tests.cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests.The least painful way is to format your branch first, so the rebase only shows real changes:
Then run
python tuxbox.py check --no-gpu, which now includes the format step.If clippy flags something new:
Fromfor widening,TryFromfor narrowing, and a mask for bit fields.unwrap(): use?, orexpectwith the reason it can't fail.unsafeblock: it needs a// SAFETY:comment.CONTRIBUTING's "Code checks" section lists the commands. Thanks!