Repository navigation
D3D12.X: with XCL_LOOK_STATS=2 split a present's time on the submitter - #2955
Conversation
|
One accounting detail for the #2729 integration, checked at A standalone Windows x64 fixture compiled this head’s OpenAI Codex assisted with verification. |
1a6ddc2 to
dd85383
Compare
|
Thanks, that's right: on the submission-driven fallback |
|
Tested PR #2955 ( Environment
|
| Scope | Intervals | ExecuteCommandLists |
waits for pipelines being built |
presents total |
waits of a present for the one before |
waits of a present for the last frame's copy |
copies of a present recorded and submitted |
swap chain Presents |
|---|---|---|---|---|---|---|---|---|
Full 180 s run |
87 |
4686 (76,902 ms) |
64 (3,226 ms) |
1760 (32,086 ms) |
3520 (0 ms) |
1760 (0 ms) |
27,148 ms (84.6%) |
4,818 ms (15.0%) |
In world (t >= 100 s) |
47 |
1382 (50,349 ms) |
64 (3,226 ms) |
108 (25,543 ms) |
216 (0 ms) |
108 (0 ms) |
22,895 ms (89.6%) |
2,624 ms (10.3%) |
World observations
- Once in the world (
t >= 100 s),presents(25,543 ms) accounted for ~33.6% of{ExecuteCommandLists + presents}submitter call time (75,892 ms), andcopies of a present recorded and submitteddominatedpresentsat89.6%(22,895 msacross108presents), withswap chain Presentsat10.3%(2,624 ms) and lock/copy waits at0 ms(residual remainder24 ms/0.1%). - Single 2 s world spikes reached up to
2172 msfor2presents (2167 msincopies of a present recorded and submitted,4 msinswap chain Presents, at144.993 s) and1654 msfor1present (1653 msincopies of a present recorded and submitted, at187.661 s).
|
I rebased #2955 head There is one accompanying accounting step, as you anticipated: add all four new present timers to On the resolved, uncommitted merge: Minimal rebase resolution and accounting test--- a/crates/xcl/src/hle/api_cost.rs
+++ b/crates/xcl/src/hle/api_cost.rs
@@
-pub const CALLS: [(Call, &str); 16] = [
+pub const CALLS: [(Call, &str); 24] = [
@@
- matches!(call, Call::PresentCopyWait | Call::PipelineWait | Call::ViewWant)
+ matches!(call, Call::PresentCopyWait | Call::PresentLockWait | Call::PresentRecord
+ | Call::PresentSwap | Call::PresentDumpWait | Call::PipelineWait | Call::ViewWant)
@@ submitter_summary_excludes_sub_calls_and_reports_completed_window
now[Call::PresentCopyWait as usize] = (2, 30_000);
+ now[Call::PresentLockWait as usize] = (1, 20_000);
+ now[Call::PresentRecord as usize] = (1, 30_000);
+ now[Call::PresentSwap as usize] = (1, 40_000);
+ now[Call::PresentDumpWait as usize] = (1, 50_000);
// The summary still ends with completed 400 ms (window 2000 ms).AI use: Codex (GPT-6.2 Sol) resolved the local merge, reviewed the timer nesting, ran the build and test, and drafted this reply. |
dd85383 to
c726229
Compare
c726229 to
80e2ee4
Compare
On a 16 GB NVIDIA card in the world, presents took 93 % of the submitting thread's time (xcl-dev#2688), but a present was one entry with only its wait for the copy of the frame before apart, so where that time goes could not be told. Four more entries, timed with XCL_LOOK_STATS=2 only, as that wait is: - the wait for the present before it (PresentX's lock, the presenter's), - the copy (or composite) of the frame recorded and submitted, from the allocator's reset to its Signal, - the swap chain's Present, which DXGI holds while the frames before it are queued (a GPU-bound frame waits there), - the wait for a frame dump's copy (XCL_FRAME_DUMP, XCL_DUMP_TARGETS), up to 2 s each. With XCL_ACTIVITY they appear in "calls of the submitting thread (2 s)" next to "presents"; what a present spends besides them is the rest (the plane checks, the frame-rate line, the device-removal check). No change with the switch off. When the fallback presents on a submission (a title that does not call PresentX), its parts are timed inside ExecuteCommandLists rather than inside presents, as the copy wait already was. They are sub-calls (is_sub_call, xcl-dev#2729), as the copy wait is, so the line's "completed" total counts each present once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80e2ee4 to
2aeec61
Compare
|
merge-check
|
|
merge-check claim |
|
merge-check |
Upstream since d52ff48: - 34035fc kernelx: unmark lazy away mappings in FreeTitlePhysicalPages (xcl-dev#1221, b3IKK) - e5c2bc6 VFS: ReadFileEx, WriteFile and scatter/gather commit lazy pages first (xcl-dev#1355, emirduran707) - a8683ef Recompiler: track SMEM register offsets as scalar reads (xcl-dev#1540, oni-swr) - 2aeec61 D3D12.X: with XCL_LOOK_STATS=2 split a present's time on the submitter (xcl-dev#2955, thisguyStan) Resolved into this fork's port, no upstream change dropped: - kernelx.rs: lazy::unmark in FreeTitlePhysicalPages; both regression tests inserted before the away-mapping test (context identical). - vfs_hooks.rs: ReadFileEx / WriteFile / WriteFileEx / scatter / gather hooks and ensure_segments next to this fork's ReadFile hook, with their atomics and install entries. - present.rs: PresentLockWait at PresentX's lock and at present_now's presenter lock; PresentRecord from the allocator reset to the Signal, dropped before the swap; PresentSwap around sc.Present; PresentDumpWait around the dump fence wait. This port has note_present() and no dumping_targets block, so those hunks were placed by hand; every timer line is upstream's verbatim. - rdna2.rs: OPR_SMEM_OFFSET is a scalar read in sgpr_uses, with its test. - kernelx/lazy.rs: mark is public for tests/lazy_file_io.rs. - api_cost.rs: four new Call variants, labels and is_sub_call, with the sub-call test.
Part of #2688 (workstream 8). Targets
main(b38197ae).In the world, presents take most of the submitting thread's time on NVIDIA (93 % on an RTX 4080 in #2729), but
calls of the submitting thread (2 s)shows a present as onepresentsentry, with only its wait for frame N−2's copy apart. WithXCL_LOOK_STATS=2, like that wait, this adds four entries:PRESENTX_LOCK,PRESENTER),Signal,Present(a GPU-bound frame waits there),XCL_FRAME_DUMP,XCL_DUMP_TARGETS).The rest of
presentsis the plane checks, the frame-rate line and the device-removal check. When the fallback presents on a submission (no PresentX), the parts run insideExecuteCommandLists, as the copy wait does. Like it, they are sub-calls (is_sub_call, #2729), socompletedcounts each present once.XCL_STALL_TRACEtimes only the swap chain'sPresent. Diagnostics only: no change with the switch off.What is in it
crates/xcl/src/hle/api_cost.rs: the four entries, their names inCALLSand inis_sub_call, and a test that a present is counted once.crates/xcl/src/hle/d3d12x/present.rs: the timers around the two lock waits, the recording and submit,Presentand the frame-dump wait.Tested
rustc 1.100.0, DXC 1.9.2602.17; tests in debug, smokes in release.cargo test --workspace --no-fail-fast -- --test-threads=4on80e2ee45(this PR onmain7db2f391): 2595 passed, 0 failed, 49 ignored. The head2aeec61cis the same patch rebased ontob38197ae(git range-diff: unchanged); the suite was not rerun on it.nvidia-dev(merged intomainsince). The timers are the same. Onmain, the present's copy is submitted without XCL's look at the title's memory, so the recording part should be smaller there.scripts/smoke.ps1on1a6ddc2c(release; the same code asdd85383e) withXCL_LOOK_STATS=2,XCL_PREPARE=0, 60 s in the intro and menus (1354 frames, no device removal, no crash). Everycalls of the submitting thread (2 s)line (from 12 s on) has the new entries. From 14 s on, the parts add up to thepresentsentry within 0–4 ms per 2 s (the rest of a present); the first present (12 s) took 51 ms, of them 1 ms in the parts. From 26 s on, every 2 s:XCL_FRAME_DUMP): that entry is not printed.dd85383ewithXCL_LOOK_STATS=2,XCL_ACTIVITY=1,XCL_PREPARE=0, played past the intro, were stopped as the world loads by a device removal (0x887a0005, no DRED breadcrumbs) and then the title's breakpoint at the same address (at 228 s and 114 s). its base then,ecc0bb57(nvidia-dev, now part ofmain), with the timers off stops the same way (223 s), so the world itself was not reached. In the first run, while the world loaded (178–226 s, 9–13 fps), every 2 s:presentswithin 0–4 ms,ExecuteCommandListstakes 57–1005 ms.Regression run
60 s runs of
scripts/smoke.ps1(JIT path: the script setsXCL_PREPARE=0) on the same title, with no pipeline cap. Each ran on its own copy of onemainshader cache.mainis this PR's base (b38197ae).XCL_LOOK_STATSwas unset, so these runs show the switched-off path.main(b38197ae):This PR (
2aeec61c):Not tested
ecc0bb57, onnvidia-devbefore its merge) stopped with a device removal as the world loads (above), so the split in the world is not measured here. The timers-on runs were not repeated onmain.XCL_FRAME_DUMP,XCL_DUMP_TARGETS) and the composite path of a present.AI use