Shaders: give buffer size queries their own bounded heap handle (AMD compiler crash) #109
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/109"
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 Zettrox/ztrx. Originally posted by WHOISJARDAS on 2026-11-25T12:05:30Z.
Fixes the AMD shader compiler crash
0xc0000005atamdxc64.dll+0x861b9f("read 0x8") that ends runs when a pipeline is created, here on an RX 9070 XT and in the reports on other Radeon cards (#81, #46; upstream fxceless/victory-fork#3 and fxceless/victory-fork#120), without leaving any pass out and without skip lists.What was wrong
Some programs read a buffer's last records at an offset made from that buffer's own size: the record count comes from the descriptor read as data (
descriptor_data, lowered togetDimensions), and the read or write goes through the same descriptor. Both went through one heap handle. AMD's compiler (driver 32.0.32029.2010, RDNA 4) crashes building exactly that shape, an access through a handle at an offset computed from that handle's owngetDimensions. The DXIL is valid (the validator passes it), so this is the driver, but the shape is ours to avoid.descriptor_datanow asks the size through a handle of its own (Shader::size_handle): its heap index goes through adx.op.binaryUMin, one slot below the view limit when there is one (VIEW_LIMIT - 1), else2^26 - 1(past any host heap, below what an index made from a 32-bit address can be), so it is never the access's handle.shortcut:with a limit, an index at or past the slot below the null slot reads that slot's size where reads go to the null slot; neither holds one of the title's views.This also covers
501f0865fdf45dfd, the program #61 leaves the reuse pass out on AMD for: with this, it builds with every pass on.Tested
AMD Radeon RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 9800X3D, 32 GB, Windows 11 Pro 26200, Rust 1.98.1,
shaders.rpfof the title's buildb99f876b.Offline, one process per program (
VICTORY_TRANSLATE_ONLY=<hash> victory translate --validate --pipelines --jobs 1):main(90b529f)main(among them501f0865fdf45dfd)Whole archive:
translate --validate --list: the same outcome asmainfor all 25,889 programs (26,084 translated, 0 differences).39f0e9aeb156a61c, left out as the program whose compile does not finish in fxceless/victory-fork#3) were built as host pipelines on this card in 13 batches: 22,379 created, 0 refused, 0 crashes.In game (diag build, Series X profile, default switches, no skip list, cold shader cache; both runs also carry #108, without which
maindoes not start on this machine):0xc0000005atamdxc64.dll+0x861b9f(the last compute programs translated were072f5fe96efd27e1and501f0865fdf45dfd)mesh f5e50eb2108c425b(integer-target blending, #36)cargo test --workspace --locked: 497 passed, 0 failed, 7 ignored, including the newemit::descriptor_tests::every_lane_reads_the_last_dword_its_buffers_record_count_names, which runs on the GPU and on WARP. Without thelower.rschange its process dies on this card with0xc0000005(STATUS_ACCESS_VIOLATION); with it, it passes.-D warnings, with and without--all-features): clean.cargo xtask policy: ok.Overlap
#58 moves the same
getDimensionscall into a newLower::dimensions. Whichever lands first, the other is a small rebase: with #58 in, buffer views takesize_handleinsidedimensions. Happy to rebase this onto it.Not tested
NVIDIA (where
VIEW_LIMITis set, so theVIEW_LIMIT - 1bound is what runs) and Intel; RDNA 2/3; Linux/Wine.AI use
Claude Code (Claude Opus 5.5) reduced the crash, wrote the change and the test, and ran the offline batches. The hardware, the title copy and the runs are mine.
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.