D3D12.X: the looks line splits "the rest" and shows the longest look #2144

Open
github-bot wants to merge 2 commits from github-bot/gh-2144 into main AGit
Owner

@⁠ozimchuk on GitHub · 2026-11-25 06:13 UTC · original
ozimchuk:activity-submit-work → main · +159 −6 · 4 files · 2 commits · draft

Stacked on #1832 (@⁠marquezinii); only the top commit, f8eeef4, belongs here. It replaces this PR's earlier version, which added a second XCL_ACTIVITY line for the same looks – I had missed #1832 when I opened it.

#1832's looks before submits line gives the write-watch and the copies into sparse video memory, and leaves "the rest" as one number. On a retail title under Linux that rest was a large part of the look, so this splits it, and adds the longest look of the period: one slow look is a stall that the 2 s sum hides.

looks before submits (2 s): 181 looks took 1566 ms (78.3 % of the time, longest 14 ms): write-watch 1180 ms (14329.7 MB watched a look, 171831 pages written), copies into sparse video memory 112 ms, the rest 273 ms (view-source recheck 0, VRAM pages 0, streamed-texture recheck 1, choosing uploads 195, uploads 11 MB: hash 30, detile 11, submit 38; other 0)

(retail title, world load, main 06c9f55 + #1832 + this commit; Linux, NVIDIA (32-lane waves))

What is in it

  • crates/xcl/src/hle/d3d12x/title_textures.rs: with XCL_ACTIVITY, refresh_once and upload_all time the parts of the rest – the view-source recheck, vram::before_execute, the streamed-texture recheck (#2029), choosing the uploads, and per batch the content hash (with its read), the detile and the submit (with its wait), plus the bytes uploaded; look_parts().
  • crates/xcl/src/hle/d3d12x/sparse.rs: note_look keeps the longest look (take_longest_look); look_line takes the parts and the longest look; what the parts do not cover is "other". The unit test covers the new fields and an idle period.
  • crates/xcl/src/host.rs: passes both to the line.
  • HANDOFF.md: the line's description.

Without XCL_ACTIVITY nothing is timed (one OnceLock read per part).

Tested

  • NVIDIA (32-lane waves), Linux, Wine 11.21 + vkd3d-proton (dxil-spirv 694cc67), release build for x86_64-pc-windows-gnu, Rust 1.100.0.
  • cargo test -p xcl --lib --release -- --test-threads=4 on this head: 1 186 passed, 11 failed, 26 ignored. 10 of them fail on main aaa931b here too (test data, DXIL validator and precision cases of this setup); the 11th, list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares, passes when run alone. d3d12x::sparse and d3d12x::title_textures alone: 16 and 18 passed, 0 failed, including the_look_line_splits_the_time.
  • The retail title, 120 s, XCL_ACTIVITY=1: the line above every 2 s, "other" 0–1 ms throughout. The run ends at ~82 s in xg::copy_from as main does here (#662; #684 fixes it).

Not tested

  • Windows, and a run past the world load on this exact head (main crashes at it here without #684).

AI use

  • Claude Code, Claude Opus 5.5 wrote the code and this description and ran the tests and runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H6JBZXaFw99FcnmUV1mPWj

AI-assisted.

**@⁠ozimchuk** on GitHub · 2026-11-25 06:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/2144) `ozimchuk:activity-submit-work` → `main` · +159 −6 · 4 files · 2 commits · draft Stacked on #1832 (@⁠marquezinii); only the top commit, `f8eeef4`, belongs here. It replaces this PR's earlier version, which added a second `XCL_ACTIVITY` line for the same looks – I had missed #1832 when I opened it. #1832's `looks before submits` line gives the write-watch and the copies into sparse video memory, and leaves "the rest" as one number. On a retail title under Linux that rest was a large part of the look, so this splits it, and adds the longest look of the period: one slow look is a stall that the 2 s sum hides. ``` looks before submits (2 s): 181 looks took 1566 ms (78.3 % of the time, longest 14 ms): write-watch 1180 ms (14329.7 MB watched a look, 171831 pages written), copies into sparse video memory 112 ms, the rest 273 ms (view-source recheck 0, VRAM pages 0, streamed-texture recheck 1, choosing uploads 195, uploads 11 MB: hash 30, detile 11, submit 38; other 0) ``` (retail title, world load, `main` `06c9f55` + #1832 + this commit; Linux, NVIDIA (32-lane waves)) **What is in it** - `crates/xcl/src/hle/d3d12x/title_textures.rs`: with `XCL_ACTIVITY`, `refresh_once` and `upload_all` time the parts of the rest – the view-source recheck, `vram::before_execute`, the streamed-texture recheck (#2029), choosing the uploads, and per batch the content hash (with its read), the detile and the submit (with its wait), plus the bytes uploaded; `look_parts()`. - `crates/xcl/src/hle/d3d12x/sparse.rs`: `note_look` keeps the longest look (`take_longest_look`); `look_line` takes the parts and the longest look; what the parts do not cover is "other". The unit test covers the new fields and an idle period. - `crates/xcl/src/host.rs`: passes both to the line. - `HANDOFF.md`: the line's description. Without `XCL_ACTIVITY` nothing is timed (one `OnceLock` read per part). **Tested** - NVIDIA (32-lane waves), Linux, Wine 11.21 + vkd3d-proton (dxil-spirv `694cc67`), release build for `x86_64-pc-windows-gnu`, Rust 1.100.0. - `cargo test -p xcl --lib --release -- --test-threads=4` on this head: 1 186 passed, 11 failed, 26 ignored. 10 of them fail on `main` `aaa931b` here too (test data, DXIL validator and precision cases of this setup); the 11th, `list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares`, passes when run alone. `d3d12x::sparse` and `d3d12x::title_textures` alone: 16 and 18 passed, 0 failed, including `the_look_line_splits_the_time`. - The retail title, 120 s, `XCL_ACTIVITY=1`: the line above every 2 s, "other" 0–1 ms throughout. The run ends at ~82 s in `xg::copy_from` as `main` does here (#662; #684 fixes it). **Not tested** - Windows, and a run past the world load on this exact head (`main` crashes at it here without #684). **AI use** - Claude Code, Claude Opus 5.5 wrote the code and this description and ran the tests and runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01H6JBZXaFw99FcnmUV1mPWj AI-assisted.
Before every title submit XCL looks for the CPU's writes (write-watch
over the watched ranges), copies them into sparse video memory and
uploads changed title textures, on the title's own thread. On slower
CPUs that look is most of the frame (2-6 fps on an i9-9900K in #582),
but the only record of it is the cumulative timing line logged at
power-of-two submit counts, so a report at a few fps cannot say how
much of each second went there.

With XCL_ACTIVITY=1 every 2 s now also logs the looks of the last 2 s:
how many, their whole time and its share of the 2 s, the write-watch
scan with the megabytes it watched a look and the pages it found, the
copies into sparse video memory, and the rest. Without XCL_ACTIVITY
only counters are added: two Instant::now() calls per look and a sum
over the cached ranges.
The `looks before submits` line (#1832) leaves "the rest" of a look as one number. Its parts
are timed now: the view-source recheck, the VRAM pages' sync, the recheck of streamed textures
outside the write-watch, choosing the textures to upload, and the uploads (MB; the content hash
with its read, the detile, the submit with its wait), with what is left as "other". The line
also gives the longest look of the period: one slow look is a stall an average hides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:20:24 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 06:49 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 06:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2144#issuecomment-7155195416) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 08:15 UTC · original

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

**@⁠DavidM1911** on GitHub · 2026-11-26 08:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/2144#issuecomment-7186373811) 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
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2144/head:github-bot/gh-2144'
git switch 'github-bot/gh-2144'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2144'
git switch 'github-bot/gh-2144'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2144'
git switch 'github-bot/gh-2144'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2144'
git switch 'main'
git merge --squash 'github-bot/gh-2144'
git switch 'main'
git merge --ff-only 'github-bot/gh-2144'
git switch 'main'
git merge 'github-bot/gh-2144'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.