Fix RDNA 4 amdxc64.dll shader compiler crash and 30s GPU watchdog stalls #7

Open
github-bot wants to merge 3 commits from github-bot/gh-7 into main AGit
Owner

@⁠manoel0810 on GitHub · 2026-11-25 16:58 UTC · original
manoel0810:fix/crash-investigation → main · +240 −16 · 4 files · 3 commits · open

Summary

Fixes two distinct crash classes encountered on AMD RDNA 4 (tested on Windows 11 / AMD Radeon RX 9060 XT, Series X target, both standard and --rt modes):

  • Symptom: CreateComputePipelineState crashed inside amdxc64.dll (8.18.10.0514, +0x861b9f, mov rdi, [rcx+8] with rcx = 0) on background pipeline workers (victory-pipelines-*), reproducibly triggered by CS_RaytracingResolve shader a1266cc7391ae0d6.
  • Root cause: In crates/victory-shader/src/emit/bitcode/opt.rs, dx.op.createHandleFromHeap and dx.op.annotateHandle were classified as Effect::Pure. This allowed the dominator-tree CSE pass (REUSE) to share annotateHandle(createHandleFromHeap(...)) values across basic blocks / control-flow boundaries, triggering the null dereference in AMD's RDNA 4 DXIL compiler.
  • Fix: Classify createHandleFromHeap and annotateHandle as Effect::Lanes in effect(), preventing cross-block CSE while preserving intra-block deduplication (LOADS) and dead-code elimination (DEAD).
  • Comparison with #2: Unlike #2 (which catches the exception with a VEH, parks/leaks the faulting worker thread, and blacklists the shader in crashed.txt so it never runs), this fixes the emitted DXIL pattern at the root so a1266cc7391ae0d6 and similar shaders validate, compile cleanly, and execute normally with zero driver exceptions.
  • Regression test: emit::bitcode::opt::tests::heap_handles_are_not_reused_across_blocks.

2. Prevent 30 s title GPU watchdog crashes on heavy --rt / world-load frames (27d8c36, 3ac8713)

  • Symptom: The title's 30 s GPU watchdog (victory-image-...dll+0x23cf683 / +0x2215c35, intentional write to 0x0) terminated runs during cold world-load / --rt frames.
  • Root causes:
    1. pipeline::make::wait() granted two independent 12 s budgets per frame (graphics + compute = up to 24 s) keyed by frame::current() rather than actual wall-clock time since the last completed Present, leaving insufficient headroom for preparation, copies, and GPU work.
    2. pipeline::builder_runs() called synchronous make::now() on the title's recording thread and launched all 52 BVH structure-builder dispatches even on a first world frame that had already spent >10 s allocating and refreshing shadow buffers.
  • Fixes:
    1. Track LAST_PRESENT_MS in crates/victory-gpu/src/queue.rs (since_last_present()) and cap combined pipeline waits in crates/victory-gpu/src/pipeline/make.rs at WATCHDOG_WAIT_CEILING = 10s since the last completed Present (explicit VICTORY_PIPELINE_WAIT_MS overrides are still respected).
    2. Add non-blocking make::poll() and update pipeline::builder_runs() to queue missing builder pipelines asynchronously and apply a strict all-or-none per-frame deferral (Builder::frame_decision) when a frame has already exceeded WATCHDOG_WAIT_CEILING since the last Present.
  • Regression tests: pipeline::make::loading_tests::watchdog_cap_stops_pipeline_waits_past_present_ceiling and pipeline::make::tests::poll_queues_without_blocking_and_reports_completion.

Verification

  • Isolated shader reproducer (a1266cc7391ae0d6.container): victory translate --validate --pipelines changed from 0xc0000005 to 1 validated, 1 pipelines (exit=0).
  • cargo test --locked -p victory-shader: 234 passed, 0 failed.
  • cargo test --locked -p victory-gpu pipeline::make: 9 passed, 0 failed.
  • Live gameplay verification on RX 9060 XT (both standard and --rt modes): passed all early pipelines (1,203 loaded/made), survived the first heavy world-load frame in --rt mode, and eliminated both amdxc64.dll+0x861b9f and the 30 s GPU watchdog crashes.
