startup: count a failed buffer copy as the null cause ring_full and refuse the draw; report upload ring statistics #2856

Merged
tedin7 merged 4 commits from upstream-pr/2864 into main 2026-11-27 22:49:36 +00:00
tedin7 commented 2026-11-26 14:42:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T14:42:30Z.


Part of #870
Fixes #2863

What this unblocks: a translated draw whose buffer copy fails for lack of upload-ring space is refused and counted as ring_full, instead of running with a silent null binding that reads zeros; the render totals now show how full the ring is.

What changed

  • NullCause::ring_full (sixth slot) and BindingFacts::ring_failed in src/startup_stubs/null_binding_cause.h; the x2w-render totals line prints ring_full N after dimension N.
  • src/startup_stubs/d3d12_draw.inl: at the frame-copy site and the odd-size padded-stream site of the buffer binding, a readable range whose copy failed refuses the draw and counts ring_full (first six logged). Unreadable or empty descriptors stay null as before.
  • src/startup_stubs/d3d12_xs_device.cpp: x2w-render upload ring: reserved N MiB in N reservations, refusals N, capacity N MiB every 300 frames.
  • tests/startup_null_cause_labels_check.cpp: six causes, ring_full cases, totals-line text.

Why it is correct

A binding that could be read but not copied is not "nothing bound": drawing with it feeds the shader zeros in place of the title's data. Refusing the draw keeps the frame consistent and the count says why.

What stays as it was

Null bindings for entries, tokens, wrappers and dimensions, and unreadable buffer ranges, keep their causes and behaviour.

Source: Microsoft D3D12 documentation, ID3D12Device::CreateShaderResourceView and D3D12_BUFFER_SRV (a buffer view reads zeros only when its resource is unbound); this change is an accounting and refusal rule in our own stand-in, repo code src/startup_stubs/d3d12_draw.inl.

Verification

  • x86_64-w64-mingw32-g++ -std=c++17 -Isrc tests/startup_null_cause_labels_check.cpp under wine: pass (17 cases); --mutate buffer-token: fails.
  • tests/startup_null_views_check.cpp: mingw syntax check ok.
  • Syntax check of d3d12_xs_device.cpp with clang for mingw: no error in the changed code.
  • Win2025 (independent gate, proxmox, the change applied as a patch on a main-based head; regex ^(startup_null|startup_indirect_translated)): dev 23/23 and release 23/23 (15 passed, 8 hardware tests skipped).
  • Mutant (the ring_failed to ring_full rule dropped): killed on Win2025 (startup_null_cause_labels expected the sixth cause) and on Linux with g++ (4 of 17 cases fail).
  • Not covered: no WARP test forces a real upload-ring failure; the refusal path itself is covered by the cause classification check only.

