d3d12_xs: fence slot 12 returns the address of a live completed value, again; the retail boot reaches its frame loop (RT-FENCE12) #432

Closed
Mumogg wants to merge 1 commit from upstream-pr/432 into main
Mumogg commented 2026-11-24 05:07:39 +00:00 (Migrated from github.com)

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


Claimed in #14 as RT-FENCE12. Depends on: the stack up to #430 (their commits come first here; this pull request is the last commit).

What and why

Fence slot 12 is one past ID3D12Fence1. The retail title calls it as (value, descriptor, flags) and reads the return as a pointer to the fence's 64-bit completed value. main refuses the slot with E_NOTIMPL, and the title dereferences the error code.

Commit 5ac4deaa2 by TreXito (-x, authorship kept; an ancestor of main whose content is not in the tree): each fence gets a mirror of its completed value that stays current without the title calling anything (a thread-pool wait on the real fence refreshes it; slot 12 and a CPU Signal refresh it at once), and slot 12 returns the mirror's address. The descriptor's code pointer is not called: its contract is not known, and the commit says so.

The conflicts were neighbours (the queue constants of #391 and #403, the allocator fields of #395, the tests' lists); both sides are kept.

Measured: the frame loop

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 (they are not in this branch).

Correction (I first posted this section with a wrong duration): the runs with this change do not last the 300 s I allowed them. The process ends after about 30 s, exit code 3. I had read the counts and not the exit line. The numbers below are two runs of about 30 s each.

--run up to #430 + this, run 1 + this, run 2
Traced D3D12 calls 62,599 537,677 577,901
CreatePipelineState ok 50,450 50,466 (4 failed) same
ExecuteCommandLists ok 5 26,400, none failed not counted separately
DrawInstanced 0 13,200 14,317
XboxPresentation::PresentX ok 1 13,199, none failed 14,316
Ends with the title writing through a null pointer after Fence::Slot12 unsupported exit 3 at about 30 s exit 3 at 30 s

So with this the retail title enters its frame loop on main here and presents some 13,000 to 14,000 times, with one draw per present, before the process ends. That is far more presents than seconds: nothing paces the loop on this path.

Why it ends, from run 2's startup trace: at 22.4 s a worker thread of the title hits its own int3 (the size check of #427 and #428, on a third description that I have not identified yet); at 28 to 29 s the title's crash reporting runs and the process exits. The frame loop is running the whole time in between. So the next thing on this path is that third description, not the loop.

What else is still wrong, so nobody reads more into the table than it says:

  • I have not looked at the picture. On the integration branch (#321) this point of the boot shows a black frame.
  • Four pipeline states fail with primitive topology type not supported: 19: rectangle lists, which main does not draw (old PR 7448). The integration branch draws three times per present, this path once; that is very likely why.
  • XboxID3D12CommandQueue::Slot31 is refused twice.

Tests under Wine: xs_proxy_mock_test passes with the commit's check_fence_completed_value; queue_proxy_test passes on the Vulkan backend with its fence slot 12 case (the value follows a queue's signal without another call).

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:5466471051 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/432). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T05:07:39Z. --- Claimed in #14 as `RT-FENCE12`. Depends on: the stack up to #430 (their commits come first here; this pull request is the last commit). ### What and why Fence slot 12 is one past `ID3D12Fence1`. The retail title calls it as `(value, descriptor, flags)` and reads the return as a pointer to the fence's 64-bit completed value. `main` refuses the slot with `E_NOTIMPL`, and the title dereferences the error code. Commit `5ac4deaa2` by TreXito (`-x`, authorship kept; an ancestor of `main` whose content is not in the tree): each fence gets a mirror of its completed value that stays current without the title calling anything (a thread-pool wait on the real fence refreshes it; slot 12 and a CPU `Signal` refresh it at once), and slot 12 returns the mirror's address. The descriptor's code pointer is not called: its contract is not known, and the commit says so. The conflicts were neighbours (the queue constants of #391 and #403, the allocator fields of #395, the tests' lists); both sides are kept. ### Measured: the frame loop 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 (they are not in this branch). **Correction (I first posted this section with a wrong duration):** the runs with this change do not last the 300 s I allowed them. The process ends after about 30 s, exit code 3. I had read the counts and not the exit line. The numbers below are two runs of about 30 s each. | `--run` | up to #430 | + this, run 1 | + this, run 2 | |---|---|---|---| | Traced D3D12 calls | 62,599 | 537,677 | 577,901 | | `CreatePipelineState` ok | 50,450 | 50,466 (4 failed) | same | | `ExecuteCommandLists` ok | 5 | 26,400, none failed | not counted separately | | `DrawInstanced` | 0 | 13,200 | 14,317 | | `XboxPresentation::PresentX` ok | 1 | 13,199, none failed | 14,316 | | Ends with | the title writing through a null pointer after `Fence::Slot12 unsupported` | exit 3 at about 30 s | exit 3 at 30 s | So with this the retail title **enters its frame loop on `main`** here and presents some 13,000 to 14,000 times, with one draw per present, before the process ends. That is far more presents than seconds: nothing paces the loop on this path. Why it ends, from run 2's startup trace: at 22.4 s a worker thread of the title hits its own `int3` (the size check of #427 and #428, on a third description that I have not identified yet); at 28 to 29 s the title's crash reporting runs and the process exits. The frame loop is running the whole time in between. So the next thing on this path is that third description, not the loop. What else is still wrong, so nobody reads more into the table than it says: - **I have not looked at the picture.** On the integration branch (#321) this point of the boot shows a black frame. - Four pipeline states fail with `primitive topology type not supported: 19`: rectangle lists, which `main` does not draw (old PR 7448). The integration branch draws three times per present, this path once; that is very likely why. - `XboxID3D12CommandQueue::Slot31` is refused twice. Tests under Wine: `xs_proxy_mock_test` passes with the commit's `check_fence_completed_value`; `queue_proxy_test` passes on the Vulkan backend with its fence slot 12 case (the value follows a queue's signal without another call). 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
sodove commented 2026-11-24 06:07:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-24T06:07:28Z.


