Repository navigation
startup: keep the split indirect Dispatch cache past DLL detach - #2734
ColorMeBoom wants to merge 2 commits into
Conversation
Review of R0Y00#2683: with X2W_SPLIT_INDIRECT_DISPATCH=1 on an RX 9070 XT (driver 32.0.32029.2010), startup_indirect_count_split_hardware printed every expected readback and then exited with 0xC0000409 (fail-fast in amdxc64.dll). The stack ran through the destructor of the function-local static SplitIndirectDispatch during DLL detach, which released the rewrite's pipeline state there. The reviewer measured a never-destroyed instance exiting 0 in 3 of 3 runs on that adapter. split_indirect_dispatch() now returns a heap instance that is never destroyed. Its entries were already kept for the life of the process. docs/experiments.md records the lifetime and the fault. AI-assisted.
|
The reviewed failure happens after successful readbacks. Please rerun the exact candidate on the RX 9070 XT that hit 0xC0000409, using startup_indirect_count_split_hardware with the split rewrite enabled. The receipt should include the readback verdict and the child process exit code. Please also make the lifetime boundary explicit: this cache is process-owned. If explicit DLL unload and reload in a live host is a supported path, that path needs teardown outside the loader lock and its own coverage because each reload would allocate a new cache. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head 27ae040 (comment only, no approval).
What I checked:
- The change itself is correct and minimal. A function-local
staticinstance is replaced by a never-deleted heap instance, so no destructor runs at DLL detach. The only callsite isd3d12_xs_device.cpp:3311, and it only needs a stable reference. - Entries were already kept for the process lifetime, so no behavior changes besides skipping the teardown.
- Docs: the new paragraph in
docs/experiments.mdreads fine and links resolve.
Not verified, and cannot be by me:
- The fault is a driver fail-fast on an RX 9070 XT (driver 32.0.32029.2010). Windows Server 2025 has WARP only, so a WARP run would not exercise this path. I did not run it and make no claim about it.
- @R0Y00's request in the thread is still open: a receipt from the exact candidate on the RX 9070 XT with the readback verdict and the child exit code, and an explicit statement of the lifetime boundary (process-owned cache; explicit unload and reload of the DLL in a live host would need teardown outside the loader lock and its own coverage). The PR text describes the lifetime but does not yet say whether unload/reload is a supported path.
- No test fails without the change. The existing
startup_indirect_count_split_hardwareonly shows the difference on that GPU, so a regression guard exists only on that hardware.
Linux checks run on this head: git diff --check origin/main...HEAD clean, python3 tests/docs_links_check.py pass, python3 tests/bidi_controls_check.py pass.
Note: rect_indirect_args.h:171 has the same static pattern; the author left it on purpose, which is reasonable for a single-behavior PR.
Merge is left to @R0Y00 / MasterDomino once the hardware receipt is posted.
AI-assisted; commands listed were executed locally.
|
Independent MSVC x64 Release regression check of |
|
RX 9070 XT run at
So this shows no regression, but it doesn't confirm the fix. I'm not merging on these runs alone: a main-executable change needs a negative control that catches the failure. The one setup difference I can see from the #2683 report: there, Windows build 26200 with no D3D12 debug layer installed; here, build 26300 with the debug layer installed. That could change the teardown path in @thepatrickworld, you reproduced AI-assisted; commands listed were executed locally. |
|
Independent AMD result: Not a code change; measurements and one dump. This is the head-passes / control-fails pair asked for above, with the ctest entry itself on both states, on the adapter and driver that reported the fault. Tree measured
Environment
Commandsgit -c user.name=panam -c user.email=panam@local merge --no-ff refs/panam/2734
cmake --preset dev "-DINTAKE_PYTHON=C:/Users/walde/Downloads/x2w-pr641/out/pe-env/Scripts/python.exe"
cmake --build --preset dev
ctest --preset dev --no-tests=error -R "^startup_indirect_count_split_hardware$" -V
set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT"
set "X2W_SPLIT_INDIRECT_DISPATCH=1"
out\build\dev\startup_indirect_dispatch.exe hardware count
out\build\dev\startup_indirect_dispatch.exe warp count
rem control: header restored to main, full preset rebuild, then the same three commands
git checkout origin/main -- src/startup_stubs/split_indirect_dispatch.h
cmake --build --preset dev
ctest --preset dev --no-tests=error -R "^startup_indirect_count_split_hardware$" -VObservedThe entry on the merged tree (header restored after the control), with The entry, on the control tree ( Direct runs of the executable the entry invokes: six hardware runs on the merged tree, each a fresh process, all exit The recorded output is identical line for line once per-run addresses and the build stamp are set aside: 58 lines each, same last line, empty normalized diff. The only difference left in the run is the exit status. Neighbouring entries On WARP the control tree also exits What this establishes: on this adapter and driver the change moves the process out of the failing path. With the header restored the entry and the executable both end in The dumpOne control run was instrumented with a
So in the control state the pipeline state is released inside On the other runs in this threadtedin7 notes that the regression guard exists only on that GPU; these are runs on that GPU, not a new guard. Nothing fails without the change in CI because the hardware entries are excluded there ( MasterDomino measured his own negative control — the same function-local static — and it exited 0 in 3 of 3 on Windows build 26300 with the debug layer installed, then declined to conclude and asked for this replay. Here, on build 26200.9974 without the layer, the same replay fails 4 of 4. Two things differ between those setups; the cheap discriminating run is 26200 with the layer installed, since 26300 changes both at once. R0Y00's third point, the lifetime boundary: no entry in this PR exercises an unload and reload — the harness contains no Limits
AI-assisted. |
|
Thanks, @thepatrickworld. That's the pair this needed, on the adapter and driver that reported the fault:
That covers @R0Y00's first request, the receipt with the readback verdict and the child exit code. It also explains my green control: here the build is 26300 with the debug layer installed, and there it's 26200 without it. One item left before I merge, @ColorMeBoom: @R0Y00's second request, a statement of the lifetime boundary. Please add one or two sentences, in the PR description and in the
Once that's in, this is ready to merge. CI is green, and the code change itself is correct as @tedin7 reviewed. AI-assisted. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head d7f8fe9 (code + fixture tests only; no game runs).
The change is small and reads as sound: split_indirect_dispatch() now returns a never-destroyed heap instance, and the docs note matches the code. The fault it targets (driver fail-fast during DLL detach on RX 9070 XT) was measured on hardware that is not available here, so that claim is not verified in this review.
Win2025 WARP (dev build, ctest, run twice on d7f8fe9 after updating with main):
startup_indirect_dispatch_warp: passeddocs_links: passedstartup_indirect_count_split_warp: FAILED both times. Output:word 11: got 0x31415926, expected 0x31415935,GPU writer: count word=2, executed=2, result=0x31415926 (expected 0x31415935), adapter Microsoft Basic Render Driver 10.0.26100.33648.
I did not compare against main on the same VM, so I cannot say whether this failure comes from the PR or already exists. The lifetime change should not affect that readback value, so it may be a pre-existing WARP difference. Could the author or @R0Y00 confirm how startup_indirect_count_split_warp behaves on main with this WARP version? Not merging until that is clear.
AI-assisted; commands listed were executed locally.
tedin7
left a comment
There was a problem hiding this comment.
Follow-up on head d7f8fe9: the startup_indirect_count_split_warp failure comes from this change.
Win2025 WARP, dev build, same driver (10.0.26100.33648), regex ^startup_indirect_count_split_warp$:
- PR head d7f8fe9 (never-destroyed heap instance): FAILED twice,
word 11: got 0x31415926, expected 0x31415935. - Same head with this PR's two-file diff reverted (function-local static, as on main):
100% tests passed out of 1.
So on WARP the test passes with the static and fails with the heap instance. Please check why the result of the last case changes, for example whether the test relies on the splitter's pipelines being released at exit, or on a fresh instance per process state. Not merging until it passes.
AI-assisted; commands listed were executed locally.
|
@tedin7, on
The last row is a control. As in my earlier run, the detach fail-fast doesn't reproduce on this machine; @thepatrickworld's pair on 26200 is the one that shows it. Your failure is Still open, @ColorMeBoom: of the two lifetime sentences I asked for at 05:18, AI-assisted; commands listed were executed locally. |
|
@tedin7, thanks for the A/B. That contradicts my "can't change that word", so I withdraw it. What I checked: the only in-process difference I can find between the two forms is storage location. A function-local static is zero-initialized before construction, and Your failing run ran the split, but neither record wrote: Could you check two things on the VM?
AI-assisted; commands listed were executed locally. |
|
@MasterDomino Win2025 run for head Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
AI-assisted; commands listed were executed locally. |
What / Why
Follow-up to the blocking finding in the review of #2683. With
X2W_SPLIT_INDIRECT_DISPATCH=1on an RX 9070 XT (driver 32.0.32029.2010),startup_indirect_count_split_hardwareprinted every expected readback and then exited with0xC0000409. That is a fail-fast inamdxc64.dll, reached through the destructor of the function-localstatic SplitIndirectDispatch splitterduring DLL detach, which released the rewrite's pipeline state there. The same review measured a never-destroyed instance exiting 0 in 3 of 3 runs on that adapter. #2683 was merged with the static in place, so main still has it.Change
src/startup_stubs/split_indirect_dispatch.h:split_indirect_dispatch()returns a heap instance that is never destroyed (static SplitIndirectDispatch* const splitter = new SplitIndirectDispatch;). Its entries were already kept for the life of the process.docs/experiments.md: the lifetime and the fault, in "Batched indirect Dispatch on RDNA 1".rect_indirect_args.hhas the same pattern (static RectIndirectArguments converter), which predates #2683. I left it unchanged: no fault has been reported for it, and this PR covers one behavior.Tests
Commit
27ae0401onfeec219e. Windows 11 Home build 26200.9974, VS 2022 Build Tools (MSVC 19.44.35230), Windows SDK 10.0.26100.0. AMD Radeon RX 5700 XT (1002:731f), driver 32.0.21045.29003; WARP 10.0.26100.9818. Debug layer unavailable.9 of 10 passed: both
startup_indirect_count_split_*, the dispatch and root-constant tests,docs_linksandstartup_tools_lint.startup_indirect_count_hardwarefails at its first case as reported in #2626 (native call, kept strict).startup_indirect_dispatch.exe <hardware|warp> countwithX2W_SPLIT_INDIRECT_DISPATCH=1, three runs each: exit 0 on all six, each printing all 14result=lines.Not verified
The RX 5700 XT and WARP also exited 0 before this change, so these runs show no regression, not the fix. The fault was measured on the RX 9070 XT in the #2683 review. A rerun there of
startup_indirect_count_split_hardwareon this head would confirm the exit.Refs #2683, #2626.
AI-assisted with Claude Code (Claude Opus 5.5).