dxil: emit MSAA textureLoad before getDimensions to avoid amdxc64 crash #1900

Manually merged
github merged 1 commit from gh-pr/1900/head into gh-pr/1900/base 2026-11-26 05:08:48 +00:00
Owner

@⁠raylitebull on GitHub · 2026-11-24 22:48 UTC · original
raylitebull:fix/amd-msaa-and-driver-crashes → main · +56 −2 · 2 files · 1 commits · merged 2026-11-24 23:08 UTC

Fixes the amdxc64.dll null-pointer dereference (0xc0000005 at +0x85f80f on amdxc64.dll 32.0.32015.2008) during CreateComputePipelineState on dynamically indexed descriptor-heap Texture2DMS / Texture2DMSArray shaders introduced in #1679 (gpu_direct_msaa_image_loads).

Follow-up to #1679.

What is in it

  • Root cause: AMD's DXIL compiler dereferences null during CreateComputePipelineState when dx.op.getDimensions precedes dx.op.textureLoad on a dynamically indexed descriptor-heap Texture2DMS / Texture2DMSArray inside the same basic block (reproduced even on DXC 1.8 HLSL, with nonUniformIndex=false, WaveSize(32), or separate createHandleFromHeap/annotateHandle calls; does not crash when textureLoad precedes getDimensions in the same block, when they are in different blocks, or when the heap index is constant).
  • crates/xcl/src/gpu/dxil/lower_image.rs (mimg_msaa): emit all texture_load_sample calls before get_dimensions(tex.handle, None) inside each guarded format branch (+6/-2, zero extra blocks or branches).
  • crates/xcl/src/gpu/dxil/msaa_tests.rs: add CPU DXIL disassembly regression test direct_msaa_loads_precede_get_dimensions verifying dx.op.textureLoad precedes dx.op.getDimensions in every generated MSAA load basic block.

Tested

  • Hardware & toolchain: AMD Radeon RX 9070 XT (16191 MiB VRAM, RDNA4, native wave64, driver amdxc64.dll 32.0.32015.2008), Windows 11 x64 (10.0.22631.0), rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased onto 689f2db.
  • cargo test -p xcl --lib gpu::dxil::msaa_tests -- --ignored --include-ignored (live RX 9070 XT GPU + CPU): 5 passed, 0 failed (0.15 s), including gpu_direct_msaa_image_loads (previously 0xc0000005), msaa_texture_ops_run, and direct_msaa_loads_precede_get_dimensions.
  • cargo check --workspace --tests: passed.

Regression run
main:

xcl-smoke v1
commit: 689f2db477c3c062cf162649781640ef8a977c18
gpu: AMD Radeon RX 9070 XT
title: 29e814f5
seconds: 60
exit: 0x0
frames shown: 1597 (PresentX 1597)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20713 MB

PR:

xcl-smoke v1
commit: 425b86920b43d26a670cc0090787fc946976bce3
gpu: AMD Radeon RX 9070 XT
title: 29e814f5
seconds: 60
exit: 0x0
frames shown: 1609 (PresentX 1609)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20315 MB

Not tested

  • scripts/smoke.ps1 with XCL_DIRECT_DXIL=1 enabled, full cargo test --workspace run on 425b869, NVIDIA and Intel GPUs, wave32-only adapters, and Linux/Wine/vkd3d-proton.

AI use

  • Antigravity (Claude Opus 4.6) assisted with GPU bisection, root-cause diagnosis, implementation, and test verification; the author reviewed the diff and results.
