startup: opt-in skip of the graphics root SRV copy that no draw reads #3028
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3028"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-27T08:04:45Z.
Change
Fixes #3027 (slot 44 copies a 64 KiB root SRV window at every call, but no draw reads the copy). Refs #2948, #2949.
X2W_D3D12_ROOT_SRV_AT_DRAW=1(opt-in): list slot 44 at a title address without an upload mapping skips the 64 KiB copy into the upload ring. The title address is kept for translated draws as before, and the parameter stays unbound on the desktop list (srv_boundclear). Unset, slot 44 copies at every call, as onmain.No draw reads that desktop binding in the current stand-in:
pass.root_address) at the draw.list_drawforwards only withpass.pipeline_real.build_stream_pipelineaccepts a graphics stream only with VS/PS or MS/PS, and every accepted one gets an indirect graphics root, sopipeline_realholds only for compute pipelines.indirect_graphics.root == pass.graphics_root: an empty root, or for a cached mesh pipeline the title's root, whose only root SRV comes from the validated lease.Changes:
d3d12_xs_device.cpplist_root_srv: under the switch, it counts and returns beforereadable_window/upload_from_title. The comment there says a desktop graphics pipeline that reads a root SRV would need the copy at its draw.x2w_d3d12_root_srv_copies(skipped, copied); a report line before the render totals when the switch is set:x2w-render root SRV copies (X2W_D3D12_ROOT_SRV_AT_DRAW): skipped N, copied M.docs/startup-runtime.md;docs/experiments/startup-root-srv-at-draw.md.bedfcafc) kept the address pending and copied at a reading draw. Review showed that no such draw can exist, so the pending state and its two call sites were removed.maine446b072): merges cleanly and adds no conflict withcpp-migrationor #2981. The one new text conflict is with draft #2603, on theX2W_TEST_ROOT_CBVline oftests/startup_stream_setup.cpp.Verification
Windows 10 22H2, i7-4790K, RTX 3080 Ti (NVIDIA 32.0.16.1047) and WARP; dev and release; commit
41b3c771(d4d76b88adds only the retest table).125 tests per preset, run with the switch unset and set: 123/125 pass in each of the four runs. The two failures are
startup_list_resubmit_nodebug_hardwareandstartup_list_resubmit_nodebug_untracked_hardware(SegFault). Both fail the same way on unmodifiedmainon this host. 18 capability skips (WARP without mesh shaders,startup_root_heapwithout the debug layer), the same in every run.startup_root_srv_draw_{warp,hardware}: slot 44 binds a title buffer holding red, the title writes green, then a translated draw reads the SRV through its root pointer. Both modes draw green. The fixture then reads the stand-in's counts: unsetskipped 0, copied 1; setskipped 1, copied 0.X2W_D3D12_ROOT_SRV_AT_DRAW=1: copies (skipped, copied) (0, 1), expected (1, 0)on both adapters.Startup run of the main executable (#870), release, warm shader cache, scripted input, 250 s,
X2W_D3D12_RING_RELEASE_AT_SUBMIT=1andX2W_D3D12_TABLE_ALIAS=1in every run, two pairs (second in reverse order), on41b3c771:buffer;tokenper 1,000 translated drawsThe first revision gave 6.3 / 7.1 → 14.8 / 14.0 fps in the same setup. Without other switches, it cut the buffer null bindings from 164,727 to 88 (#2948), but some ring reservations were still refused, so this complements #2949. No device removal and no ring refusals in any retest run.
AI-assisted: the change, tests and this description were written with Claude; I ran the startup comparison.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T08:25:38Z.
Review: CHANGES_REQUESTED
Independent integration run at
bedfcafcwithmain3b6c38a8. I rebuiltstartup_stream_consumerandd3d12_xs_shim, then ranctest --preset <dev|release> --no-tests=error -V -R '^startup_(root_srv_draw|stream_draw|root_reset|root_cbv|table_alias)_(warp|hardware)$'. Each preset passed 10/10 without skips on Windows 11 build 26200.9974, WARP 10.0.26100.9818 and RTX 4060 Laptop driver 32.0.16.1656. Both adapters drew the expected green through the translated path, with the copied count 1 when the switch was unset and 0 when set. Table-alias debug checks reported zero errors. The PR's original-executable benchmark remains contributor evidence.The positive deferred desktop bind remains untested. In
list_draw,bind_pending_root_srvsruns before the target/topology gate, so a skipped draw with a real pipeline can consume and copy a pending SRV. Also,bind_pending_root_srvsclears the pending mask and counts an at-draw copy beforebind_root_srv_copyconfirms it obtained a desktop address. The direct and indirect callers cannot distinguish a failed copy from a successful bind. Please defer until the remaining draw checks accept the draw, preserve or explicitly invalidate the pending state on copy failure, and make the counter match successful copies. Add a narrow fixture for a consuming desktop draw and a skipped or failed bind, so the two new call sites have observable coverage.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-27T09:32:26Z.
Thanks for the integration run and the careful read. Following the deferred bind into a fixture showed that no draw can read the desktop binding in the current stand-in, so
d4d76b88drops the deferral: with the switch set, slot 44 skips the copy and the parameter stays unbound on the desktop list.bind_pending_root_srvs, the pending state and both call sites are gone, so the ordering and failed-copy issues you found no longer exist.Why no consuming draw can be built:
list_drawforwardpass.pipeline_realbuild_stream_pipelineaccepts a graphics stream only with VS/PS or MS/PS ("desktop indirect graphics stream needs ..."), and every accepted one getsindirect_graphics.root.list_pipelinesetspipeline_real = available && !indirect_graphics.root, so it holds only for compute pipelines. A vertex-only desktop stream (my first fixture attempt) is refused by the same rule.indirect_graphics.root == pass.graphics_rootroot_without_bindings), so the list's root has no SRV parameter. A cached mesh pipeline uses the title's root, and its only root SRV (cached_srv_root) comes from the validated lease; slot 44 already returns early for it.pass.root_addressWhat changed (
7fb8bd88, then a merge ofmain3b6c38a8as41b3c771, and the retest noted4d76b88):list_root_srv: under the switch, it counts and returns beforereadable_window/upload_from_title. Unset is byte-for-byte the old path, plus thecopiedcounter.x2w_d3d12_root_srv_copies(skipped, copied). The fixture asserts unset(0, 1)and set(1, 0), still with the green pixel check.srv_boundbit 0 stays clear, solist_drawskips the draw rather than using an older binding.Receipts on
41b3c771(d4d76b88adds only the note), Windows 10 22H2 19045, RTX 3080 Ti driver 32.0.16.1047 and WARP 10.0.19041; the fixture runs without the debug layer:ctest --preset <dev|release> --no-tests=error -j 1 -R '^startup_root_srv_draw_(warp|hardware)$' -Vskipped 0, copied 1, setskipped 1, copied 0; 32 pixels exact (green left, clear right)root_srv_at_draw()returns falseX2W_D3D12_ROOT_SRV_AT_DRAW=1: copies (skipped, copied) (0, 1), expected (1, 0)startup_root_.*,startup_stream_draw.*,startup_address_.*,startup_indirect_.*,startup_table_alias_.*,startup_frame_copy_.*, ...) switch unset / setstartup_root_heapneeds the debug layer); the 2 failures arestartup_list_resubmit_nodebug{,_untracked}_hardware, which segfault on unmodifiedmainon this host toobuffernulls 0, no ring refusals, no removal; commit peak 18.5–18.7 GiB bothThe experiment note keeps the
bedfcafctables (no run there made a copy at a draw, so slot 44 did the same work) and adds this retest.Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T12:56:57Z.
I rebuilt
startup_stream_consumerandstartup_list_resubmitfromd4d76b881d8ab72782f61a67479de518f2c55f33in Release on Windows 11 build 26300.10075 and ran:All six tests passed, with no skips. The root SRV fixture read exactly 32 green pixels in both switch modes on WARP (10.0.26100.10068) and RTX 4070 (32.0.16.2124). With the switch disabled, the counter showed 0 skipped and 1 copied. With it enabled, it showed 1 skipped and 0 copied. That verifies the translated draw observed the write after Slot 44 in both modes.
The two hardware resubmit tests that segfaulted on the reported Windows 10 setup both passed here, with a device removal reason of
S_OK. This run covers Release and synthetic fixtures.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T13:32:28Z.
Review: APPROVED
Retested
d4d76b88integrated withmain246857e4(tree71208195f96e120c9a38b830fe7a62263d1eeba9). Removing deferred binding resolves the two prior review findings. I checked that slot 44 still takes the existing mapped-resource path and that the opt-in branch preserves the title address for translated draws while leaving the desktop SRV tracking bit clear.Built
startup_stream_consumer d3d12_xs_shim startup_list_resubmitand ranctest --test-dir <build> --no-tests=error -V -R '^startup_(root_srv_draw|stream_draw|root_reset|root_cbv|table_alias|list_resubmit_nodebug|list_resubmit_nodebug_untracked)_(warp|hardware)$'. Debug and Release/O2each passed 14/14 with zero skips, including both hardware resubmission cases. In the root-SRV fixture, both switch modes produced the exact 32-pixel reference on both adapters. The copy counters changed from 0 skipped / 1 copied to 1 skipped / 0 copied. Windows 11 26200.9974, WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656, SDK 10.0.26100. The root-SRV and nodebug resubmit fixtures run with the debug layer off. These are synthetic results; the startup timing comparison remains the contributor's measurement.