d3d12_xs: the title's queue slots 16 and 17 with a fence are Signal and Wait (RT-QUEUE-SIGNAL) #430

Merged
Mumogg merged 7 commits from upstream-pr/430 into main 2026-11-25 03:46:18 +00:00
Mumogg commented 2026-11-24 05:05:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mumogg on 2026-11-24T05:05:16Z.


Claimed in #14 as RT-QUEUE-SIGNAL. Depends on: the stack up to #427 (their commits come first here; this pull request is the last commit). The change is in the queue proxy and its test, next to #403's.

What and why

The same kind of bug as #403, one slot over.

Queue slots 16 and 17 are GetTimestampFrequency(UINT64*) and GetClockCalibration(UINT64*, UINT64*) on the PC; both write through their first argument. The retail title calls queue slot 16 with one of its fences and a value: the shape of Signal(fence, value). On the console queue Signal and Wait sit two later than on the PC, at 16 and 17, as the frequency getter does at 18.

main forwarded the call by number, so the PC frequency getter wrote the frequency over the first 8 bytes of the fence proxy: its vtable pointer. The title's next call on that fence then went through a null pointer.

How I found it: at the fault the register that should hold the fence's vtable held 1,000,000,000, the frequency the layer answers; and the object the title was calling was a queue/fence/allocator proxy at an address I had logged.

The change: the title's call (set_console_caller) whose first argument is a fence proxy goes to the PC Signal or Wait with the real fence. A host caller keeps the PC getters, and so does a title call whose first argument is no object of this proxy, which cannot be a Signal.

Written by me. The slot order is the console queue's of old PR 2490 (Nolan Cotter), which detects the layout at run time; this is one rule for main's queue proxy.

Measured

Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, on main ece4ba5b3, with #142, #219, #328, #387 and #428 applied on top for the boot runs (they are not in this branch).

--run Ends with
without this a call through a null pointer from the title, on the fence it had just passed to queue slot 16
with this later: XboxID3D12Fence::Slot12 unsupported, then the title writes through a null pointer

Both runs create 50,450 pipeline states. The next stop is fence slot 12, a console method one past ID3D12Fence1 that returns a pointer the title reads; refused, the title dereferences the error code. 5ac4deaa2 (TreXito) is the piece for it and I will try it next.

Tests under Wine: xs_proxy_mock_test passes with the new case (both slots with a fence reach the mock queue's slots 14 and 15 with the real fence; the fence proxy's first word is unchanged; the non-fence call and the host call reach slot 16). queue_proxy_test passes on the Vulkan backend.

Not built with MSVC and not run on Windows.

AI-assisted (Claude Code); built and run on the machine above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466444707 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/430). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T05:05:16Z. --- Claimed in #14 as `RT-QUEUE-SIGNAL`. Depends on: the stack up to #427 (their commits come first here; this pull request is the last commit). The change is in the queue proxy and its test, next to #403's. ### What and why The same kind of bug as #403, one slot over. Queue slots 16 and 17 are `GetTimestampFrequency(UINT64*)` and `GetClockCalibration(UINT64*, UINT64*)` on the PC; both write through their first argument. The retail title calls queue slot 16 with one of its fences and a value: the shape of `Signal(fence, value)`. On the console queue `Signal` and `Wait` sit two later than on the PC, at 16 and 17, as the frequency getter does at 18. `main` forwarded the call by number, so the PC frequency getter wrote the frequency over the first 8 bytes of the fence proxy: its vtable pointer. The title's next call on that fence then went through a null pointer. How I found it: at the fault the register that should hold the fence's vtable held 1,000,000,000, the frequency the layer answers; and the object the title was calling was a queue/fence/allocator proxy at an address I had logged. The change: the title's call (`set_console_caller`) whose first argument is a fence proxy goes to the PC `Signal` or `Wait` with the real fence. A host caller keeps the PC getters, and so does a title call whose first argument is no object of this proxy, which cannot be a `Signal`. Written by me. The slot order is the console queue's of old PR 2490 (Nolan Cotter), which detects the layout at run time; this is one rule for `main`'s queue proxy. ### Measured Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, on `main` `ece4ba5b3`, with #142, #219, #328, #387 and #428 applied on top for the boot runs (they are not in this branch). | `--run` | Ends with | |---|---| | without this | a call through a null pointer from the title, on the fence it had just passed to queue slot 16 | | with this | later: `XboxID3D12Fence::Slot12 unsupported`, then the title writes through a null pointer | Both runs create 50,450 pipeline states. The next stop is fence slot 12, a console method one past `ID3D12Fence1` that returns a pointer the title reads; refused, the title dereferences the error code. `5ac4deaa2` (TreXito) is the piece for it and I will try it next. Tests under Wine: `xs_proxy_mock_test` passes with the new case (both slots with a fence reach the mock queue's slots 14 and 15 with the real fence; the fence proxy's first word is unchanged; the non-fence call and the host call reach slot 16). `queue_proxy_test` passes on the Vulkan backend. Not built with MSVC and not run on Windows. AI-assisted (Claude Code); built and run on the machine above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Dezmonius commented 2026-11-24 13:51:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Dezmonius on 2026-11-24T13:51:47Z.