**@⁠raylitebull** on GitHub · 2026-11-24 22:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/1900) `raylitebull:fix/amd-msaa-and-driver-crashes` → `main` · +56 −2 · 2 files · 1 commits · merged 2026-11-24 23:08 UTC Fixes the `amdxc64.dll` null-pointer dereference (`0xc0000005` at `+0x85f80f` on `amdxc64.dll 32.0.32015.2008`) during `CreateComputePipelineState` on dynamically indexed descriptor-heap `Texture2DMS` / `Texture2DMSArray` shaders introduced in #1679 (`gpu_direct_msaa_image_loads`). Follow-up to #1679. **What is in it** - Root cause: AMD's DXIL compiler dereferences null during `CreateComputePipelineState` when `dx.op.getDimensions` precedes `dx.op.textureLoad` on a dynamically indexed descriptor-heap `Texture2DMS` / `Texture2DMSArray` inside the same basic block (reproduced even on DXC 1.8 HLSL, with `nonUniformIndex=false`, `WaveSize(32)`, or separate `createHandleFromHeap`/`annotateHandle` calls; does not crash when `textureLoad` precedes `getDimensions` in the same block, when they are in different blocks, or when the heap index is constant). - `crates/xcl/src/gpu/dxil/lower_image.rs` (`mimg_msaa`): emit all `texture_load_sample` calls before `get_dimensions(tex.handle, None)` inside each guarded format branch (`+6/-2`, zero extra blocks or branches). - `crates/xcl/src/gpu/dxil/msaa_tests.rs`: add CPU DXIL disassembly regression test `direct_msaa_loads_precede_get_dimensions` verifying `dx.op.textureLoad` precedes `dx.op.getDimensions` in every generated MSAA load basic block. **Tested** - Hardware & toolchain: AMD Radeon RX 9070 XT (16191 MiB VRAM, RDNA4, native wave64, driver `amdxc64.dll 32.0.32015.2008`), Windows 11 x64 (`10.0.22631.0`), `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, rebased onto `689f2db`. - `cargo test -p xcl --lib gpu::dxil::msaa_tests -- --ignored --include-ignored` (live RX 9070 XT GPU + CPU): 5 passed, 0 failed (`0.15 s`), including `gpu_direct_msaa_image_loads` (previously `0xc0000005`), `msaa_texture_ops_run`, and `direct_msaa_loads_precede_get_dimensions`. - `cargo check --workspace --tests`: passed. **Regression run** main: ``` xcl-smoke v1 commit: 689f2db477c3c062cf162649781640ef8a977c18 gpu: AMD Radeon RX 9070 XT title: 29e814f5 seconds: 60 exit: 0x0 frames shown: 1597 (PresentX 1597) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 20713 MB ``` PR: ``` xcl-smoke v1 commit: 425b86920b43d26a670cc0090787fc946976bce3 gpu: AMD Radeon RX 9070 XT title: 29e814f5 seconds: 60 exit: 0x0 frames shown: 1609 (PresentX 1609) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 20315 MB ``` **Not tested** - `scripts/smoke.ps1` with `XCL_DIRECT_DXIL=1` enabled, full `cargo test --workspace` run on `425b869`, NVIDIA and Intel GPUs, wave32-only adapters, and Linux/Wine/vkd3d-proton. **AI use** - Antigravity (Claude Opus 4.6) assisted with GPU bisection, root-cause diagnosis, implementation, and test verification; the author reviewed the diff and results.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:08:45 +00:00
github manually merged commit 425b86920b into gh-pr/1900/base 2026-11-26 05:08:48 +00:00
Author
Owner

@⁠eizispark on GitHub · 2026-11-24 22:56 UTC · original

Hardware test report — commit 425b869

Verified 425b86920b43d26a670cc0090787fc946976bce3 (rebased onto main 689f2db477c3c062cf162649781640ef8a977c18, clean merge): pass — confirms the #1679 0xc0000005 (amdxc64.dll) crash in gpu_direct_msaa_image_loads is resolved on RX 9070 XT.

Tested

  • Hardware: AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 x64, rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smoke
  • Unfiltered cargo test --workspace --no-fail-fast -- --test-threads=4 (no --skip needed): 974 passed, 2 failed, 45 ignored (8 skipped), running to completion without crashing xcl --lib:
    • All 5/5 gpu::dxil::msaa_tests passed on RX 9070 XT (gpu_direct_msaa_image_loads, msaa_texture_ops_run, render_target_sample_ops_validate, direct_msaa_store_is_rejected, direct_msaa_loads_precede_get_dimensions)
    • Only the 2 pre-existing main 689f2db fuzz tests failed (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3); 0 new failures
    • 8 skipped: 6 gpu::recomp::lower_dxil::tests f16/f32 direct-DXIL per-lane cases refused where #1426 semantics differ from the console's; shaders::tests::pso_measurement_compiles_an_exact_synthetic_record (Windows Developer Mode required, 0x887A002D); heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
  • Native RDNA4 wave64 GPU tests (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, console_wave64_compute_through_the_pso_hook_dispatch_and_read_back) passed

