runtime: make the coherent placed buffer refresh opt-in #3916

Manually merged
github merged 1 commit from github-bot/gh-3914 into gh-pr/3914/base 2026-12-03 08:07:54 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-12-03 07:54 UTC · original
Leyukaka:coherent-placed-refresh-optin → main · +36 −1 · 6 files · 1 commits · merged 2026-12-03 08:06 UTC

Problem

Since #3778, a translated draw input or a compute root SRV in a placed buffer that does not alias guest memory is refreshed from guest memory through refresh_range. Two things changed with it.

Full-length application runs stall. Since #3778, every full run stalls when it reaches a later, heavier scene: the presenter reports x2w-present fence wait exceeded 2 seconds, and the process is ended about 30 s later. Bisection shows the stall needs the refreshed bytes themselves:

Variant Result
refresh as merged stalls
same ranges copied to a scratch buffer instead of the placed buffer no stall
same ranges written as zeros no stall
refresh disabled no stall

So the copy cost and the fence handling are not the cause. The buffers involved are consumed as constant buffers. The likely cause is a translated shader doing unbounded work once it reads real constants. That is not confirmed and is still under investigation.

Refusal controls fail on main. These tests expect a refusal for an input that is now refreshed:

  • 8 compute tests reported by @⁠JB2WIN in #3778: startup_compute_dispatch_input_{warp,hardware}, startup_compute_input_view_token_{warp,hardware}, startup_compute_root_srv_dispatch_{warp,hardware}, startup_compute_snapshot_order_{warp,hardware}
  • 5 indirect tests: startup_indirect_translated_draw_{warp,hardware}, startup_indirect_translated_refusal_census_{warp,hardware}, startup_indirect_translated_refusal_census_control_warp. #3892 addresses these in a different way.

Change

This is a temporary gate, not a revert. All of #3778 stays in the tree and can be enabled per run.

  • X2W_COHERENT_PLACED_REFRESH=1 turns the refresh on. The switch is read once per process. With it on, behaviour is the same as current main.
  • With the switch unset, indirect_table_buffer and compute_root_srv_buffer do not call the refresh. They refuse these inputs with the same refusal text as before #3778. The two refusal reasons that #3778 added appear only with the switch on.
  • Nothing from #3778 is removed: page tracking, before_submit / commit_lists, mark_gpu_written on copies and the triage reasons are unchanged.
  • startup_coherent_placed_srv_{warp,hardware} now set the switch. A new test, startup_coherent_placed_srv_switch_off, runs with the switch off and checks that the gate reads off.
  • docs/startup-runtime.md has a new row in the switch table.

Once the stall is understood, the default can go back to on and the switch can be removed.

Validation

Windows, MSVC, on WARP and on a hardware adapter.

Targeted tests: 29/29 passed.

  • startup_coherent_placed_srv_{warp,hardware} with the switch on
  • startup_coherent_placed_srv_switch_off, the new control
  • the 5 indirect tests listed above, which fail on current main
  • the 8 compute tests listed above, which fail on current main
  • startup_mesh86_material_backing*
  • standin_exports, compat_report, triage_run

Independent read of the diff. With the switch unset, every path that #3778 touched behaves as it did before #3778, with identical refusal text. With X2W_COHERENT_PLACED_REFRESH=1, behaviour is the current one.

Full-length application runs.

Build Result
current main stalls at the later scene (fence wait over 2 s, process ended about 30 s later)
this branch, switch unset completes the full 360 s window with no stall

Notes

  • #3778: the refresh that this switch gates. Its code is unchanged.
  • #3892: marks UAV writes as GPU writes before the refresh. It only has an effect with the switch on, and it is still needed for that case. With the switch unset, the 5 indirect tests pass without it.
  • #3778: the report of the 8 compute failures. With the switch unset these controls pass with their original expectations. They will need new expectations when the default goes back to on.
  • The root cause of the stall is not identified yet. Work on it continues separately.
