AMD's compiler makes the compute pipelines it crashed on: a buffer's size through a handle of its own (VICTORY_SIZE_OWN_HANDLE) #252
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!252
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-252"
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?
@thejacte on GitHub · 2026-11-26 12:57 UTC · original
thejacte:shader/size-own-handle→rx9070xt· +470 −51 · 9 files · 3 commits · closed without mergingOn an RX 9070 XT (driver 32.0.32029.2010) the driver's shader compiler crashes making some compute pipelines; the crash guard leaves them out, so their draws are dropped. In my logs every one of these crashes is the same: compute, the same instruction in the driver, a read at address 0x8.
Cause. The compiler crashes on any pipeline in which one raw buffer view taken from the heap is both read and asked for its size (
GetDimensions). Bisected on the card with variants ofemit::size_tests::the_record_count_of_a_structured_buffer_read_by_index(which crashes the test process on this card for that reason) and with plain HLSL compiled by Microsoft's dxc, so it is the driver and not our DXIL:ByteAddressBufferfromResourceDescriptorHeapGetDimensions+Load, any index, f32 or u32, size used before or afterGetDimensionsonly, orLoadonlyLoadbeforeGetDimensionsNonUniformResourceIndexon one or both handlesGetDimensionson a second handle fromWaveReadLaneFirst(index)Change (two commits):
VICTORY_SIZE_OWN_HANDLE=1(off by default;emit::size_own_handle): a buffer's size query gets a handle of its own, made from the same heap index read from the first lane, so the compiler cannot merge it with the handle the buffer is read through. Only for buffers read from a heap table, not in a waterfall loop, not in pixel shaders (a helper lane's first-lane read is undefined). The shader cache keys on it (shader_cache.rs; the translator fingerprint picks it up through build.rs).scripts/play.ps1turns it on;-More @{VICTORY_SIZE_OWN_HANDLE='0'}turns it off.Measured (Windows 11, RX 9070 XT, driver 32.0.32029.2010, Ryzen 7 9800X3D, 64 GB,
play.ps1 -Safe):victory warm --usedover the 2,248 pipelines my runs drew with (warm-bad.txt emptied first): switch off, the compiler crashed on 25; on, on none. Pipelines left without a host pipeline: 40 either way.All 35 compute shaders the compiler crashed on in run 2 were made in run 5. No errors and no device loss in any run. The frame rate is about the same: this brings the effects back, it does not make frames faster.
Checked:
cargo test --workspace --locked: 918 passed, 0 failed (without the one test that crashes on this card with the switch off, as before).the_record_count_through_a_handle_of_its_own(the record-count programs with the switch on give the same values on the card and on WARP; it no longer crashes here) andthe_size_handle_stays_apart_from_the_read(in the written DXIL, after the clean-up passes, the size and the load use two handles and the size's index comes fromWaveReadLaneFirst; it fails with the switch off; needs dxc beside the validator, skipped without).cargo clippyboth ways: no new warnings (this branch still has the older ones the CI fix in my other pull request deals with; on top of it,-D warningspasses).cargo xtask policy --staged: ok.Whether the switch should be the code's default on AMD hosts (
host_rdna) is your call; I kept the old path as the default and turned it on in play.ps1. I can also report the driver bug to AMD with the HLSL reproducer.🤖 Generated with Claude Code
So that AMD's compiler makes the compute pipelines it crashed on (see the commit before). In a run here (RX 9070 XT, the same place of the same save) the compiler crashed on 35 pipelines with it off, on none with it on, and the draws left out for want of a pipeline went from 3.5-4.3 % to 2.0 %. `-More @{VICTORY_SIZE_OWN_HANDLE='0'}` turns it off. Co-Authored-By: Claude Opus 5.5 <[email protected]>@luisaugustz on GitHub · 2026-11-26 14:36 UTC · original
Independent confirmation on a different CPU. RX 9070 XT 16 GB, driver 32.0.32029.2010, Ryzen 7 5800X, 32 GB, Windows 11.
Applied this PR alone on rx9070xt @
81ebb7bd, withVICTORY_SIZE_OWN_HANDLE=1and an empty warm-bad.txt (own copy of the cache):Also stacked it with #235, #231 and avatarmanz
4fd34fd(exact cascade shadows on wave32) on the same base: 24 minutes, 13 fps, 0 compiler crashes, no crash. Cell frames look the same as without them. One note on #231: the "texture picked by index changed after its upload" warning still reached its 200-line cap with it applied, so I cannot show it removing those here.Happy to run anything else on this card.
@gut0to on GitHub · 2026-11-26 16:16 UTC · original · reviewed
AI-assisted review. I inspected the changed shader-lowering path and existing size-handle tests statically; I did not run tests or a GPU/game build. This review suggests a focused regression test for the pixel-shader fallback.
@ -6521,0 +6523,4 @@// read through; with one handle for both it crashes (`size_own_handle`).// Not in pixel shaders: a helper lane's first-lane read is undefined.let h = if super::size_own_handle()&& !self.s.pixel@gut0to on GitHub · 2026-11-26 16:16 UTC · original
AI-assisted review; I did not run tests. Could we add a pixel-stage case with VICTORY_SIZE_OWN_HANDLE enabled that asserts this path does not emit waveReadLaneFirst for a raw-buffer size query? The explicit pixel guard protects helper lanes, where the first-lane read is undefined, but the current new tests exercise only compute translation, so a later refactor could remove this guard without failing them.
@LOCKhart07 on GitHub · 2026-11-26 20:40 UTC · original
Another data point on an RX 9070 XT, driver 32.0.32029.2010, Ryzen 7 7800X3D, 32 GB, Windows 11.
Before (a different VIctory fork, no compiler guard): 3 of 3 runs ended in
0xc0000005inamdxc64.dll, read0x8, from a pipeline worker. That was+0x85fd0fon 32.0.32015.7029, and+0x861b9fafter updating to 32.0.32029.2010. Every crash came right afterFFX FSR4 ACO: DeserializeComputePipelineStateX FAILED ... falling back to NewBE.With this PR: only
b148067cherry-picked ontoa-publier@cd8dfc0(it applied cleanly; only theplay.ps1hunk conflicted, so I set the switch in my launcher instead). Release build,VICTORY_SIZE_OWN_HANDLE=1, shaders re-translated (25,790 / 195 untranslated, as before). Two runs: Series X ~5 min and Series S ~7.5 min, the second ended by hand. 0 compiler crashes caught by the guard, nowarm-bad.txtwritten, 0 ERROR lines.I didn't run this fork without the switch, so I can't separate this PR's effect from the rest of
rx9070xt. But the crash that ended every run before didn't happen once. Series S world: ~16 fps, 62.9 ms per frame at ~6,800 draws.@thejacte on GitHub · 2026-11-26 20:55 UTC · original
Superseded by #339: the same fix rebased onto the rebuilt
rx9070xt(cd8dfc0), with the pixel-shader test asked for in the review and theplay.ps1default. The results reported here are summarised there. Thanks for testing and reviewing.Pull request closed