checked: independent native Windows verification of head ee47b0bf5d7f6f4483d9ea53ebe791f9649f93ab. Windows 11 x64 build 26100, MSVC 19.44.35220, SDK 10.0.26100, Release, RTX 5070 Ti / NVIDIA 610.74, Vulkan loader 1.4.341.

Stock xs_proxy_mock and queue_proxy both passed. I added a local queue_proxy_test case that obtains the slot-12 address once, enqueues a signal behind a wait on a second queue, and releases that wait from the first queue. The pointer stayed at the previous value while blocked and observed the completed signal afterward without a refresh call. The test repeated that handoff on the same pointer with a second distinct 64-bit value, so it also exercised re-arming. This passed 3/3 times on each of native D3D12/WARP, native D3D12/RTX 5070 Ti and Vulkan/RTX 5070 Ti.

In a local control with the background wait registration disabled, the completion event fired but the first new value stayed absent at the pointer. The extended test failed on that assertion under WARP. The test fixture and control edits were reverted and both stock tests passed again.

Synthetic fixtures only. AI-assisted verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7123608435 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/432#issuecomment-7123608435). Originally posted by [sodove](https://github.com/sodove) on 2026-11-24T06:07:28Z. --- checked: independent native Windows verification of head ee47b0bf5d7f6f4483d9ea53ebe791f9649f93ab. Windows 11 x64 build 26100, MSVC 19.44.35220, SDK 10.0.26100, Release, RTX 5070 Ti / NVIDIA 610.74, Vulkan loader 1.4.341. Stock xs_proxy_mock and queue_proxy both passed. I added a local queue_proxy_test case that obtains the slot-12 address once, enqueues a signal behind a wait on a second queue, and releases that wait from the first queue. The pointer stayed at the previous value while blocked and observed the completed signal afterward without a refresh call. The test repeated that handoff on the same pointer with a second distinct 64-bit value, so it also exercised re-arming. This passed 3/3 times on each of native D3D12/WARP, native D3D12/RTX 5070 Ti and Vulkan/RTX 5070 Ti. In a local control with the background wait registration disabled, the completion event fired but the first new value stayed absent at the pointer. The extended test failed on that assertion under WARP. The test fixture and control edits were reverted and both stock tests passed again. Synthetic fixtures only. AI-assisted verification.
Mumogg commented 2026-11-24 09:46:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mumogg on 2026-11-24T09:46:43Z.