**@⁠Leyukaka** on GitHub · 2026-12-03 07:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3914) `Leyukaka:coherent-placed-refresh-optin` → `main` · +36 −1 · 6 files · 1 commits · merged 2026-12-03 08:06 UTC ## Problem Since #3778, a translated draw input or a compute root SRV in a placed buffer that does not alias guest memory is refreshed from guest memory through `refresh_range`. Two things changed with it. **Full-length application runs stall.** Since #3778, every full run stalls when it reaches a later, heavier scene: the presenter reports `x2w-present fence wait exceeded 2 seconds`, and the process is ended about 30 s later. Bisection shows the stall needs the refreshed bytes themselves: | Variant | Result | |---|---| | refresh as merged | stalls | | same ranges copied to a scratch buffer instead of the placed buffer | no stall | | same ranges written as zeros | no stall | | refresh disabled | no stall | So the copy cost and the fence handling are not the cause. The buffers involved are consumed as constant buffers. The likely cause is a translated shader doing unbounded work once it reads real constants. That is not confirmed and is still under investigation. **Refusal controls fail on `main`.** These tests expect a refusal for an input that is now refreshed: - 8 compute tests reported by @⁠JB2WIN in https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/3778: `startup_compute_dispatch_input_{warp,hardware}`, `startup_compute_input_view_token_{warp,hardware}`, `startup_compute_root_srv_dispatch_{warp,hardware}`, `startup_compute_snapshot_order_{warp,hardware}` - 5 indirect tests: `startup_indirect_translated_draw_{warp,hardware}`, `startup_indirect_translated_refusal_census_{warp,hardware}`, `startup_indirect_translated_refusal_census_control_warp`. #3892 addresses these in a different way. ## Change This is a temporary gate, not a revert. All of #3778 stays in the tree and can be enabled per run. - `X2W_COHERENT_PLACED_REFRESH=1` turns the refresh on. The switch is read once per process. With it on, behaviour is the same as current `main`. - With the switch unset, `indirect_table_buffer` and `compute_root_srv_buffer` do not call the refresh. They refuse these inputs with the same refusal text as before #3778. The two refusal reasons that #3778 added appear only with the switch on. - Nothing from #3778 is removed: page tracking, `before_submit` / `commit_lists`, `mark_gpu_written` on copies and the triage reasons are unchanged. - `startup_coherent_placed_srv_{warp,hardware}` now set the switch. A new test, `startup_coherent_placed_srv_switch_off`, runs with the switch off and checks that the gate reads off. - `docs/startup-runtime.md` has a new row in the switch table. Once the stall is understood, the default can go back to on and the switch can be removed. ## Validation Windows, MSVC, on WARP and on a hardware adapter. **Targeted tests: 29/29 passed.** - `startup_coherent_placed_srv_{warp,hardware}` with the switch on - `startup_coherent_placed_srv_switch_off`, the new control - the 5 indirect tests listed above, which fail on current `main` - the 8 compute tests listed above, which fail on current `main` - `startup_mesh86_material_backing*` - `standin_exports`, `compat_report`, `triage_run` **Independent read of the diff.** With the switch unset, every path that #3778 touched behaves as it did before #3778, with identical refusal text. With `X2W_COHERENT_PLACED_REFRESH=1`, behaviour is the current one. **Full-length application runs.** | Build | Result | |---|---| | current `main` | stalls at the later scene (fence wait over 2 s, process ended about 30 s later) | | this branch, switch unset | completes the full 360 s window with no stall | ## Notes - #3778: the refresh that this switch gates. Its code is unchanged. - #3892: marks UAV writes as GPU writes before the refresh. It only has an effect with the switch on, and it is still needed for that case. With the switch unset, the 5 indirect tests pass without it. - https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/3778: the report of the 8 compute failures. With the switch unset these controls pass with their original expectations. They will need new expectations when the default goes back to on. - The root cause of the stall is not identified yet. Work on it continues separately.
Since #3776, a translated draw input or compute root SRV in a placed
buffer that does not alias guest memory is refreshed from guest memory
through refresh_range. Full runs now stall at a later scene with that
refresh, and several refusal controls fail.

X2W_COHERENT_PLACED_REFRESH=1, read once, turns the refresh on. Unset,
both callers refuse these inputs with the reasons they used before
#3776. The #3776 code is unchanged behind the switch.

startup_coherent_placed_srv_{warp,hardware} set the switch, and
startup_coherent_placed_srv_switch_off checks that the gate reads off.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 07:55:25 +00:00
github-bot changed target branch from main to gh-pr/3914/base 2026-12-03 08:07:46 +00:00
github manually merged commit 9af44a3f23 into gh-pr/3914/base 2026-12-03 08:07:54 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 08:05 UTC · original · approved these changes

Independently reviewed 9af44a3f. Both production refresh_range callers are gated and the alias and copy-backed cases are preserved. Windows 11 build 26300, MSVC Debug: all 16 source-built cases passed, including 13 affected indirect and compute tests with the flag unset, both enabled refresh fixtures, and the explicit switch-off control. No skips, using WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. With identical binaries and X2W_COHERENT_PLACED_REFRESH=1, both refusal-census cases reproduced the key3 mismatch: pixel (0,0) got 0xff00ff00, expected 0xff000000. #3892 tracks the opt-in case. The original executable comparison remains the author's work.

**@⁠R0Y00** on GitHub · 2026-12-03 08:05 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3914#pullrequestreview-6165800374) · **approved these changes** Independently reviewed 9af44a3f. Both production refresh_range callers are gated and the alias and copy-backed cases are preserved. Windows 11 build 26300, MSVC Debug: all 16 source-built cases passed, including 13 affected indirect and compute tests with the flag unset, both enabled refresh fixtures, and the explicit switch-off control. No skips, using WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. With identical binaries and X2W_COHERENT_PLACED_REFRESH=1, both refusal-census cases reproduced the key3 mismatch: pixel (0,0) got 0xff00ff00, expected 0xff000000. #3892 tracks the opt-in case. The original executable comparison remains the author's work.
This discussion has been locked. Commenting is limited to contributors.
No description provided.