Shaders: one index clamp per heap handle (AMD's DXIL compiler crashes on shared ones); tools for driver compiler faults #984
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/fxceless--victory-fork!984
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-984"
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?
@Lynkes on GitHub · 2026-11-25 15:09 UTC · original
Lynkes:amd-compiler-clamps→main· +195 −6 · 9 files · 2 commits · openOn an RX 9070 XT, AMD's DXIL compiler crashes the process while building some translated compute pipelines. Most of it comes from the clean-up pass
REUSE; this PR fixes that part and adds the tools that found it.What happens
amdxc64.dllreads a null pointer insideCreateComputePipelineState(+0x85ffbfon driver 32.0.32015.16001,+0x861b9fon 32.0.32029.2010, the same registers) and the process ends. A game run hits it about 70 s in, while the world loads.victory translate --pipelinesovershaders.rpfreproduces it without the title: 70 of the pack's programs crash the compiler, namely 66 ped-materialCS_RaytracingResolve, threebvh_skinningtree-animation programs andCS_UpdateSkinnedAttachMeshTreeParticles. Microsoft's validator accepts all of them. It does not happen on NVIDIA.Cause (68 of the 70)
heap_handleclamps every view index (UMin(index, null_slot), taggedTag::Clamp). The record-count query reads a structured buffer's descriptor through aStructuredBufferview (getDimensions,lower.rs,Fields::Buffer→(12 | u, stride)), while the reads of the same buffer go through aByteAddressBufferview. Each handle has its own clamp untilREUSEmerges them. The two handles then share one index value, and that is what AMD's compiler crashes on.To find it, I let
REUSEmake only its first N merges onCSComputeTreeAnim, with pass 4 alone. 239 merges compile and the 240th crashes. Merge 240 is a clamp, and the DXIL then differs only in that the raw view and the 80-byte structured view of one slot take the same clamped index. WithVICTORY_SHADER_OPT=0, 68 of the 70 compile.The fix (first commit)
REUSEleaves clamp-tagged instructions alone, so there is one clamp per handle, as the lowering makes them.Module::tagrecordsTag::Clampalways. Tags were kept only while the census runs, so the clean-up could not see them.On the RX 9070 XT, 68 of the 70 now build. With the other two skipped,
translate --pipelinesbuilds every program in the pack.Still open: two programs
bvh_skinning:CSComputeSkinningTreeAnimVelocityandGpuParticleUpdate:CS_UpdateSkinnedAttachMeshTreeParticlescrash even with every clean-up pass off. No translator switch helps: I triedVIEW_LIMIT=0,GROUP_SYNC0 and 1,FIRST_HALF=0,WAVE_LOCAL/WAVE_OWN_BITS/WAVE_DEEP_SKIPS=0,HOST_WAVE=32, a loop limit,F16_NEAREST=1andFIRSTLANE_OWN=1.I also tried asking for record counts through a raw view, dividing the bytes by the stride as the code already does for raw views. That keeps one kind of view per slot, but it made two more tree programs crash, so it is not in this PR. Until these two are understood they can be skipped with the switch below; they only drive tree animation for the ray-tracing structures and the particles attached to trees.
Diagnostics (second commit)
victory_loader::note_on_crash. A note runs on the faulting thread and never blocks.victory-gpuadds the pipeline library call running on that thread, with its shaders, andtranslate --pipelinesadds the program it was building. A fault inside a driver's compiler then names its shader.VICTORY_NO_HOST_PIPELINE=<shader hash>,...gives no host pipeline to a pipeline that contains one of these shaders. Its draws and dispatches are left out, the same as for a shader that does not translate.VICTORY_TRANSLATE_SKIP=<hash prefix>,...,VICTORY_TRANSLATE_SKIP_FILEandVICTORY_TRANSLATE_DONE_FILElet atranslate --pipelinesrun that a driver ended go on where it stopped, with the faulting container skipped. A whole pass over the pack takes about 7 to 12 minutes here.To reproduce on AMD (the test host does not ask the device for its wave width):
Validation
cargo test -p victory-shader: 215 passed, 3 ignored.cargo test --workspace --locked: 566 passed, 0 failed, 12 ignored (23 suites).cargo clippy --workspace --all-targets --locked, with and without--all-features: no findings in the changed lines. With-D warningsit stops on the four existingvictory-gpuwarnings that #982 fixes.victory translate --pipelinesover the whole pack on the RX 9070 XT (driver 32.0.32029.2010): clean with the two programs above skipped.@Lynkes on GitHub · 2026-11-25 15:16 UTC · original
Update: a game run on this branch reached the world and the prologue's first gameplay scene. This was on the RX 9070 XT, driver 32.0.32029.2010, with the two remaining programs skipped through
VICTORY_NO_HOST_PIPELINE.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.