Follow-up: the worker-thread int3 that ended these runs at 30 s is a 1D A8_UNORM texture that slot 25 refuses. With #602 on top, the same build runs its frame loop until 296 s (139,067 PresentX ok, none failed, no title exception in the startup trace) and is then killed by the 52 GB memory cap I run it under; the numbers and the journal line are in #602.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7127875241 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/432#issuecomment-7127875241). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T09:46:43Z. --- Follow-up: the worker-thread `int3` that ended these runs at 30 s is a 1D A8_UNORM texture that slot 25 refuses. With #602 on top, the same build runs its frame loop until 296 s (139,067 `PresentX ok`, none failed, no title exception in the startup trace) and is then killed by the 52 GB memory cap I run it under; the numbers and the journal line are in #602. AI-assisted.
Dezmonius commented 2026-11-24 13:55:47 +00:00 (Migrated from github.com)

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


Checked the updated head c832dd5d on native Windows 10 22H2 (19045), MSVC 19.51.36256, SDK 10.0.26100, Ninja Release. Stock xs_proxy_mock and queue_proxy passed. The latter exercised D3D12/WARP, native D3D12 on RTX 5070, and Vulkan on RTX 5070 (driver 610.88, Khronos validation 1.4.369 enabled).

I also tested concurrent first calls to slot 12 with a local mock-only fixture. Eight threads first queried the same fence at once. Every thread received the same non-null address, the value at that address advanced after an external signal without another slot-12 call, and releasing the proxy returned the mock fence's references to zero. This passed for 32 fences of each type (with/without ID3D12Fence1) in each of 3 runs, 192 fences total.

Synthetic tests only, no game files or retail boot. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7133551581 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/432#issuecomment-7133551581). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T13:55:47Z. --- Checked the updated head `c832dd5d` on native Windows 10 22H2 (19045), MSVC 19.51.36256, SDK 10.0.26100, Ninja Release. Stock `xs_proxy_mock` and `queue_proxy` passed. The latter exercised D3D12/WARP, native D3D12 on RTX 5070, and Vulkan on RTX 5070 (driver 610.88, Khronos validation 1.4.369 enabled). I also tested concurrent first calls to slot 12 with a local mock-only fixture. Eight threads first queried the same fence at once. Every thread received the same non-null address, the value at that address advanced after an external signal without another slot-12 call, and releasing the proxy returned the mock fence's references to zero. This passed for 32 fences of each type (with/without ID3D12Fence1) in each of 3 runs, 192 fences total. Synthetic tests only, no game files or retail boot. AI-assisted (Codex).
aslan2142 commented 2026-11-25 08:39:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T08:39:43Z.


Closing as carried: main has this since #984's integration (your rungs were its source; the original commits are in main's history), so there is nothing left to merge.

  • Fence slot 12 returns the address of a FenceMirror's completed value, kept current by a wait on the real fence re-armed at completed + 1 (runtime/shims/d3d12_xs_device.cpp, FenceMirror / wait_for_fence_progress), with the CPU Signal refreshing it too.
  • The check_fence_completed_value and queue_proxy_test cases are in main. A line-by-line check against current main finds only comment and doc wording missing; the lower rungs #414–#430 were marked merged through #430.

Thanks, and thanks to sodove and Dezmonius for the checks.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7157314184 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/432#issuecomment-7157314184). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T08:39:43Z. --- Closing as carried: `main` has this since #984's integration (your rungs were its source; the original commits are in `main`'s history), so there is nothing left to merge. - Fence slot 12 returns the address of a `FenceMirror`'s completed value, kept current by a wait on the real fence re-armed at `completed + 1` (`runtime/shims/d3d12_xs_device.cpp`, `FenceMirror` / `wait_for_fence_progress`), with the CPU `Signal` refreshing it too. - The `check_fence_completed_value` and `queue_proxy_test` cases are in `main`. A line-by-line check against current `main` finds only comment and doc wording missing; the lower rungs #414–#430 were marked merged through #430. Thanks, and thanks to sodove and Dezmonius for the checks. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

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!432
No description provided.