**@⁠manoel0810** on GitHub · 2026-11-25 16:58 UTC · [original](https://github.com/DexNom/VIctory/pull/7) `manoel0810:fix/crash-investigation` → `main` · +240 −16 · 4 files · 3 commits · open ## Summary Fixes two distinct crash classes encountered on AMD RDNA 4 (tested on Windows 11 / AMD Radeon RX 9060 XT, Series X target, both standard and `--rt` modes): ### 1. Root-cause fix for `amdxc64.dll+0x861b9f` (`0xc0000005`, read `0x8`) — related to #2 (`c238ae5`) - **Symptom:** `CreateComputePipelineState` crashed inside `amdxc64.dll` (`8.18.10.0514`, `+0x861b9f`, `mov rdi, [rcx+8]` with `rcx = 0`) on background pipeline workers (`victory-pipelines-*`), reproducibly triggered by `CS_RaytracingResolve` shader `a1266cc7391ae0d6`. - **Root cause:** In `crates/victory-shader/src/emit/bitcode/opt.rs`, `dx.op.createHandleFromHeap` and `dx.op.annotateHandle` were classified as `Effect::Pure`. This allowed the dominator-tree CSE pass (`REUSE`) to share `annotateHandle(createHandleFromHeap(...))` values across basic blocks / control-flow boundaries, triggering the null dereference in AMD's RDNA 4 DXIL compiler. - **Fix:** Classify `createHandleFromHeap` and `annotateHandle` as `Effect::Lanes` in `effect()`, preventing cross-block CSE while preserving intra-block deduplication (`LOADS`) and dead-code elimination (`DEAD`). - **Comparison with #2:** Unlike #2 (which catches the exception with a VEH, parks/leaks the faulting worker thread, and blacklists the shader in `crashed.txt` so it never runs), this fixes the emitted DXIL pattern at the root so `a1266cc7391ae0d6` and similar shaders validate, compile cleanly, and execute normally with zero driver exceptions. - **Regression test:** `emit::bitcode::opt::tests::heap_handles_are_not_reused_across_blocks`. ### 2. Prevent 30 s title GPU watchdog crashes on heavy `--rt` / world-load frames (`27d8c36`, `3ac8713`) - **Symptom:** The title's 30 s GPU watchdog (`victory-image-...dll+0x23cf683` / `+0x2215c35`, intentional write to `0x0`) terminated runs during cold world-load / `--rt` frames. - **Root causes:** 1. `pipeline::make::wait()` granted two independent 12 s budgets per frame (`graphics` + `compute` = up to 24 s) keyed by `frame::current()` rather than actual wall-clock time since the last completed `Present`, leaving insufficient headroom for preparation, copies, and GPU work. 2. `pipeline::builder_runs()` called synchronous `make::now()` on the title's recording thread and launched all 52 BVH structure-builder dispatches even on a first world frame that had already spent >10 s allocating and refreshing shadow buffers. - **Fixes:** 1. Track `LAST_PRESENT_MS` in `crates/victory-gpu/src/queue.rs` (`since_last_present()`) and cap combined pipeline waits in `crates/victory-gpu/src/pipeline/make.rs` at `WATCHDOG_WAIT_CEILING = 10s` since the last completed `Present` (explicit `VICTORY_PIPELINE_WAIT_MS` overrides are still respected). 2. Add non-blocking `make::poll()` and update `pipeline::builder_runs()` to queue missing builder pipelines asynchronously and apply a strict all-or-none per-frame deferral (`Builder::frame_decision`) when a frame has already exceeded `WATCHDOG_WAIT_CEILING` since the last `Present`. - **Regression tests:** `pipeline::make::loading_tests::watchdog_cap_stops_pipeline_waits_past_present_ceiling` and `pipeline::make::tests::poll_queues_without_blocking_and_reports_completion`. ## Verification - Isolated shader reproducer (`a1266cc7391ae0d6.container`): `victory translate --validate --pipelines` changed from `0xc0000005` to `1 validated, 1 pipelines` (`exit=0`). - `cargo test --locked -p victory-shader`: **234 passed, 0 failed**. - `cargo test --locked -p victory-gpu pipeline::make`: **9 passed, 0 failed**. - Live gameplay verification on RX 9060 XT (both standard and `--rt` modes): passed all early pipelines (`1,203` loaded/made), survived the first heavy world-load frame in `--rt` mode, and eliminated both `amdxc64.dll+0x861b9f` and the 30 s GPU watchdog crashes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:31:35 +00:00
Author
Owner

@⁠h0useadv on GitHub · 2026-11-25 16:59 UTC · original

An independent report from an RX 9070 XT (RDNA4, driver 32.0.32029.2010, Windows 11), on main 921d8d3 without this PR. It's the same crash, a second shader that triggers it, and a switch that already avoids it.

Crash. 0xc0000005 at amdxc64.dll+0x861b9f (read 0x8) on victory-pipelines-7, about 70 s after the world's first frame. To find the shader, I ran each compute program translated in the last second before the crash alone through VICTORY_TRANSLATE_ONLY=<hash> victory translate --pipelines --list --jobs 1 shaders.rpf, one process each:

shader result
501f0865fdf45dfd (ped_standard_lod_muv_cutout:CS_RaytracingResolve_b1139868_Wrapped) 0xC0000005, same offset (Windows' crash record)
7 other CS_RaytracingResolve programs (b2ff2ef0…, 2bf91065…, 476446ed…, 2582aab1…, e5742545…, 4c573a76…, 2cc6decf…) pipeline created

translate --validate passes 501f0865fdf45dfd with the SDK's dxil.dll (10.0.26100), so the input is valid DXIL and the crash is in AMD's compiler. This is a different hash from your a1266cc7391ae0d6, from the same family. If it helps, I can run the same one-shader check with this branch.

Switch that already avoids it. With VICTORY_RT_RESOLVE=0 (pipeline/make.rs, without_structures), none of the ~1,000 CS_RaytracingResolve programs get built while the structure builder is off. With it, the same save got past the 70 s point and ran about 2 minutes of the world without a compiler crash. Since these programs have nothing to shade without the builder, and each costs AMD's compiler 5–9 s (the code comment's figure), setting it in victory-play when --rt isn't given could be a cheap safety net on RDNA4 next to this fix.

World frame time on RX 9070 XT, Ryzen 7 7800X3D (default renderer, VICTORY_GPU_TIMING=1, frame lines after the first heavy frames):

per frame
total ~340 ms (~3 fps)
on the GPU 165–178 ms
preparing (copies ~230 MB, textures) 77–105 ms
copying back (~65 MB) 48–53 ms
draws ~5,000–5,300

In the copy-back, shader-written ranges compared only ~31 MB per frame (0.9 ms finding the 246 differing pieces, 2.4 ms putting them back). One range, 0x22360000+0xae00000, was compared 2×/frame, ~365 MB/frame, with ~1 MB of it written back.

What ended that run (separate from this PR): about 3 min after the world's first frame, the GPU page-faulted at 0x23a3000 ("no title memory copy below it"), a list stopped at command 409 of 2856 (op 5), indirect kind 2 max 1 … [compute fc5e66f8f873d3bb], device removed 0x887A0005. ztrx hit the same pattern on this card with another program (indirect kind 2, compute 0452fc2d2e2fc4c3, Zettrox/ztrx#81), so it's probably shared code from upstream.

AI-assisted (Claude Code). I ran everything on my own machine with my own copy. Only hashes and the runtime's log lines here, no game data or captures.

**@⁠h0useadv** on GitHub · 2026-11-25 16:59 UTC · [original](https://github.com/DexNom/VIctory/pull/7#issuecomment-7168833840) An independent report from an **RX 9070 XT** (RDNA4, driver 32.0.32029.2010, Windows 11), on `main` `921d8d3` without this PR. It's the same crash, a second shader that triggers it, and a switch that already avoids it. **Crash.** `0xc0000005` at `amdxc64.dll+0x861b9f` (read `0x8`) on `victory-pipelines-7`, about 70 s after the world's first frame. To find the shader, I ran each compute program translated in the last second before the crash alone through `VICTORY_TRANSLATE_ONLY=<hash> victory translate --pipelines --list --jobs 1 shaders.rpf`, one process each: | shader | result | |---|---| | `501f0865fdf45dfd` (`ped_standard_lod_muv_cutout:CS_RaytracingResolve_b1139868_Wrapped`) | **`0xC0000005`**, same offset (Windows' crash record) | | 7 other `CS_RaytracingResolve` programs (`b2ff2ef0…`, `2bf91065…`, `476446ed…`, `2582aab1…`, `e5742545…`, `4c573a76…`, `2cc6decf…`) | pipeline created | `translate --validate` passes `501f0865fdf45dfd` with the SDK's `dxil.dll` (10.0.26100), so the input is valid DXIL and the crash is in AMD's compiler. This is a different hash from your `a1266cc7391ae0d6`, from the same family. If it helps, I can run the same one-shader check with this branch. **Switch that already avoids it.** With `VICTORY_RT_RESOLVE=0` (`pipeline/make.rs`, `without_structures`), none of the ~1,000 `CS_RaytracingResolve` programs get built while the structure builder is off. With it, the same save got past the 70 s point and ran about 2 minutes of the world without a compiler crash. Since these programs have nothing to shade without the builder, and each costs AMD's compiler 5–9 s (the code comment's figure), setting it in `victory-play` when `--rt` isn't given could be a cheap safety net on RDNA4 next to this fix. **World frame time on RX 9070 XT, Ryzen 7 7800X3D** (default renderer, `VICTORY_GPU_TIMING=1`, frame lines after the first heavy frames): | per frame | | |---|---| | total | **~340 ms (~3 fps)** | | on the GPU | 165–178 ms | | preparing (copies ~230 MB, textures) | 77–105 ms | | copying back (~65 MB) | 48–53 ms | | draws | ~5,000–5,300 | In the copy-back, shader-written ranges compared only ~31 MB per frame (0.9 ms finding the 246 differing pieces, 2.4 ms putting them back). One range, `0x22360000+0xae00000`, was compared 2×/frame, **~365 MB/frame, with ~1 MB of it written back**. **What ended that run** (separate from this PR): about 3 min after the world's first frame, the GPU page-faulted at `0x23a3000` ("no title memory copy below it"), `a list stopped at command 409 of 2856 (op 5)`, `indirect kind 2 max 1 … [compute fc5e66f8f873d3bb]`, device removed `0x887A0005`. ztrx hit the same pattern on this card with another program (`indirect kind 2`, `compute 0452fc2d2e2fc4c3`, Zettrox/ztrx#81), so it's probably shared code from upstream. AI-assisted (Claude Code). I ran everything on my own machine with my own copy. Only hashes and the runtime's log lines here, no game data or captures.
Author
Owner

@⁠Artking175 on GitHub · 2026-11-25 18:35 UTC · original

Independent Windows 10 / RTX 2060 data point for the PSO-wait part of this PR. GU runs Windows 10 22H2 (19045), NVIDIA 531.41, Rust 1.98.1 MSVC. On an earlier game run at 921d8d3, the default wait coincided with 12–25 s frames during world entry.

I found a separate loading-allowance accounting issue on main (2e01ab4), in pipeline::make. The current charge is calculated per waiter. With a 500 ms base, three sequential waits of 400 + 400 + 200 ms consume 500 ms of loading allowance for the frame, but each individual wait charges zero. Two simultaneous 800 ms waits can charge 600 ms even though the shared window spent only 300 ms beyond the base.

My local follow-up charges the excess from cumulative per-frame waiting. In the default shared-window mode, overlapping waits count once. That accounting is separate from the cap since last Present in this PR.

  • cargo test --locked -p victory-gpu --lib pipeline::make -- --test-threads=1 on main plus the local change yielded 10 passed, including two new regressions for those cases.
  • cargo test --locked -p victory-gpu --lib -- --test-threads=1 yielded 187 passed on clean main and 189 with the change. Both runs had the same depth_bounds_pipeline_loads_and_filters_draws failure (0x80070057 creating the root signature) and three ignored tests.

I have not run this PR's head or measured a gameplay FPS change from the accounting patch.

**@⁠Artking175** on GitHub · 2026-11-25 18:35 UTC · [original](https://github.com/DexNom/VIctory/pull/7#issuecomment-7171115239) Independent Windows 10 / RTX 2060 data point for the PSO-wait part of this PR. GU runs Windows 10 22H2 (19045), NVIDIA 531.41, Rust 1.98.1 MSVC. On an earlier game run at `921d8d3`, the default wait coincided with 12–25 s frames during world entry. I found a separate loading-allowance accounting issue on `main` (`2e01ab4`), in `pipeline::make`. The current charge is calculated per waiter. With a 500 ms base, three sequential waits of 400 + 400 + 200 ms consume 500 ms of loading allowance for the frame, but each individual wait charges zero. Two simultaneous 800 ms waits can charge 600 ms even though the shared window spent only 300 ms beyond the base. My local follow-up charges the excess from cumulative per-frame waiting. In the default shared-window mode, overlapping waits count once. That accounting is separate from the cap since last `Present` in this PR. - `cargo test --locked -p victory-gpu --lib pipeline::make -- --test-threads=1` on `main` plus the local change yielded 10 passed, including two new regressions for those cases. - `cargo test --locked -p victory-gpu --lib -- --test-threads=1` yielded 187 passed on clean `main` and 189 with the change. Both runs had the same `depth_bounds_pipeline_loads_and_filters_draws` failure (`0x80070057` creating the root signature) and three ignored tests. I have not run this PR's head or measured a gameplay FPS change from the accounting patch.
Author
Owner

@⁠molodayamama on GitHub · 2026-11-25 18:53 UTC · original

Cross-vendor regression check on NVIDIA GeForce RTX 4060 8 GB (wave32) / AMD Ryzen 5 5600 / Windows 10 22H2 (19045.5794) / Rust 1.98.1 (x86_64-pc-windows-msvc):

  • Clean merge with current main (2e01ab4)
  • cargo test --locked -p xtask: 4 passed, 0 failed (191 files ok)
  • cargo clippy --workspace --all-targets --locked -- -D warnings (default & --all-features): 0 warnings
  • Hardware D3D12 tests on RTX 4060 (merged onto main + Agility SDK 1.614.1 via #12 for Windows 10 SM 6.6; no game files):
    • emit::bitcode::opt::tests::heap_handles_are_not_reused_across_blocks: passed
    • emit::wave64_tests: 7 passed, 0 failed
    • emit::intersect_tests::the_64_bit_node_test_over_title_memory_matches_the_reference_on_the_card: passed (0.87s)
    • cargo test --locked -p victory-gpu --lib: 190 passed, 0 failed (including both new pipeline::make watchdog-cap and poll regression tests)

No regressions observed on NVIDIA wave32 or BVH traversal from the Effect::Lanes CSE change.

**@⁠molodayamama** on GitHub · 2026-11-25 18:53 UTC · [original](https://github.com/DexNom/VIctory/pull/7#issuecomment-7171553387) Cross-vendor regression check on **NVIDIA GeForce RTX 4060 8 GB (wave32)** / AMD Ryzen 5 5600 / Windows 10 22H2 (`19045.5794`) / Rust `1.98.1` (`x86_64-pc-windows-msvc`): - Clean merge with current `main` (`2e01ab4`) - `cargo test --locked -p xtask`: **4 passed, 0 failed** (`191 files ok`) - `cargo clippy --workspace --all-targets --locked -- -D warnings` (default & `--all-features`): **0 warnings** - Hardware D3D12 tests on RTX 4060 (merged onto `main` + Agility SDK `1.614.1` via #12 for Windows 10 SM 6.6; no game files): - `emit::bitcode::opt::tests::heap_handles_are_not_reused_across_blocks`: **passed** - `emit::wave64_tests`: **7 passed, 0 failed** - `emit::intersect_tests::the_64_bit_node_test_over_title_memory_matches_the_reference_on_the_card`: **passed** (`0.87s`) - `cargo test --locked -p victory-gpu --lib`: **190 passed, 0 failed** (including both new `pipeline::make` watchdog-cap and `poll` regression tests) No regressions observed on NVIDIA wave32 or BVH traversal from the `Effect::Lanes` CSE change.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/7/head:github-bot/gh-7'
git switch 'github-bot/gh-7'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-7'
git switch 'github-bot/gh-7'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-7'
git switch 'github-bot/gh-7'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-7'
git switch 'main'
git merge --squash 'github-bot/gh-7'
git switch 'main'
git merge --ff-only 'github-bot/gh-7'
git switch 'main'
git merge 'github-bot/gh-7'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.