Repository navigation
Recompiler: compile HLSL-path pixel shaders without DXC's GVN (AMD compiler crash) - #3733
RodrigoTorreao wants to merge 1 commit into
Conversation
DXC 1.9's GVN turns a retail title's 1.66 MB pixel shader (an HLSL-path fallback for a v_writelane spill) into 509 KB of DXIL that crashes AMD's shader compiler in CreatePipelineState (amdxc64.dll+0x790849, null read, RX 6750 XT, Adrenalin 32.0.21045), every time, on that one pipeline. With GVN off the same source gives 696 KB that builds; DXC 1.7 makes 689 KB, also fine; -O0 builds but doubles the DXIL. Turning off licm, sink, structurize-returns, lifetime-intrinsics or structurize-loop-exits-for-unroll instead does not help. ps_ profiles now get -opt-disable gvn. Their DXIL cache keys carry their own toolchain identity and translated pixel entries get a _nogvn name, so DXIL cached with GVN is not reused (the translated cache brought the crashing DXIL back without the new name). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review of In short: The PR compiles every Medium
Nit
Checked and fine
Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point. |
Fixes #3732.
DXC 1.9's GVN turns one retail pixel shader, a 1.66 MB HLSL fallback, into 509 KB of DXIL. AMD's shader compiler then crashes the process in
CreatePipelineState(amdxc64.dll+0x790849, RX 6750 XT, Adrenalin 32.0.21045). With GVN off, the same source gives 696 KB of DXIL that builds. The details and the bisection are in the issue.Pixel shaders reach DXC only on the HLSL fallback path, so the cost is a few larger fallbacks. Unlike #1398, which retries a refused compute PSO, nothing can be retried here: the driver crashes instead of returning an error.
What is in it
crates/xcl/src/gpu/recomp/dxc.rs:ps_*profiles get-opt-disable gvn(no_gvn,profile_args). Their DXIL cache keys use their own toolchain identity (profile_toolchain), so an entry made with GVN is not reused.crates/xcl/src/gpu/recomp/pso.rs: translated pixel entries get a_nogvnname, for the same reason. Without this, the old crashing DXIL came back fromtranslated/v2after the change.pixel_shaders_compile_without_gvn_under_their_own_keys(dxc.rs): the flags, the keys, and that DXC accepts the flag;translated_pixel_entries_have_the_no_gvn_name(pso.rs).Tested
cargo test --release -p xcl --lib -- gpu::recomp::dxc gpu::recomp::pso: 81 passed, 0 failed, 1 ignored, including the two new tests.cargo build --release --workspace, thencargo test --release --workspace --no-fail-fast -- --test-threads=4, onmain5ad98ad and on this branch:xcllib test process aborts partway (exit 0x80004005) on this GPU, which is Recompiler: since #3655, split-wave64 compute pipelines crash amdxc64.dll on an RX 9070 XT – a retail game exits 1.5 s after start, and the test suite aborts #3694 (Recompiler: eliminate redundant split-wave64 compute barriers and share exchange helpers #3655).mainhad 1300 tests ok and 278 failed; this branch had 1301 ok and 282 failed.fuzz_validate_and_gpu_3,dispatch_chain_native_wave64_builds_whole,gpu_compact_slots_use_the_dispatch_prologues_exec_mask,emitted_kernel_runs_on_the_gpu. None of them uses a pixel profile. I have not rerun them to check whether they fail every time.xcl shaders --graphics-records. Before the change, record 372 crashes the driver every time. After it, all 937 records build, including with the old DXIL cache in place.main817eb1f minus Recompiler: eliminate redundant split-wave64 compute barriers and share exchange helpers #3655 plus Recompiler: a pixel shader's carry ballot reads its quad lane by lane, not through quadOp #3455 (needed on this GPU, see below), with this change applied as a local diff, so these runs' blocks show uncommitted changes and are not pasted here:amdxc64.dll+0x38b335, a separate issue).Regression run
main:
PR:
On this GPU both runs stop about 2 s after start, before the title draws: the driver refuses split-wave64 compute PSOs (0x887a0005) and then removes the device (0x887a0020). That is #3694, from #3655, and this PR does not touch it. The title runs that do reach this PR's code are under Tested (main 817eb1f without #3655, plus #3455).
Not tested
mainon this GPU: it fails earlier because of Recompiler: eliminate redundant split-wave64 compute barriers and share exchange helpers #3655 (Recompiler: since #3655, split-wave64 compute pipelines crash amdxc64.dll on an RX 9070 XT – a retail game exits 1.5 s after start, and the test suite aborts #3694).AI use
🤖 Generated with Claude Code