Regression run (scripts/smoke.ps1, 60 s, warm shader/driver cache)
main (689f2db477c3c062cf162649781640ef8a977c18):

xcl-smoke v1
commit: 689f2db477c3c062cf162649781640ef8a977c18
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1674 (PresentX 1674)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14862 MB

PR (425b86920b43d26a670cc0090787fc946976bce3):

xcl-smoke v1
commit: 425b86920b43d26a670cc0090787fc946976bce3
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14857 MB

Not tested

  • NVIDIA/Intel GPUs, Wine/vkd3d-proton, gameplay past the menus

AI use

  • Verified and formatted with Antigravity (Google DeepMind, Gemini 4 Carbon).
**@⁠eizispark** on GitHub · 2026-11-24 22:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/1900#issuecomment-7146829207) ### Hardware test report — commit `425b869` Verified `425b86920b43d26a670cc0090787fc946976bce3` (rebased onto `main` `689f2db477c3c062cf162649781640ef8a977c18`, clean merge): **pass** — confirms the `#1679` `0xc0000005` (`amdxc64.dll`) crash in `gpu_direct_msaa_image_loads` is resolved on RX 9070 XT. **Tested** - Hardware: AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver `32.0.32015.16001`), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 x64, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug tests + release smoke - Unfiltered `cargo test --workspace --no-fail-fast -- --test-threads=4` (no `--skip` needed): `974 passed, 2 failed, 45 ignored` (`8 skipped`), running to completion without crashing `xcl --lib`: - All `5/5` `gpu::dxil::msaa_tests` passed on RX 9070 XT (`gpu_direct_msaa_image_loads`, `msaa_texture_ops_run`, `render_target_sample_ops_validate`, `direct_msaa_store_is_rejected`, `direct_msaa_loads_precede_get_dimensions`) - Only the 2 pre-existing `main` `689f2db` fuzz tests failed (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`, `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3`); `0` new failures - `8 skipped`: 6 `gpu::recomp::lower_dxil::tests` f16/f32 direct-DXIL per-lane cases refused where `#1426` semantics differ from the console's; `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` (`Windows Developer Mode required`, `0x887A002D`); `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` - Native RDNA4 wave64 GPU tests (`gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `console_wave64_compute_through_the_pso_hook_dispatch_and_read_back`) passed **Regression run** (`scripts/smoke.ps1`, 60 s, warm shader/driver cache) `main` (`689f2db477c3c062cf162649781640ef8a977c18`): ``` xcl-smoke v1 commit: 689f2db477c3c062cf162649781640ef8a977c18 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1674 (PresentX 1674) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14862 MB ``` PR (`425b86920b43d26a670cc0090787fc946976bce3`): ``` xcl-smoke v1 commit: 425b86920b43d26a670cc0090787fc946976bce3 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1677 (PresentX 1677) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14857 MB ``` **Not tested** - NVIDIA/Intel GPUs, Wine/vkd3d-proton, gameplay past the menus **AI use** - Verified and formatted with Antigravity (Google DeepMind, Gemini 4 Carbon).
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 23:04 UTC · original

NVIDIA counterpart to the RX 9070 XT run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, 425b869 on main 689f2db. The reordering doesn't change the result on NVIDIA. Tests matching msaa, including direct_msaa_loads_precede_get_dimensions and gpu_direct_msaa_image_loads: 6 passed, 0 failed, with and without XCL_DIRECT_DXIL=1.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-24 23:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/1900#issuecomment-7146990548) NVIDIA counterpart to the RX 9070 XT run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, `425b869` on `main` `689f2db`. The reordering doesn't change the result on NVIDIA. Tests matching `msaa`, including `direct_msaa_loads_precede_get_dimensions` and `gpu_direct_msaa_image_loads`: 6 passed, 0 failed, with and without `XCL_DIRECT_DXIL=1`. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 02:07 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 02:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/1900#issuecomment-7150343070) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.