Shaders: keep annotateHandle local to its block to avoid AMD compiler crash #317
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/317"
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 fxceless/victory-fork. Originally posted by mynzjerko on 2026-11-24T23:30:53Z.
Problem
On AMD RDNA 4 (tested on Radeon RX 9070, driver
32.0.32029.2010),CreateComputePipelineStatecrashes insideamdxc64.dll(0xC0000005access violation, as reported in #3) onCS_RaytracingResolvevariants whenVICTORY_SHADER_OPTincludesREUSE(4).Bisecting
VICTORY_SHADER_OPTisolated the crash specifically toREUSEdeduplicatingdx.op.annotateHandleacross basic blocks incrates/victory-shader/src/emit/bitcode/opt.rs.Fix
Classify
dx.op.annotateHandleasEffect::Lanesinbitcode::opt::effect:annotateHandleinstead of reusing one from a dominating block across control flow.LOADScan still merge redundant reads within a block) and dead-code removal (DEAD) are preserved.annotateHandleis a DXIL metadata annotation and emits no GPU instructions, so there is no runtime cost.Verification
an_annotated_handle_is_not_reused_across_blocksincrates/victory-shader/src/emit/bitcode/opt.rs.cargo test -p victory-shader,cargo clippy -p victory-shader --all-targets -- -D warnings, andcargo xtask policyall pass.32.0.32029.2010) with fullVICTORY_SHADER_OPTenabled:dxil.dll, and created D3D12 pipelines (both default and withVICTORY_VIEW_LIMIT=1000000, vs 5/5 crashing before).CS_RaytracingResolveset: 1,000 / 1,000 emitted, validated, and created D3D12 pipelines (EXIT=0, 0 crashes).AI-assisted (Antigravity / Gemini 4 Neon); verified locally on an AMD Radeon RX 9070 with my own copy of the title. Hashes and counts only; no game data.
Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T10:59:16Z.
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head
ed2c7fcintomainf85101bin a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warningsfails with exactly the errorsmainitself has on this machine (placed_filler_twins,depth_written, a sort; PR #841 fixes them); with--all-featuresit fails with the same number of errors asmain(4). This PR adds none and removes none.cargo test --workspace --locked: run 1: one failure, run 2: 556 passed, 0 failed, 11 ignored (mainalone: 555 passed, 11 ignored). The failure isindirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields, which fails onmainitself most runs here (PR #849 fixes its assertion; see issue #850). The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
Imported from fxceless/victory-fork. Originally posted by mynzjerko on 2026-11-25T17:05:23Z.
Thanks @MamaLeVrai for verifying this on RX 6950 XT against \85101b!
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.