Independent native Windows check of RT-QUEUE-SIGNAL. Windows 10 22H2 (19045), MSVC 19.51.36256, Windows SDK 10.0.26100, Ninja Release, RTX 5070 / NVIDIA 610.88.

  • A/B with the same xs_proxy_mock_test source: parent 89fdb83e0 fails the new slot-16 routing assertion, while PR head 028a414fa passes, including the slot-17 routing, unchanged fence vtable and host getter controls.
  • Stock queue_proxy_test passed on all three backends: native D3D12/WARP, native D3D12/RTX 5070, and Vulkan/RTX 5070 with Khronos validation 1.4.369 enabled.
  • A local extension of queue_proxy_test called Xbox slots 16/17 on the real queue proxy. Slot 16 completed a signal, slot 17 held a subsequent queue signal until a CPU signal released the wait, and the fence vtable stayed unchanged. This passed on all three backends. The real-device extension was run on the PR head only.

Synthetic data only; no game files or retail boot. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7133447848 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/430#issuecomment-7133447848). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T13:51:47Z. --- Independent native Windows check of RT-QUEUE-SIGNAL. Windows 10 22H2 (19045), MSVC 19.51.36256, Windows SDK 10.0.26100, Ninja Release, RTX 5070 / NVIDIA 610.88. - A/B with the same `xs_proxy_mock_test` source: parent `89fdb83e0` fails the new slot-16 routing assertion, while PR head `028a414fa` passes, including the slot-17 routing, unchanged fence vtable and host getter controls. - Stock `queue_proxy_test` passed on all three backends: native D3D12/WARP, native D3D12/RTX 5070, and Vulkan/RTX 5070 with Khronos validation 1.4.369 enabled. - A local extension of `queue_proxy_test` called Xbox slots 16/17 on the real queue proxy. Slot 16 completed a signal, slot 17 held a subsequent queue signal until a CPU signal released the wait, and the fence vtable stayed unchanged. This passed on all three backends. The real-device extension was run on the PR head only. Synthetic data only; no game files or retail boot. AI-assisted (Codex).
aslan2142 commented 2026-11-25 03:46:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T03:46:21Z.


Merged, after merging main into it (6ed716a99). Thanks. Only the test is left of this; main took the routing from #984/#939 in its own form:

  • Claim: RT-QUEUE-SIGNAL, valid, before this PR.
  • Kept from main: queue slots 16/17 with a fence go to Signal/Wait through main's layout detection (any caller), which also marks the newer queue layout and so moves the PresentX slot.
  • Kept from this PR: your test, ported to main's rule: with a fence, slot 16 reaches PC Signal and slot 17 reaches PC Wait, both with the real fence, the PC getters are never called and the fence proxy's vtable pointer is unchanged. Slot 17 had no test on main. The host-caller and no-fence expectations are dropped, because main answers those calls S_OK once the layout is detected.
  • Windows suite under Wine (llvmpipe and an RDNA2 iGPU): xs_proxy_mock passes on both and fails when slot 17 is sent to Signal; the full suite shows no test going from pass to fail.
  • The rest of the ladder: this merge also marks #414, #416 and #427 as merged, since their commits come with it; their content is in main already (notes on each). #432, #428 and #602 are carried as well.
  • Checked on main bfef489cb + 6ed716a99: it merges cleanly; the semantic suite passes (487 files, 6,279 tests, 0 files failed); the 14 docs and writer tests pass; check_no_game_data.py is clean on the 1 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152226885 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/430#issuecomment-7152226885). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T03:46:21Z. --- Merged, after merging `main` into it (`6ed716a99`). Thanks. Only the test is left of this; `main` took the routing from #984/#939 in its own form: - **Claim:** `RT-QUEUE-SIGNAL`, valid, before this PR. - **Kept from `main`:** queue slots 16/17 with a fence go to Signal/Wait through `main`'s layout detection (any caller), which also marks the newer queue layout and so moves the PresentX slot. - **Kept from this PR:** your test, ported to `main`'s rule: with a fence, slot 16 reaches PC Signal and slot 17 reaches PC Wait, both with the real fence, the PC getters are never called and the fence proxy's vtable pointer is unchanged. Slot 17 had no test on `main`. The host-caller and no-fence expectations are dropped, because `main` answers those calls `S_OK` once the layout is detected. - **Windows suite under Wine (llvmpipe and an RDNA2 iGPU):** `xs_proxy_mock` passes on both and fails when slot 17 is sent to Signal; the full suite shows no test going from pass to fail. - **The rest of the ladder:** this merge also marks #414, #416 and #427 as merged, since their commits come with it; their content is in `main` already (notes on each). #432, #428 and #602 are carried as well. - **Checked on `main` `bfef489cb` + `6ed716a99`:** it merges cleanly; the semantic suite passes (487 files, 6,279 tests, 0 files failed); the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 1 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
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
ProjectLeonida/mandy!430
No description provided.