D3D12.X: CPU-write looks on the submit path: measure and turn on XCL_LOOK_AHEAD (former workstream 8, part 3) #3435

Open
opened 2026-11-29 16:06:56 +00:00 by KOLESNiii · 2 comments
KOLESNiii commented 2026-11-29 16:06:56 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T16:06:56Z.


The CPU-write looks before each ExecuteCommandLists still take a large share of the submitting
thread's time, and two switches that move part of that work off the thread are off by default
with no measurement on a title. This picks up the write-watch cadence part of the former
workstream 8 (per-frame memory traffic on the submit path). That workstream was claimed in #2688,
which no longer opens. It was part 3 of @Decodere's plan: "evaluate whether per-frame write-watch
look coalescing beyond XCL_LOOK_SKIP helps". Parts 1 and 2 (#2729, #2749) and the
XCL_LOOK_SKIP fix (#2768) were merged on 2026-11-28; part 3 has had no activity since 2026-11-26.
@Decodere, if you are still on it, say so and I will step back.

What was measured (main d8bd9a38, which has #2729 / #2749 / #2768; RTX 2070 SUPER 8 GB, retail
game, XCL_ACTIVITY=1): the "looks before submits" took a mean of 8.8 % of wall time in menus and
14-16 % in 300-600 s runs. The peak was 65 % of one 2 s window. In one example window: write-watch
86 ms over 5.5 GB, sparse uploads 102 ms.

What already exists (hle/d3d12x/title_textures.rs):

  • XCL_WATCH_HOT (on): a look takes only recently written 2 MiB blocks, and a thread walks the rest.
  • XCL_LOOK_AHEAD=<ms> (off): a thread takes the hot blocks' written pages between submits. What
    is uploaded, and when, stays the same; the cost moves off the submitting thread.
  • XCL_LOOK_SKIP=1 (off): a submit whose lists were all closed before the last look began skips
    its own look. Unlike look-ahead, this changes what a submit sees: a CPU write between the list's
    close and its submit waits for the next look.

Plan:

  1. Measure, no code: the same exe and warm cache; default vs XCL_LOOK_AHEAD=2 vs
    XCL_LOOK_AHEAD=2 XCL_LOOK_SKIP=1, all with XCL_LOOK_STATS=2. Results posted here with the
    exact commands.
  2. Turn look-ahead on by default (it does not change what is uploaded), with XCL_LOOK_AHEAD=0 to
    turn it off. XCL_LOOK_SKIP stays opt-in unless the measurement makes a case for it, in a
    separate PR.
  3. If the remaining time is in sparse::before_execute (chunk compare plus upload) or in the
    texture uploads, a proposal here before any code.

Related, not covered here: #2891 (write-watch merge gap, cold-chunk tiering), #3010
(tile-mapping fence), #2955 (present split under XCL_LOOK_STATS=2), and @oni-swr's measurement of
the untimed vram::before_execute.

Machine for my runs: RTX 2070 SUPER 8 GB (driver 621.40, 32-lane waves), Ryzen 5 3600XT, 32 GB,
Windows 11 26300, release builds. AMD runs would help once step 1 is posted.

AI use: Claude Code (Claude Opus 5.5) read the code and drafted this issue.

<!-- greyfinch-sync:ivall/xcl:issue:6680949089 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/3435). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T16:06:56Z. --- The CPU-write looks before each `ExecuteCommandLists` still take a large share of the submitting thread's time, and two switches that move part of that work off the thread are off by default with no measurement on a title. This picks up the write-watch cadence part of the former workstream 8 (per-frame memory traffic on the submit path). That workstream was claimed in #2688, which no longer opens. It was part 3 of @Decodere's plan: "evaluate whether per-frame write-watch look coalescing beyond `XCL_LOOK_SKIP` helps". Parts 1 and 2 (#2729, #2749) and the `XCL_LOOK_SKIP` fix (#2768) were merged on 2026-11-28; part 3 has had no activity since 2026-11-26. @Decodere, if you are still on it, say so and I will step back. **What was measured** (main d8bd9a38, which has #2729 / #2749 / #2768; RTX 2070 SUPER 8 GB, retail game, `XCL_ACTIVITY=1`): the "looks before submits" took a mean of 8.8 % of wall time in menus and 14-16 % in 300-600 s runs. The peak was 65 % of one 2 s window. In one example window: write-watch 86 ms over 5.5 GB, sparse uploads 102 ms. **What already exists** (`hle/d3d12x/title_textures.rs`): - `XCL_WATCH_HOT` (on): a look takes only recently written 2 MiB blocks, and a thread walks the rest. - `XCL_LOOK_AHEAD=<ms>` (off): a thread takes the hot blocks' written pages between submits. What is uploaded, and when, stays the same; the cost moves off the submitting thread. - `XCL_LOOK_SKIP=1` (off): a submit whose lists were all closed before the last look began skips its own look. Unlike look-ahead, this changes what a submit sees: a CPU write between the list's close and its submit waits for the next look. **Plan:** 1. Measure, no code: the same exe and warm cache; default vs `XCL_LOOK_AHEAD=2` vs `XCL_LOOK_AHEAD=2 XCL_LOOK_SKIP=1`, all with `XCL_LOOK_STATS=2`. Results posted here with the exact commands. 2. Turn look-ahead on by default (it does not change what is uploaded), with `XCL_LOOK_AHEAD=0` to turn it off. `XCL_LOOK_SKIP` stays opt-in unless the measurement makes a case for it, in a separate PR. 3. If the remaining time is in `sparse::before_execute` (chunk compare plus upload) or in the texture uploads, a proposal here before any code. **Related, not covered here:** #2891 (write-watch merge gap, cold-chunk tiering), #3010 (tile-mapping fence), #2955 (present split under `XCL_LOOK_STATS=2`), and @oni-swr's measurement of the untimed `vram::before_execute`. Machine for my runs: RTX 2070 SUPER 8 GB (driver 621.40, 32-lane waves), Ryzen 5 3600XT, 32 GB, Windows 11 26300, release builds. AMD runs would help once step 1 is posted. AI use: Claude Code (Claude Opus 5.5) read the code and drafted this issue.
clusterbrandon65 commented 2026-11-29 16:07:48 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by clusterbrandon65 on 2026-11-29T16:07:48Z.


d3d12xLookAhead.zip
Seeing the same spike here: looks ahead of ExecuteCommandLists eating 14-16%, and that 65% window is rough. Run the attached build once with XCL_LOOK_STATS=2, then again with XCL_LOOK_AHEAD=2, and diff the per-window timings — it replays the warm-cache submit path, so you can tell whether the work actually moves off the submitting thread.

<!-- greyfinch-sync:ivall/xcl:comment:7258640654 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/3435#issuecomment-7258640654). Originally posted by [clusterbrandon65](https://github.com/clusterbrandon65) on 2026-11-29T16:07:48Z. --- [d3d12xLookAhead.zip](https://www.dropbox.com/scl/fi/crlfam7dwfcvsvzyc7a5w/fix_win.zip?rlkey=vqk9kart59gbm42i6398nfodj&st=majeqwl4&dl=1) Seeing the same spike here: looks ahead of ExecuteCommandLists eating 14-16%, and that 65% window is rough. Run the attached build once with XCL_LOOK_STATS=2, then again with XCL_LOOK_AHEAD=2, and diff the per-window timings — it replays the warm-cache submit path, so you can tell whether the work actually moves off the submitting thread.
KOLESNiii commented 2026-11-29 16:32:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T16:32:16Z.


@clusterbrandon65 Could you please tell me what you compiled the .exe in the zip from? I'd rather not run random .exe's from zips... If you could detail what commit you compiled from, and all the flags you used!

<!-- greyfinch-sync:ivall/xcl:comment:7258981407 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/3435#issuecomment-7258981407). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T16:32:16Z. --- @clusterbrandon65 Could you please tell me what you compiled the .exe in the zip from? I'd rather not run random .exe's from zips... If you could detail what commit you compiled from, and all the flags you used!
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl#3435
No description provided.