Real-hardware testing: @Makto94 - thanks for the help.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5512058910 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T14:42:30Z. --- Part of #870 Fixes #2863 What this unblocks: a translated draw whose buffer copy fails for lack of upload-ring space is refused and counted as `ring_full`, instead of running with a silent null binding that reads zeros; the render totals now show how full the ring is. ## What changed - `NullCause::ring_full` (sixth slot) and `BindingFacts::ring_failed` in `src/startup_stubs/null_binding_cause.h`; the `x2w-render totals` line prints `ring_full N` after `dimension N`. - `src/startup_stubs/d3d12_draw.inl`: at the frame-copy site and the odd-size padded-stream site of the buffer binding, a readable range whose copy failed refuses the draw and counts `ring_full` (first six logged). Unreadable or empty descriptors stay null as before. - `src/startup_stubs/d3d12_xs_device.cpp`: `x2w-render upload ring: reserved N MiB in N reservations, refusals N, capacity N MiB` every 300 frames. - `tests/startup_null_cause_labels_check.cpp`: six causes, `ring_full` cases, totals-line text. ## Why it is correct A binding that could be read but not copied is not "nothing bound": drawing with it feeds the shader zeros in place of the title's data. Refusing the draw keeps the frame consistent and the count says why. ## What stays as it was Null bindings for entries, tokens, wrappers and dimensions, and unreadable buffer ranges, keep their causes and behaviour. Source: Microsoft D3D12 documentation, `ID3D12Device::CreateShaderResourceView` and `D3D12_BUFFER_SRV` (a buffer view reads zeros only when its resource is unbound); this change is an accounting and refusal rule in our own stand-in, repo code `src/startup_stubs/d3d12_draw.inl`. ## Verification - `x86_64-w64-mingw32-g++ -std=c++17 -Isrc tests/startup_null_cause_labels_check.cpp` under wine: pass (17 cases); `--mutate buffer-token`: fails. - `tests/startup_null_views_check.cpp`: mingw syntax check ok. - Syntax check of `d3d12_xs_device.cpp` with clang for mingw: no error in the changed code. - Win2025 (independent gate, proxmox, the change applied as a patch on a main-based head; regex `^(startup_null|startup_indirect_translated)`): dev 23/23 and release 23/23 (15 passed, 8 hardware tests skipped). - Mutant (the `ring_failed` to `ring_full` rule dropped): killed on Win2025 (`startup_null_cause_labels` expected the sixth cause) and on Linux with g++ (4 of 17 cases fail). - Not covered: no WARP test forces a real upload-ring failure; the refusal path itself is covered by the cause classification check only. Real-hardware testing: @Makto94 - thanks for the help. AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot] commented 2026-11-26 14:57:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T14:57:16Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 166b62a714

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6076290886 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#pullrequestreview-6076290886). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-26T14:57:16Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `166b62a714` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-26 15:01:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T14:51:55Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T14:57:19.723894Z 166b62a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7195445659 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#issuecomment-7195445659). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-26T14:51:55Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"166b62a7142d7f4b82034deb8afec36dc13738aa","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-26T14:57:19.723894Z">2026-11-26T14:57:19.723894Z</relative-time> | `166b62a` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
chatgpt-codex-connector[bot commented 2026-11-26 15:01:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T14:57:17Z.

Code review location: src/startup_stubs/d3d12_draw.inl; line 2627

@@ -2613,6 +2624,16 @@ bool draw_translated(Wrapper* self, bool indexed, UINT count, UINT instances, UI
             ReleaseSRWLockExclusive(&draw_lock);
             return false;
         }
+        if (readable_range && !have) {

P2 Badge Count ring exhaustion before the formatted-buffer early return

When a formatted buffer has a readable range but frame_copy() fails because the upload ring is exhausted, the preceding if (!have && formatted.entry) returns before this new check. Those draws are reported as formatted buffer refused (unresolved buffer) and never increment ring_full, so formatted-buffer copy failures remain absent from the new cause counter. Handle or count the readable copy failure before that early return, and cover this combination in a regression check.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4710082005 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#discussion_r4710082005). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-26T14:57:17Z. **Code review location:** `src/startup_stubs/d3d12_draw.inl`; line 2627 ~~~~diff @@ -2613,6 +2624,16 @@ bool draw_translated(Wrapper* self, bool indexed, UINT count, UINT instances, UI ReleaseSRWLockExclusive(&draw_lock); return false; } + if (readable_range && !have) { ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Count ring exhaustion before the formatted-buffer early return** When a formatted buffer has a readable range but `frame_copy()` fails because the upload ring is exhausted, the preceding `if (!have && formatted.entry)` returns before this new check. Those draws are reported as `formatted buffer refused (unresolved buffer)` and never increment `ring_full`, so formatted-buffer copy failures remain absent from the new cause counter. Handle or count the readable copy failure before that early return, and cover this combination in a regression check. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
KelboLive commented 2026-11-26 15:37:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-26T15:37:57Z.

Review: APPROVED


Good fix. This cleanly addresses the silent null binding problem (#2863):

When the guest memory is readable but the upload ring is full, the draw is now refused and counted as ring_full instead of silently binding null (zeros). This is the right behavior a null binding would produce incorrect rendering that is much harder to diagnose.

Changes reviewed:

  • NullCause::ring_full (sixth slot) correct enum extension, no existing code depends on the old index
  • BindingFacts::ring_failed good separation ring failure is distinct from buffer not being bound
  • draw_translated refusal path checks readable_range first, then refuses with a one-shot log. The condition ordering is correct we only treat it as ring_full if the memory was actually readable
  • Upload ring stats atomic counters (InterlockedAdd64/Increment) are thread-safe for per-frame logging
  • Test update correctly expects 6 causes and the ring_full label

Minor note: The volatile LONG64 / volatile LONG for stats counters works fine with Interlocked operations. If you add a consumer (e.g., a telemetry hook) that reads all four stats at once, consider snapshotting them under a lock for consistency across the log line. Not blocking.

Looks good to merge. This unblocks #870 and is a prerequisite for #2847 (upload ring reuse builds on proper refusal semantics).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6076886320 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#pullrequestreview-6076886320). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-26T15:37:57Z. **Review:** APPROVED --- Good fix. This cleanly addresses the silent null binding problem (#2863): When the guest memory is readable but the upload ring is full, the draw is now refused and counted as ring_full instead of silently binding null (zeros). This is the right behavior a null binding would produce incorrect rendering that is much harder to diagnose. Changes reviewed: - NullCause::ring_full (sixth slot) correct enum extension, no existing code depends on the old index - BindingFacts::ring_failed good separation ring failure is distinct from buffer not being bound - draw_translated refusal path checks readable_range first, then refuses with a one-shot log. The condition ordering is correct we only treat it as ring_full if the memory was actually readable - Upload ring stats atomic counters (InterlockedAdd64/Increment) are thread-safe for per-frame logging - Test update correctly expects 6 causes and the ring_full label Minor note: The volatile LONG64 / volatile LONG for stats counters works fine with Interlocked operations. If you add a consumer (e.g., a telemetry hook) that reads all four stats at once, consider snapshotting them under a lock for consistency across the log line. Not blocking. Looks good to merge. This unblocks #870 and is a prerequisite for #2847 (upload ring reuse builds on proper refusal semantics).
tedin7 commented 2026-11-26 16:03:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T15:12:46Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6076544724 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#pullrequestreview-6076544724). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T15:12:46Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-26 16:04:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T15:12:45Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 07222b46ca69ec819147a3ff65bd07ffdc41bb7f:

  • Debug (--preset dev): build of d3d12_xs_device_obj d3d12_xs_shim startup_null_cause_labels_check startup_null_views_check ok; ctest --preset dev -R '^startup_null_cause_labels' 2/2 passed.
  • Release /O2 (--preset release): same targets build ok; ctest --preset release -R '^startup_null_cause_labels' 2/2 passed.

Fix in this head: a formatted buffer whose range is readable but whose frame copy fails (upload ring full) now counts ring_full before the early return, so it is no longer reported only as "unresolved buffer".

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7195943753 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#issuecomment-7195943753). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T15:12:45Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `07222b46ca69ec819147a3ff65bd07ffdc41bb7f`: - Debug (`--preset dev`): build of `d3d12_xs_device_obj d3d12_xs_shim startup_null_cause_labels_check startup_null_views_check` ok; `ctest --preset dev -R '^startup_null_cause_labels'` 2/2 passed. - Release /O2 (`--preset release`): same targets build ok; `ctest --preset release -R '^startup_null_cause_labels'` 2/2 passed. Fix in this head: a formatted buffer whose range is readable but whose frame copy fails (upload ring full) now counts `ring_full` before the early return, so it is no longer reported only as "unresolved buffer". AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 16:04:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T15:12:46Z.

Code review location: src/startup_stubs/d3d12_draw.inl; line 2627

@@ -2613,6 +2624,16 @@ bool draw_translated(Wrapper* self, bool indexed, UINT count, UINT instances, UI
             ReleaseSRWLockExclusive(&draw_lock);
             return false;
         }
+        if (readable_range && !have) {

Fixed in 07222b46c. The formatted-buffer early return now counts ring_full when the range is readable and frame_copy() failed, before refusing the draw. Commands run: g++ -std=c++17 -Isrc tests/startup_null_cause_labels_check.cpp (PASS, 17 cases), cmake -S . -B /tmp/cm-2864 -DDXC_EXECUTABLE=/bin/true (rc 0), git diff --check, and Win2025 dev+release ctest -R '^startup_null_cause_labels' 2/2 each at this head. Note: the call-site ordering lives in the Windows-only draw path, so the existing classifier test covers the ring_full label and totals but cannot exercise this branch directly.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4710265774 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#discussion_r4710265774). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T15:12:46Z. **Code review location:** `src/startup_stubs/d3d12_draw.inl`; line 2627 ~~~~diff @@ -2613,6 +2624,16 @@ bool draw_translated(Wrapper* self, bool indexed, UINT count, UINT instances, UI ReleaseSRWLockExclusive(&draw_lock); return false; } + if (readable_range && !have) { ~~~~ --- Fixed in 07222b46c. The formatted-buffer early return now counts `ring_full` when the range is readable and `frame_copy()` failed, before refusing the draw. Commands run: `g++ -std=c++17 -Isrc tests/startup_null_cause_labels_check.cpp` (PASS, 17 cases), `cmake -S . -B /tmp/cm-2864 -DDXC_EXECUTABLE=/bin/true` (rc 0), `git diff --check`, and Win2025 dev+release `ctest -R '^startup_null_cause_labels'` 2/2 each at this head. Note: the call-site ordering lives in the Windows-only draw path, so the existing classifier test covers the `ring_full` label and totals but cannot exercise this branch directly. AI-assisted; commands listed were executed locally.
Not-Saii commented 2026-11-26 16:11:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-26T16:11:24Z.

Review: COMMENTED


Tested on Windows hardware and read the diff. The full suite and the startup run used 166b62a7. After 07222b46 landed, I rebuilt and reran the 34 fixtures below on it: 34/34 passed.

Environment: Windows 11 build 26300.9974, MSVC 19.44.35230, Windows SDK 10.0.26100, NVIDIA GeForce RTX 4090 driver 610.88 (32.0.16.1088), WARP and hardware backends, D3D12 debug layer not enabled.

Fixtures

ctest --preset dev --no-tests=error -R '^(startup_null|startup_indirect_translated|startup_address_console_gate|upload_reservation$|startup_slot133_heap_cap)'

34/34 passed. That covers your gate regex on WARP and hardware (the hardware variants ran rather than skipped), plus the gate/gate-ring fixtures, upload_reservation and all six startup_slot133_heap_cap cases.

Full suite, in two passes so the hardware tests don't contend for the GPU:

ctest --preset dev --no-tests=error -j 20 -E '_hardware$' --timeout 600
ctest --preset dev --no-tests=error -j 4 -R '_hardware$' --timeout 600

The first pass passed 1752/1752 with 22 capability skips (77). The second ran 690 tests: 688 passed, including 8 capability skips, and 2 failed:

  • pixel_aot_cvt_flr_rpi_hardware timed out at 60 s under -j 4 and passed when rerun alone (26.6 s). This is contention.
  • compute_store_aot_mac_f32_hardware also fails when run alone: mac_f32: mad() fusion probe read back neither model alone: {'fused': False, 'unfused': False}. The probe comes from #2844, which is now on main. The run doesn't touch the startup stand-in, so it is unrelated to this PR. I'll report it separately.

Startup run from #2837 (on this PR alone, so the ring still caps at 256 MiB)

I used a release build and run.ps1 -Render -Translate -FakeUser -GpuMirror -ContinueAsserts 1000, 180 s, with A pressed every 5 s from 50 s. The new lines do what the PR says:

null bindings 7038 (entry 0, buffer 0, token 0, wrapper 0, dimension 0, ring_full 7038)
translated draws 4745 (not drawn 7038)
x2w-render upload ring: reserved 256 MiB in 12119 reservations, refusals 9088, capacity 256 MiB

On 7256cecf the same run counted those failures as buffer null bindings. Here they are named and the draws are refused. Ring refusals (9,088) exceed ring_full (7,038) because texture uploads and index copies also reserve from the ring, and those failures are not counted here (see 3).

From reading the diff

  1. Formatted buffers (the Codex point): fixed in 07222b46. Such a draw now counts ring_full before the early return. It also still counts in formatted-load draws refused, and the log line still says formatted buffer refused (unresolved buffer). A reader adding the two totals would count it twice, and the log names the wrong cause. Saying "upload ring" in that log line when readable_range is set would fix the second.
  2. BindingFacts::ring_failed is only used by the test. Both runtime sites call count_null_binding(NullCause::ring_full) directly. No runtime code sets ring_failed or reaches the new classifier rule. The mutant in the description, which drops the ring_failed → ring_full rule, therefore only shows that the unit test checks the classifier. It doesn't cover the draw path. Either route the two sites through classify_null_binding with ring_failed set, or drop the field and test the call sites.
  3. Other ring users are not counted. The index-buffer frame_copy (indices_ok && frame_copy(...)), the root-SRV upload_from_title and the texture reserve_upload_ring calls can also fail on ring space without touching ring_full. Textures are #2855. If the index path is in scope, it would explain part of the gap between refusals and ring_full above.
  4. The statistics line. reserved N MiB is cumulative and capacity is current, so once #2847 or #2849 lands, reserved will pass capacity routinely. Labelling it "reserved since start" would avoid misreading.
  5. Conflicts. git merge-tree reports conflicts with both #2847 and #2849 in d3d12_draw.inl and d3d12_xs_device.cpp. Both rewrite reserve_upload_ring, and #2847 also changes frame_copy. Whichever lands second will need the counters moved into the new reservation code.

Points 1–4 come from reading the code. I did not force a formatted-buffer or index-buffer ring failure.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6077319838 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#pullrequestreview-6077319838). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-26T16:11:24Z. **Review:** COMMENTED --- Tested on Windows hardware and read the diff. The full suite and the startup run used `166b62a7`. After `07222b46` landed, I rebuilt and reran the 34 fixtures below on it: 34/34 passed. **Environment:** Windows 11 build 26300.9974, MSVC 19.44.35230, Windows SDK 10.0.26100, NVIDIA GeForce RTX 4090 driver 610.88 (32.0.16.1088), WARP and hardware backends, D3D12 debug layer not enabled. **Fixtures** ```powershell ctest --preset dev --no-tests=error -R '^(startup_null|startup_indirect_translated|startup_address_console_gate|upload_reservation$|startup_slot133_heap_cap)' ``` 34/34 passed. That covers your gate regex on WARP and hardware (the hardware variants ran rather than skipped), plus the `gate`/`gate-ring` fixtures, `upload_reservation` and all six `startup_slot133_heap_cap` cases. Full suite, in two passes so the hardware tests don't contend for the GPU: ```powershell ctest --preset dev --no-tests=error -j 20 -E '_hardware$' --timeout 600 ctest --preset dev --no-tests=error -j 4 -R '_hardware$' --timeout 600 ``` The first pass passed 1752/1752 with 22 capability skips (77). The second ran 690 tests: 688 passed, including 8 capability skips, and 2 failed: - `pixel_aot_cvt_flr_rpi_hardware` timed out at 60 s under `-j 4` and passed when rerun alone (26.6 s). This is contention. - `compute_store_aot_mac_f32_hardware` also fails when run alone: `mac_f32: mad() fusion probe read back neither model alone: {'fused': False, 'unfused': False}`. The probe comes from #2844, which is now on main. The run doesn't touch the startup stand-in, so it is unrelated to this PR. I'll report it separately. **Startup run from #2837 (on this PR alone, so the ring still caps at 256 MiB)** I used a release build and `run.ps1 -Render -Translate -FakeUser -GpuMirror -ContinueAsserts 1000`, 180 s, with A pressed every 5 s from 50 s. The new lines do what the PR says: ```text null bindings 7038 (entry 0, buffer 0, token 0, wrapper 0, dimension 0, ring_full 7038) translated draws 4745 (not drawn 7038) x2w-render upload ring: reserved 256 MiB in 12119 reservations, refusals 9088, capacity 256 MiB ``` On `7256cecf` the same run counted those failures as `buffer` null bindings. Here they are named and the draws are refused. Ring refusals (9,088) exceed `ring_full` (7,038) because texture uploads and index copies also reserve from the ring, and those failures are not counted here (see 3). **From reading the diff** 1. **Formatted buffers (the Codex point): fixed in `07222b46`.** Such a draw now counts `ring_full` before the early return. It also still counts in `formatted-load draws refused`, and the log line still says `formatted buffer refused (unresolved buffer)`. A reader adding the two totals would count it twice, and the log names the wrong cause. Saying "upload ring" in that log line when `readable_range` is set would fix the second. 2. **`BindingFacts::ring_failed` is only used by the test.** Both runtime sites call `count_null_binding(NullCause::ring_full)` directly. No runtime code sets `ring_failed` or reaches the new classifier rule. The mutant in the description, which drops the `ring_failed` → `ring_full` rule, therefore only shows that the unit test checks the classifier. It doesn't cover the draw path. Either route the two sites through `classify_null_binding` with `ring_failed` set, or drop the field and test the call sites. 3. **Other ring users are not counted.** The index-buffer `frame_copy` (`indices_ok && frame_copy(...)`), the root-SRV `upload_from_title` and the texture `reserve_upload_ring` calls can also fail on ring space without touching `ring_full`. Textures are #2855. If the index path is in scope, it would explain part of the gap between refusals and `ring_full` above. 4. **The statistics line.** `reserved N MiB` is cumulative and `capacity` is current, so once #2847 or #2849 lands, `reserved` will pass `capacity` routinely. Labelling it "reserved since start" would avoid misreading. 5. **Conflicts.** `git merge-tree` reports conflicts with both #2847 and #2849 in `d3d12_draw.inl` and `d3d12_xs_device.cpp`. Both rewrite `reserve_upload_ring`, and #2847 also changes `frame_copy`. Whichever lands second will need the counters moved into the new reservation code. Points 1–4 come from reading the code. I did not force a formatted-buffer or index-buffer ring failure.
tedin7 commented 2026-11-26 17:56:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T17:56:29Z.


Merged origin/main (GPU upload ring) into this branch: new head 65802fcd0a.

Conflicts in src/startup_stubs/d3d12_draw.inl and src/startup_stubs/d3d12_xs_device.cpp resolved keeping both sides: main's reserve_upload_ring(self, ...) / frame_copy(self, ...) signatures and chunk reuse stay; the ring_full null-binding count and the reserved/capacity/refusal counters sit on top of every reservation path (including the new reuse pass).

Verification:

  • git diff --check origin/main...HEAD: clean
  • cmake -S . -B /tmp/cm-2864 -DDXC_EXECUTABLE=/bin/true: rc=0
  • g++ -std=c++17 -Isrc tests/startup_null_cause_labels_check.cpp: PASS (17 cases)
  • Win2025 on 65802fcd (x2w_pipe.py win2025 2864 --regex 'startup_null_cause_labels|upload_reservation|startup_slot133_heap_cap' --keep-release): dev 100% passed out of 9; release 7/9 passed plus 2 skipped for capability (debug1 layer cases, not a pass).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7199870117 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#issuecomment-7199870117). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T17:56:29Z. --- Merged origin/main (GPU upload ring) into this branch: new head 65802fcd0a9970c4a1446798f6aed2dff41dd40f. Conflicts in `src/startup_stubs/d3d12_draw.inl` and `src/startup_stubs/d3d12_xs_device.cpp` resolved keeping both sides: main's `reserve_upload_ring(self, ...)` / `frame_copy(self, ...)` signatures and chunk reuse stay; the ring_full null-binding count and the reserved/capacity/refusal counters sit on top of every reservation path (including the new reuse pass). Verification: - `git diff --check origin/main...HEAD`: clean - `cmake -S . -B /tmp/cm-2864 -DDXC_EXECUTABLE=/bin/true`: rc=0 - `g++ -std=c++17 -Isrc tests/startup_null_cause_labels_check.cpp`: PASS (17 cases) - Win2025 on 65802fcd (`x2w_pipe.py win2025 2864 --regex 'startup_null_cause_labels|upload_reservation|startup_slot133_heap_cap' --keep-release`): dev 100% passed out of 9; release 7/9 passed plus 2 skipped for capability (debug1 layer cases, not a pass). AI-assisted; commands listed were executed locally.
pigalot commented 2026-11-27 19:54:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T19:54:26Z.

Review: COMMENTED


I tried to review 65802fcd over current main 454fc0ed. The trial merge conflicts in one hunk of src/startup_stubs/d3d12_xs_device.cpp, the 300-frame log block:

  • main (#2920, e04217f4) added builder gate refused %ld / compute_builder_gate_refusals to the x2w-render compute dispatches line.
  • This PR adds the x2w-render upload ring line just above the old form of that line.

The fix looks mechanical: keep the new upload ring line, then main's compute dispatches line with the builder gate count. Since then main has also taken #2949 (98e4a2ee, opt-in release of upload ring chunks at a fenced submit). It would be worth checking that reserved and refusals still mean what the body says once chunks can be released early.

I'll review it once it is updated with main.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6092816913 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#pullrequestreview-6092816913). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T19:54:26Z. **Review:** COMMENTED --- I tried to review `65802fcd` over current `main` `454fc0ed`. The trial merge conflicts in one hunk of `src/startup_stubs/d3d12_xs_device.cpp`, the 300-frame log block: - `main` (#2920, `e04217f4`) added `builder gate refused %ld` / `compute_builder_gate_refusals` to the `x2w-render compute dispatches` line. - This PR adds the `x2w-render upload ring` line just above the old form of that line. The fix looks mechanical: keep the new upload ring line, then `main`'s compute dispatches line with the builder gate count. Since then `main` has also taken #2949 (`98e4a2ee`, opt-in release of upload ring chunks at a fenced submit). It would be worth checking that `reserved` and `refusals` still mean what the body says once chunks can be released early. I'll review it once it is updated with `main`. This reply was AI-assisted.
tedin7 commented 2026-11-27 21:28:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T21:28:16Z.


Updated with main: pushed f01ad4d1d. The one conflict is resolved as you suggested (upload ring line kept, then the compute dispatches line with the builder gate count). With the opt-in early chunk release, reserved counts successful reservations including recycled chunks (it can exceed capacity), and refusals counts allocation failures; docs/experiments.md says so.

Not yet re-run on Windows after the merge.

Commands run locally: python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py, cmake -S . -B <tmp> -DDXC_EXECUTABLE=/bin/true, public_guard.py.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7228472902 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#issuecomment-7228472902). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T21:28:16Z. --- Updated with `main`: pushed `f01ad4d1d`. The one conflict is resolved as you suggested (upload ring line kept, then the compute dispatches line with the builder gate count). With the opt-in early chunk release, `reserved` counts successful reservations including recycled chunks (it can exceed capacity), and `refusals` counts allocation failures; `docs/experiments.md` says so. Not yet re-run on Windows after the merge. Commands run locally: `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py`, `cmake -S . -B <tmp> -DDXC_EXECUTABLE=/bin/true`, `public_guard.py`. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-27 21:47:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T21:47:17Z.


Verification: head f01ad4d1d after the main merge and the latest fixes.

Environment: Windows Server 2025 (build 26100), MSVC 14.44, D3D12 WARP and the hardware adapter, dev and release legs in parallel.

Commands (the same selection in both legs):

x2w_pipe.py win2025 2864 --force --regex '^(startup_null_.*)$'
  dev:     cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_null_cause_labels_check startup_null_views_check
           ctest --preset dev -R '^(startup_null_.*)$' --no-tests=error --output-on-failure
  release: cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_null_cause_labels_check startup_null_views_check
           ctest --preset release -R '^(startup_null_.*)$' --no-tests=error --output-on-failure

Result: 6/6 passed in both legs.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7228754150 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#issuecomment-7228754150). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T21:47:17Z. --- Verification: head `f01ad4d1d` after the main merge and the latest fixes. Environment: Windows Server 2025 (build 26100), MSVC 14.44, D3D12 WARP and the hardware adapter, dev and release legs in parallel. Commands (the same selection in both legs): ``` x2w_pipe.py win2025 2864 --force --regex '^(startup_null_.*)$' dev: cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_null_cause_labels_check startup_null_views_check ctest --preset dev -R '^(startup_null_.*)$' --no-tests=error --output-on-failure release: cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_null_cause_labels_check startup_null_views_check ctest --preset release -R '^(startup_null_.*)$' --no-tests=error --output-on-failure ``` Result: 6/6 passed in both legs. AI-assisted; commands listed were executed locally.
pigalot commented 2026-11-27 22:49:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:49:18Z.

Review: APPROVED


Re-reviewed f01ad4d1 merged over current main 14d56502. The merge is clean and git diff --cached --check is clean. The device.cpp log-block conflict from my comment on 65802fcd is resolved: the totals line keeps main's fields and adds ring_full after dimension.

What the change does at the draw sites.

  • Two refusal sites: a readable buffer range whose upload copy fails now refuses the draw and counts ring_full. One site is the frame-copy binding, the other the odd-size padded stream. Each releases draw_lock before return false, like the existing formatted-load refusal.
  • Only a full ring reaches them: the binding caps bytes at 16 MiB before either site (d3d12_draw.inl, the "16 MiB copy cap" block). reserve_upload_ring's size-based refusal (bytes > max_upload_ring_bytes / 4, 64 MiB) is never reached from here, so ring_full always means the ring had no space.
  • Ring statistics: the counters are added on every successful return path of reserve_upload_ring, and refusals on its final refusal.

What I ran. I did a full build in dev and release, then ran

ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^(startup_null.*|startup_indirect_translated.*|startup_stream_draw.*)$' -E '(_hardware$|startup_audio_)'
# with X2W_TEST_DEBUG_LAYER=1, one at a time
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_null.*|startup_indirect_translated.*|startup_stream_draw.*)_hardware$'

15/15 and 10/10 pass in both presets, with no skips. These include startup_null_cause_labels and its _buffer_token_control.

Mutants. For each, I rebuilt in dev and ran the 15 non-hardware tests:

Mutant Result
classify_null_binding drops the ring_failed rule killed (startup_null_cause_labels)
frame-copy site doesn't refuse (if (readable_range && !have) → if (false)) survives
padded-stream site doesn't refuse (if (readable_range && !target) → if (false)) survives

Restored and rebuilt afterwards; git diff --quiet is clean.

Non-blocking.

  1. The refusal itself is unpinned. The description says so, and the two survivors confirm it. Nothing fails if the draw goes ahead with a null binding again. A follow-up fixture could fill the 256 MiB ring within one recording, for example 17 or more draws that each copy a 16 MiB readable buffer before a submit. It would then assert a ring_full line and a refused draw.
  2. BindingFacts::ring_failed is never set by the runtime. Both sites call count_null_binding(NullCause::ring_full) directly, and count_buffer doesn't set the new field. So the new cases in startup_null_cause_labels pin a rule the draw path doesn't go through. Routing the two sites through count_buffer with ring_failed = true would make the label test cover them. Otherwise, a comment saying the field exists only for the classification test would help the next reader.

Verdict: approve on f01ad4d1.

Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; D3D12 WARP; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; debug layer on for the hardware runs.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on f01ad4d1.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6094064123 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2864#pullrequestreview-6094064123). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T22:49:18Z. **Review:** APPROVED --- Re-reviewed `f01ad4d1` merged over current `main` `14d56502`. The merge is clean and `git diff --cached --check` is clean. The `device.cpp` log-block conflict from my comment on `65802fcd` is resolved: the totals line keeps main's fields and adds `ring_full` after `dimension`. **What the change does at the draw sites.** - **Two refusal sites:** a readable buffer range whose upload copy fails now refuses the draw and counts `ring_full`. One site is the frame-copy binding, the other the odd-size padded stream. Each releases `draw_lock` before `return false`, like the existing formatted-load refusal. - **Only a full ring reaches them:** the binding caps `bytes` at 16 MiB before either site (`d3d12_draw.inl`, the "16 MiB copy cap" block). `reserve_upload_ring`'s size-based refusal (`bytes > max_upload_ring_bytes / 4`, 64 MiB) is never reached from here, so `ring_full` always means the ring had no space. - **Ring statistics:** the counters are added on every successful return path of `reserve_upload_ring`, and `refusals` on its final refusal. **What I ran.** I did a full build in `dev` and `release`, then ran ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^(startup_null.*|startup_indirect_translated.*|startup_stream_draw.*)$' -E '(_hardware$|startup_audio_)' # with X2W_TEST_DEBUG_LAYER=1, one at a time ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_null.*|startup_indirect_translated.*|startup_stream_draw.*)_hardware$' ``` 15/15 and 10/10 pass in both presets, with no skips. These include `startup_null_cause_labels` and its `_buffer_token_control`. **Mutants.** For each, I rebuilt in `dev` and ran the 15 non-hardware tests: | Mutant | Result | |---|---| | `classify_null_binding` drops the `ring_failed` rule | killed (`startup_null_cause_labels`) | | frame-copy site doesn't refuse (`if (readable_range && !have)` → `if (false)`) | **survives** | | padded-stream site doesn't refuse (`if (readable_range && !target)` → `if (false)`) | **survives** | Restored and rebuilt afterwards; `git diff --quiet` is clean. **Non-blocking.** 1. **The refusal itself is unpinned.** The description says so, and the two survivors confirm it. Nothing fails if the draw goes ahead with a null binding again. A follow-up fixture could fill the 256 MiB ring within one recording, for example 17 or more draws that each copy a 16 MiB readable buffer before a submit. It would then assert a `ring_full` line and a refused draw. 2. **`BindingFacts::ring_failed` is never set by the runtime.** Both sites call `count_null_binding(NullCause::ring_full)` directly, and `count_buffer` doesn't set the new field. So the new cases in `startup_null_cause_labels` pin a rule the draw path doesn't go through. Routing the two sites through `count_buffer` with `ring_failed = true` would make the label test cover them. Otherwise, a comment saying the field exists only for the classification test would help the next reader. **Verdict:** approve on `f01ad4d1`. Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; D3D12 WARP; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; debug layer on for the hardware runs. CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `f01ad4d1`. This reply was AI-assisted.
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
R0Y00/Xbox2Windows!2856
No description provided.