Skip to content

gpu/dxil: one-op-per-kernel probes to localize AMD GPU-run aborts - #1807

Closed
SlopTart wants to merge 2 commits into
xcl-dev:mainfrom
SlopTart:amd-dxil-op-probes
Closed

SlopTart wants to merge 2 commits into
xcl-dev:mainfrom
SlopTart:amd-dxil-op-probes

Conversation

@SlopTart

@SlopTart SlopTart commented Nov 24, 2026 •

Copy link
Copy Markdown

What this adds

A one-op-per-kernel probe section at the end of crates/xcl/src/gpu/dxil/ops_tests.rs: the same ops as integer_ops_match_cpu and uaddc_and_usubb_match_cpu, but each kernel contains exactly one dx.op helper (plus its address arithmetic). If a GPU run dies, the test name names the op.

Why

On an AMD wave64 card (RX 7900 XT, Mesa, Proton/wine, patched vkd3d-proton) the two big kernels above abort the GPU run silently (wine exit status: 3, no Rust panic, no DXIL validation error; see my comments on #1426). This PR pinpoints the cause: 13 probes, and exactly three abort, every run:

  • probe_uaddc_match_cpu
  • probe_usubb_match_cpu
  • probe_udiv_rem_match_cpu

The other ten (bfrev, the four bit_count variants, min/max, mad, bfe/bfi, both wide multiplies) pass on the same driver stack, so the fault is specific to add-with-carry, sub-with-borrow, and unsigned div/rem lowering, not to wide or bit ops generally. The second input vector has no zeros, so the div/rem probes are unambiguous.

Tested

  • RX 7900 XT (RADV NAVI31), Mesa 26.2.5, Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, DXC 1.9.2609.5, release profile, target x86_64-pc-windows-gnu, this branch off main at 4178e888. Each probe run solo (--exact --test-threads=1): 10 ok, 3 abort with exit status: 3 (uaddc, usubb, udiv_rem). Also cargo check --target x86_64-pc-windows-gnu --tests clean.

Not tested

  • native Windows (no machine), NVIDIA hardware (unknown whether these three abort there too; if CI runs them, passing there localizes the fault to the AMD path, aborting there means it reproduces without AMD hardware), the non-test build of the tree is untouched (diff is test-only).

AI use

  • Hermes agent (local Qwen-class) drafted the probes and ran them; I checked the diff and the run logs before opening.

(Lint reformat only: same content, markers now on their own lines.)

Split the integer and carry/borrow kernels into single dx.op probes so a
GPU-side failure names the exact op. On an AMD wave64 card (RX 7900 XT,
Mesa, vkd3d-proton) 10 probes pass; uaddc, usubb, and udiv_rem abort the
GPU run with a driver-side fault and no validation error. See the xcl-dev#1426
thread for the full counts.
@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 479c5ac (on its base 4178e88).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 902 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: probe_bfrev_match_cpu, probe_countbits_match_cpu, probe_firstbitlo_match_cpu, probe_firstbithi_match_cpu, probe_firstbitshi_match_cpu, probe_imax_umin_match_cpu, probe_imad_umad_match_cpu, probe_bfe_bfi_match_cpu, probe_umul_wide_match_cpu, probe_imul_wide_match_cpu, probe_udiv_rem_match_cpu, probe_uaddc_match_cpu, probe_usubb_match_cpu.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 904 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skipped because Developer Mode was off. Developer Mode was turned on before the AMD run, and there pso_measurement_compiles_an_exact_synthetic_record ran and passed.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@DarkPanda69

DarkPanda69 commented Nov 24, 2026 •

Copy link
Copy Markdown

Update for head 918ed92: same result. Applied on main cbc296a, cargo test -p xcl --lib -- gpu:: --test-threads=4: RX 9070 XT 597 passed, 2 failed (the two fuzz_validate_and_gpu seeds, which fail the same way on main on this card, so not from the probes); RTX 3060 599 passed, 0 failed. All 13 probes ok on both, no abort.


Native Windows run on an AMD GPU and on NVIDIA, which this PR lists as not tested: none of the probes aborts on either.

Tested: pass, head 479c5ac applied on main c4d37be, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.
cargo test -p xcl --lib -- gpu::dxil::ops_tests --test-threads=4:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010: 33 passed, 0 failed, 0 SKIPPED. All 13 probe_*_match_cpu tests ok, no abort.
  • NVIDIA RTX 3060, driver 32.0.16.1088: 33 passed, 0 failed, 0 SKIPPED. All 13 probes ok.
  • Without this PR, the same filter is 20 passed on both, so the 13 probes are the new tests.

So on native Windows (AMD's own D3D12 driver), these ops match the CPU on RDNA4. Whatever aborts on your machine does not reproduce here, which points at the Wine / vkd3d-proton / RADV path rather than the DXIL these probes emit.

Not tested: RDNA2/RDNA3; Linux / Wine; the whole workspace suite.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@Flyander

Flyander commented Nov 24, 2026 •

Copy link
Copy Markdown

Independent native Windows / NVIDIA run on the PR head 479c5ac595c708f12d8b8f7e59e2c72acac098bd:

  • RTX 5070 Ti (driver 621.40), Ryzen 7 5800X3D, Windows 11 Pro 26300, Rust 1.100.0, DXC/DXIL 1.9.2602.17.
  • cargo test --locked -p xcl --lib probe_ -- --nocapture --test-threads=1: all 13 new one-op GPU probes passed, including probe_uaddc_match_cpu, probe_usubb_match_cpu, and probe_udiv_rem_match_cpu. Overall: 14 passed, 0 failed, 1 unrelated ignored; no GPU skips were reported.

This supports the failure being specific to the AMD/RADV/vkd3d-proton stack, but this Windows run cannot distinguish the AMD driver from the Linux translation layer.

The latest PR-description check also fails: the Tested / Not tested / AI use content is on the same line as each heading, and the check rejects the disclosed Qwen-class model for code. Please keep the disclosure accurate and coordinate with maintainers on the policy block rather than removing it.

@pablogonz12

Copy link
Copy Markdown
Contributor

Tested — RDNA4 / RADV / Wine: your three aborts reproduce, and main already dies before the probes run

  • Radeon RX 9070 XT (RDNA4, GFX1201, wave64), Mesa 26.3.1-arch3.5 (RADV), Linux 7.3.6 (CachyOS), Ryzen 9 9900X
  • Wine 11.0 (GE-Proton 11-14) with vkd3d-proton 3.1.0 as native d3d12/d3d12core/dxgi, DXC 1.9.2609.5, rustc 1.100.0, release, target x86_64-pc-windows-msvc, RUSTFLAGS="-C target-feature=+crt-static"
  • 479c5ac cherry-picked onto main 1d027e5 (clean), cargo xwin test -p xcl --lib --release --no-run
  • Each probe alone in its own process, --exact --test-threads=1, run three times:
    • pass (10): bfrev, countbits, firstbitlo, firstbithi, firstbitshi, imax_umin, imad_umad, bfe_bfi, umul_wide, imul_wide
    • abort, exit status 3, every run, nothing written after Found device: AMD Radeon RX 9070 XT (RADV GFX1201), no Rust panic, no DXIL validation error: probe_udiv_rem_match_cpu, probe_uaddc_match_cpu, probe_usubb_match_cpu

Same three ops as your RX 7900 XT run, on the next chip and a newer Mesa, so it is not RDNA3- or driver-version-specific.

The abort is not specific to the one-op shape. integer_ops_match_cpu and uaddc_and_usubb_match_cpu also die with exit status 3 on the same stack, solo, so the split kernels are enough to hit it.

main is already affected on this stack, before this PR. Full lib suite, --test-threads=4 --skip jumps_to_outer_loop_heads_are_structured:

  • 1d027e5 alone: 104 tests passed, then exit status 3; the run ends there and the remaining results are lost.
  • 1d027e5 + 479c5ac: the same, 104 passed, then exit status 3.
  • Solo, one thread, gpu::dxil::ops_tests on 1d027e5 alone: last test started is integer_ops_match_cpu, exit status 3.
  • c160d86 this morning (before the direct-DXIL merge): the same test passed and the full run finished, 702 passed / 5 failed / 21 ignored.

So the abort arrived on main between c160d86 and 1d027e5 and is not caused by this PR; it is the same class of failure as #1246 (a driver-side abort that takes the whole lib binary with it).

Suggestion. The probes only pay off when the binary survives them: runner::skip_test("...") under Wine for uaddc, usubb and udiv_rem (the way the runner already skips when there is no GPU), or gating the section on an env var, would keep the other ~940 results of the run in the log. As filed, on RADV/Wine the suite stops at integer_ops_match_cpu and no probe result is ever printed in a full run.

Not tested

  • NVIDIA and native Windows, WSL; whether the same three ops abort there.
  • dmesg needs root here, so I have no amdgpu reset line for the abort.
  • No bisect between c160d86 and 1d027e5.

AI use — the comment was written by DeepSeek V4.1 Flash (opencode) from my own run logs; I ran every command above and checked the logs it quotes.

# Conflicts:
#	crates/xcl/src/gpu/dxil/ops_tests.rs
@SlopTart

Copy link
Copy Markdown
Author

Synthesis across the reports on this thread (mine + the four above): the abort is now localized to the Linux/Wine graphics stack, not to the DXIL, not to xcl, and not to AMD hardware.

stack GPU uaddc/usubb/udiv_rem probes
native Windows RTX 5070 Ti pass (2 independent reports)
native Windows RTX 3060 pass
native Windows RX 9070 XT (RDNA4) pass, all 13
Wine + vkd3d-proton + Mesa RADV RX 7900 XT (RDNA3, this PR) abort exit status: 3
Wine + vkd3d-proton + Mesa RADV RX 9070 XT (RDNA4, pablogonz12) abort, same three

Two independent reproductions on the same software stack, two different AMD generations; clean on both vendors' native Windows drivers. So the fault is in the translation chain that only that stack uses: vkd3d-proton's DXIL->SPIR-V lowering for these three ops, or Mesa/RADV's handling of the SPIR-V it emits.

One concrete hypothesis for where to look: dx.op.uaddc/uusubb map naturally to SPIR-V OpIAddCarry/OpISubBorrow and udiv_rem to div/rem idioms; if vkd3d-proton emits those and RADV lowers or validates them badly (or wine's Vulkan layer trips on them), that fits "aborts with no validation error, no panic". Worth noting #1244's root cause was exactly this class of problem too (Mesa NIR optimizing an atomic poll pattern out of existence), so Mesa-side handling of unusual atomics/int ops has now bitten this project twice on Linux.

Suggested next step I can run on my rig: dump the SPIR-V (RADV_DEBUG=spirv) for probe_uaddc_match_cpu and diff it against the passing probe_umul_wide_match_cpu kernel, to see what the validator actually received before the abort. If someone from vkd3d-proton wants the repro: the probe tests are exactly 10 lines each now, --exact --test-threads=1, deterministic every run.

Update on the PR itself: branch merged with current main (cbc296ab) to stay mergeable; probes re-run on the merged tree: the three aborts reproduce identically (exit status: 3), controls (bfrev, umul_wide) still ok. Same stack and counts as before.

AI use: Hermes agent (local Qwen-class) ran the suites and drafted this; I checked it before posting.

@SlopTart

Copy link
Copy Markdown
Author

Bisected: all three aborts are fixed by newer dxil-spirv, no Mesa involvement

Re-ran the identical probe binaries (head 918ed928, RX 7900 XT, Mesa 26.2.5, Proton Experimental wine-11.0) with only the d3d12.dll/d3d12core.dll swapped, cold vkd3d pipeline cache each run:

vkd3d-proton build dxil-spirv pin probe_uaddc probe_usubb probe_udiv_rem probe_bfrev probe_umul_wide
v3.1 (xcl-patched) 8b48f0e0 abort (exit 3) abort abort ok ok
master ec207194 34f0ff84^ ok ok abort (exit 3) ok -
master ec207194 7c048638 ok ok ok ok ok

That pins the root cause to two dxil-spirv fixes between the two pins:

The Exception 0xc0000005 at /usr/lib/libvulkan_radeon.so + 0x15b5bd under vkCreateComputePipelines that I described in my earlier comment is therefore RADV choking on invalid SPIR-V emitted by the older converter for uaddc/usubb/udiv_rem, not a Mesa bug (my earlier wording implied the translation stack as a whole; this narrows it to the dxil-spirv pin).

Takeaway for xcl: bumping the vendored vkd3d-proton/dxil-spirv past these two commits clears the entire ops_tests abort family on this rig. The probes in this PR stay useful as regression coverage for exactly those opcodes, so the suite would keep catching a pin regression.

AI use: Hermes agent (local Qwen-class) ran the A/B builds, bisect and this measurement; I checked it before posting.

@SlopTart

Copy link
Copy Markdown
Author

Closing this PR under CONTRIBUTING.md's AI-assisted contribution rules: the probe code here was drafted by a local small open-weight model (Qwen class), and PRs disclosing such tools are closed without review, rightly so for this codebase. Rather than leave a red PR, here is the suite in adoptable form:

  • Patch: https://gist.github.com/SlopTart/076def72f60ec478d4d54666aea08653 (git apply, +157/-0, tests only, verified to apply clean on live main cbc296ab)
  • What it adds: 13 single-intrinsic DXIL probes in ops_tests (one op per kernel, CPU-vs-GPU match, 32 threads each), written in the file's own idiom.
  • What it is proven to do on a real rig (RX 7900 XT, Mesa 26.2.5, Proton Experimental wine-11.0): it catches the uaddc/usubb/udiv_rem abort family under the vkd3d-proton 3.1 pin (dxil-spirv 8b48f0e0), and all 13 pass on any dxil-spirv pin after 79b870bb + 34f0ff84 (full A/B table in my bisect comment above).

Anyone is free to take the patch as-is, adapt it, and land it as their own PR; it would guard the pin from silently regressing these three opcodes again. Happy to re-run it on this rig after the vkd3d-proton/dxil-spirv pin bump, or any other GPU validation you want measured.

AI use: Hermes agent (local Qwen-class) wrote the probes and drafted this comment; a human reviewed it before posting.

@SlopTart SlopTart closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants