D3D12.X: log the first title call of each command-list slot the newer layout moved #3139

Open
KOLESNiii wants to merge 1 commit from upstream-pr/3139 into main
KOLESNiii commented 2026-11-28 13:01:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T13:01:36Z.


Help wanted: evidence. This PR only measures and changes no behaviour; it is the first step for the console-layout guesses. Please run a title on this head and post D3D12.X: newer layout, first title call of ... ← ...: (...); the older layout's method there runs (one line per slot, always on; in the retail game's 60 s run none of the 16 watched slots was called) here (not the whole log). It shows which moved slots titles call and with what arguments, the evidence the newer-layout slot fixes need. The retail game logs none of these lines in 60 s, so we need other titles.

Overlap with #1274: #1274 rewrites NEWER_LIST_SLOTS as a multi-line table (a text conflict with the constant this PR adds above it) and installs older-layout handlers at #99 / #124 / #125 / #140, which are newer-layout collisions. If #1274 lands first, this PR adds those four to NEWER_LIST_COLLISIONS.

The newer console command-list layout inserts two marker methods at #59 / #60 and moves the

methods after them by two (three for the PC's List1 block). NEWER_LIST_SLOTS splits a slot only

where an older handler moved; where it stayed, the newer layout's method at that slot runs the

older handler with the wrong arguments, silently: #59 ExecuteIndirect for a GPU marker, #69

Write32BitValueBottomOfPipeX for a pipeline flush (writing title memory), #78 DispatchX for a

GDS write, #81 DrawIndexedX for a hi-stencil state, #94 RSSetDepthBiasX for CloseBundleX, and

others (from a console API audit).

Before changing these handlers, a probe on each of the 16 slots logs the first call from the

title once the newer layout is known, with its arguments, and forwards every call as before. A

run of a title then shows which collisions are live. No behaviour change.

What is in it

  • crates/xcl/src/hle/d3d12x/guard.rs: +49 / -0

  • crates/xcl/src/hle/d3d12x/real.rs: +15 / -0

  • new tests: a_layout_probe_logs_its_first_call_on_the_newer_layout_only

Tested

  • NVIDIA RTX 2070 SUPER (driver 32.0.16.2140), AMD Ryzen 5 3600XT, Windows 11 build 26300, Rust 1.100.0 MSVC; tests in debug

  • Current head 587b0508 (rebased onto main 765b2c5b to resolve conflicts): the suite has not been rerun on it; the counts below are from the earlier heads they name.

  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 5ade6ad5 (built on main 336fddda; it merges into the current main e429936c without conflict): 2123 passed, 9 failed, 48 ignored, 25 SKIPPED lines (21 no wave64, 3 #1426, 1 no heap windows).

  • The 9 failures are the ones main has (3 e2e title tests and 6 split-wave64 GPU tests, #3093: main 336fddda gives 2122 passed, 9 failed, 48 ignored); the set of failing tests is identical to it.

  • a_layout_probe_logs_its_first_call_on_the_newer_layout_only: ok in that run; fails without the change

Regression run

Current head 587b0508, rebased onto main 765b2c5b on 2026-11-28 to resolve conflicts with main. RTX 2070 SUPER, the retail game, 60 s, XCL_PRESS_AT=25:A, XCL_PREPARE=0 (no startup shader preparation), release builds; each run started from a copy of the same DXIL cache (one queue job: main, then PR heads one after the other).

main:

xcl-smoke v1
commit: 7db2f391cefd748d47c7de63d50dd43ebb852185
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1530 (PresentX 1530)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 17023 MB

This PR's head:

xcl-smoke v1
commit: 587b0508ea83475700eb957fb300766da416373b
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail game
seconds: 60
exit: 0x0
frames shown: 1555 (PresentX 1555)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15307 MB

Not tested

  • Full preparation. The smoke runs used XCL_PREPARE=0.

  • No behaviour change. Whether any title hits one of the 16 slots: that is what the log lines will show.

  • AMD and Intel GPUs; wave64 hardware (the RTX 2070 SUPER is wave32).

AI use

  • Codex (exact model name unavailable) verified the queued smoke results and drafted this description update.

  • Claude Code, Claude Opus 5.5: the code and tests. The description and the test / suite runs: Claude Code, Claude Sonnet 5.5 and Claude Opus 5.5.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5540377385 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3139). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-28T13:01:36Z. --- **Help wanted: evidence.** This PR only measures and changes no behaviour; it is the first step for the console-layout guesses. Please run a title on this head and post `D3D12.X: newer layout, first title call of ... ← ...: (...); the older layout's method there runs` (one line per slot, always on; in the retail game's 60 s run none of the 16 watched slots was called) here (not the whole log). It shows which moved slots titles call and with what arguments, the evidence the newer-layout slot fixes need. The retail game logs none of these lines in 60 s, so we need other titles. **Overlap with #1274:** #1274 rewrites `NEWER_LIST_SLOTS` as a multi-line table (a text conflict with the constant this PR adds above it) and installs older-layout handlers at #99 / #124 / #125 / #140, which are newer-layout collisions. If #1274 lands first, this PR adds those four to `NEWER_LIST_COLLISIONS`. The newer console command-list layout inserts two marker methods at #59 / #60 and moves the methods after them by two (three for the PC's List1 block). NEWER_LIST_SLOTS splits a slot only where an older handler moved; where it stayed, the newer layout's method at that slot runs the older handler with the wrong arguments, silently: #59 ExecuteIndirect for a GPU marker, #69 Write32BitValueBottomOfPipeX for a pipeline flush (writing title memory), #78 DispatchX for a GDS write, #81 DrawIndexedX for a hi-stencil state, #94 RSSetDepthBiasX for CloseBundleX, and others (from a console API audit). Before changing these handlers, a probe on each of the 16 slots logs the first call from the title once the newer layout is known, with its arguments, and forwards every call as before. A run of a title then shows which collisions are live. No behaviour change. **What is in it** - `crates/xcl/src/hle/d3d12x/guard.rs`: +49 / -0 - `crates/xcl/src/hle/d3d12x/real.rs`: +15 / -0 - new tests: `a_layout_probe_logs_its_first_call_on_the_newer_layout_only` **Tested** - NVIDIA RTX 2070 SUPER (driver 32.0.16.2140), AMD Ryzen 5 3600XT, Windows 11 build 26300, Rust 1.100.0 MSVC; tests in debug - Current head `587b0508` (rebased onto `main` `765b2c5b` to resolve conflicts): the suite has not been rerun on it; the counts below are from the earlier heads they name. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `5ade6ad5` (built on `main` `336fddda`; it merges into the current `main` `e429936c` without conflict): 2123 passed, 9 failed, 48 ignored, 25 `SKIPPED` lines (21 no wave64, 3 #1426, 1 no heap windows). - The 9 failures are the ones `main` has (3 `e2e` title tests and 6 split-wave64 GPU tests, #3093: `main` `336fddda` gives 2122 passed, 9 failed, 48 ignored); the set of failing tests is identical to it. - `a_layout_probe_logs_its_first_call_on_the_newer_layout_only`: ok in that run; fails without the change **Regression run** Current head `587b0508`, rebased onto `main` `765b2c5b` on 2026-11-28 to resolve conflicts with `main`. RTX 2070 SUPER, the retail game, 60 s, `XCL_PRESS_AT=25:A`, `XCL_PREPARE=0` (no startup shader preparation), release builds; each run started from a copy of the same DXIL cache (one queue job: `main`, then PR heads one after the other). `main`: ``` xcl-smoke v1 commit: 7db2f391cefd748d47c7de63d50dd43ebb852185 gpu: NVIDIA GeForce RTX 2070 SUPER title: retail game seconds: 60 exit: 0x0 frames shown: 1530 (PresentX 1530) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 17023 MB ``` This PR's head: ``` xcl-smoke v1 commit: 587b0508ea83475700eb957fb300766da416373b gpu: NVIDIA GeForce RTX 2070 SUPER title: retail game seconds: 60 exit: 0x0 frames shown: 1555 (PresentX 1555) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 15307 MB ``` **Not tested** - Full preparation. The smoke runs used `XCL_PREPARE=0`. - No behaviour change. Whether any title hits one of the 16 slots: that is what the log lines will show. - AMD and Intel GPUs; wave64 hardware (the RTX 2070 SUPER is wave32). **AI use** - Codex (exact model name unavailable) verified the queued smoke results and drafted this description update. - Claude Code, Claude Opus 5.5: the code and tests. The description and the test / suite runs: Claude Code, Claude Sonnet 5.5 and Claude Opus 5.5. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-12-01 09:34:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:34:57Z.


Triage (#1607) – head 587b050

No open or merged PR adds these probes. #1274 overlaps textually (NEWER_LIST_SLOTS), as the description says.
Minor: in guard.rs the new test is inserted between the doc comment of layout_split_keeps_the_runtime_on_the_pc_method and its function, so that doc now sits on the new test. probe does the module lookup before the cheap first_newer_call check on every call to hot older-layout slots (#78, #81); checking the flag first avoids that. The failing Windows check is in shaders::pipeline_library tests that this diff does not touch.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7306908387 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3139#issuecomment-7306908387). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:34:57Z. --- **Triage (#1607)** – head 587b050 No open or merged PR adds these probes. #1274 overlaps textually (`NEWER_LIST_SLOTS`), as the description says. Minor: in guard.rs the new test is inserted between the doc comment of `layout_split_keeps_the_runtime_on_the_pc_method` and its function, so that doc now sits on the new test. `probe` does the module lookup before the cheap `first_newer_call` check on every call to hot older-layout slots (#78, #81); checking the flag first avoids that. The failing Windows check is in `shaders::pipeline_library` tests that this diff does not touch. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Foniass commented 2026-12-01 10:54:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:54:51Z.


merge-check
base: 493dbd3dd0
head: 587b0508ea
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+65). Findings: (1) A cost on every call of 15 command-list slots, for good. Every call goes through a thunk, the runtime's own calls included, and probe (guard.rs ~145) runs image_base_for_addr(caller) before the cheap first_newer_call() check. On the older layout, which most titles use, the flag never turns true, yet every call to the per-draw slots #78 and #81 still pays the module lookup. Checking the flag first (and dropping the thunk once logged) would make it nearly free. Unmeasured: the smoke below is capped at 60 presents per second. (2) It logs once per class, not once per process. The description says 16 slots; the constant (real.rs ~11177) has 15. (3) The new test sits between another test's doc comment and its function (~347-351), so that comment now documents the wrong test. (4) The method names in the doc comment come "from a console API audit". HANDOFF ~1459 says where the shift starts below #83 isn't known, so please say how the names were obtained. The PR's red CI is the pipeline_library / warm_library flake fixed on main by 2c003dd6. Fine: the log-once swap runs only once the newer layout is known, the original method still runs, and it conflicts textually only with #1274.
performance: 60 s smoke of a retail title, main 493dbd3d vs this merge (f30848b9): 1670 -> 1655 frames shown (99 %; last presents per 2 s: 60 60 60), peak commit 17083 -> 18033 MB, 0 device removals, 0 crashes. The retail title runs the older layout here (no probe line logged), so this run measures exactly the case where the thunk does nothing useful; capped at 60 presents per second, it can't show the per-call cost.
verdict: not yet: every call on 15 command-list slots, including the per-draw #78 / #81, now pays a module lookup before the cheap flag check (guard.rs ~145), even on the older layout where nothing is ever logged; check the flag first
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7308905702 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3139#issuecomment-7308905702). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T10:54:51Z. --- merge-check base: 493dbd3dd0cd50b4c3e8d28f73ab9b504fcd8158 head: 587b0508ea83475700eb957fb300766da416373b merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: read the whole diff (+65). Findings: (1) **A cost on every call of 15 command-list slots, for good.** Every call goes through a thunk, the runtime's own calls included, and `probe` (`guard.rs` ~145) runs `image_base_for_addr(caller)` before the cheap `first_newer_call()` check. On the older layout, which most titles use, the flag never turns true, yet every call to the per-draw slots #78 and #81 still pays the module lookup. Checking the flag first (and dropping the thunk once logged) would make it nearly free. Unmeasured: the smoke below is capped at 60 presents per second. (2) It logs once per class, not once per process. The description says 16 slots; the constant (`real.rs` ~11177) has 15. (3) The new test sits between another test's doc comment and its function (~347-351), so that comment now documents the wrong test. (4) The method names in the doc comment come "from a console API audit". HANDOFF ~1459 says where the shift starts below #83 isn't known, so please say how the names were obtained. The PR's red CI is the `pipeline_library` / `warm_library` flake fixed on main by 2c003dd6. Fine: the log-once `swap` runs only once the newer layout is known, the original method still runs, and it conflicts textually only with #1274. performance: 60 s smoke of a retail title, main 493dbd3d vs this merge (f30848b9): 1670 -> 1655 frames shown (99 %; last presents per 2 s: 60 60 60), peak commit 17083 -> 18033 MB, 0 device removals, 0 crashes. The retail title runs the older layout here (no probe line logged), so this run measures exactly the case where the thunk does nothing useful; capped at 60 presents per second, it can't show the per-call cost. verdict: not yet: every call on 15 command-list slots, including the per-draw #78 / #81, now pays a module lookup before the cheap flag check (`guard.rs` ~145), even on the older layout where nothing is ever logged; check the flag first hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
KOLESNiii commented 2026-12-02 15:03:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-12-02T15:03:35Z.


@Foniass all three code points are fixed on the new head b91ebeba (rebased onto main df0cfef6):

  • (1) probe checks the cheap flag first: LayoutProbe::may_log (two atomic loads: newer layout known and not yet logged) runs before image_base_for_addr. On the older layout, and once a slot has logged, a call costs two loads and no module lookup (guard.rs). The test checks may_log before the layout is known, once it is, and after the line.
  • (2) the commit message now says 15 slots, which matches NEWER_LIST_COLLISIONS;
  • (3) the new test now sits after layout_split_keeps_the_runtime_on_the_pc_method, so that test has its own doc comment back.

How the slot / field meanings were obtained is a question for the PR author, who will answer it here; I have not changed them. Suite and smoke are queued again.

— Claude Code (Claude Opus 5.5), on behalf of the PR author

<!-- greyfinch-sync:ivall/xcl:comment:7349638716 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3139#issuecomment-7349638716). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-12-02T15:03:35Z. --- @Foniass all three code points are fixed on the new head `b91ebeba` (rebased onto `main` df0cfef6): - (1) `probe` checks the cheap flag first: `LayoutProbe::may_log` (two atomic loads: newer layout known and not yet logged) runs before `image_base_for_addr`. On the older layout, and once a slot has logged, a call costs two loads and no module lookup (`guard.rs`). The test checks `may_log` before the layout is known, once it is, and after the line. - (2) the commit message now says 15 slots, which matches `NEWER_LIST_COLLISIONS`; - (3) the new test now sits after `layout_split_keeps_the_runtime_on_the_pc_method`, so that test has its own doc comment back. How the slot / field meanings were obtained is a question for the PR author, who will answer it here; I have not changed them. Suite and smoke are queued again. — Claude Code (Claude Opus 5.5), on behalf of the PR author
Foniass commented 2026-12-02 15:04:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T15:04:27Z.


Follow-up review (head b91ebeba, since 587b050, diff read, not a merge-check; checks red):

  • Every call on 15 slots paid a module lookup before the flag check: fixed. may_log (two atomic loads, the newer layout known and nothing logged yet) now comes before image_base_for_addr in probe, so on the older layout and after the one log line a call costs two loads; the test checks both cases.
  • The description said 16 slots: fixed (15).
  • The new test between another test's doc comment and its function: fixed; the doc comment is back with its own test.
  • Logs once per class, not once per process; where the method names come from: unchanged.

New: none.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7349667382 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3139#issuecomment-7349667382). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T15:04:27Z. --- Follow-up review (head b91ebeba, since 587b050, diff read, not a merge-check; checks red): - **Every call on 15 slots paid a module lookup before the flag check:** fixed. `may_log` (two atomic loads, the newer layout known and nothing logged yet) now comes before `image_base_for_addr` in `probe`, so on the older layout and after the one log line a call costs two loads; the test checks both cases. - **The description said 16 slots:** fixed (15). - **The new test between another test's doc comment and its function:** fixed; the doc comment is back with its own test. - **Logs once per class, not once per process; where the method names come from:** unchanged. New: none. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3139:upstream-pr/3139'
git switch 'upstream-pr/3139'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3139'
git switch 'upstream-pr/3139'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3139'
git switch 'upstream-pr/3139'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3139'
git switch 'main'
git merge --squash 'upstream-pr/3139'
git switch 'main'
git merge --ff-only 'upstream-pr/3139'
git switch 'main'
git merge 'upstream-pr/3139'
git push origin 'main'
Sign in to join this conversation.
No reviewers
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!3139
No description provided.