Skip to content

Direct DXIL per-lane: ignore reserved OP_SEL[3:2] on V_PERMLANE(X)16_B32 - #2095

Open
certified-retart wants to merge 1 commit into
xcl-dev:mainfrom
certified-retart:dxil/permlane-ignore-reserved-opsel
Open

certified-retart wants to merge 1 commit into
xcl-dev:mainfrom
certified-retart:dxil/permlane-ignore-reserved-opsel

Conversation

@certified-retart

Copy link
Copy Markdown
Contributor

What is in it

Part of #1269 (per-lane direct DXIL compute coverage).

On RDNA2, 32-bit V_PERMLANE16_B32 and V_PERMLANEX16_B32 only define OP_SEL[0] (FI) and OP_SEL[1] (BOUND_CTRL); OP_SEL[3:2] are reserved and ignored by hardware. Both the HLSL backend (emit.rs) and the per-instruction direct DXIL backend (dxil/lower_valu.rs) already ignore OP_SEL[3:2] and only read bits 0 and 1.

crates/xcl/src/gpu/recomp/lower/wave.rs rejected op_sel & !3 != 0 with VOP3 modifiers, which caused the per-lane direct DXIL lowerer to refuse valid retail compute programs that set a reserved OP_SEL[3:2] bit (e.g. OP_SEL=0x9 with ABS=NEG=CLAMP=OMOD=0). This change removes the op_sel & !3 != 0 check while keeping real VOP3 modifiers (ABS, NEG, CLAMP, OMOD) refused.

  • crates/xcl/src/gpu/recomp/lower/wave.rs: stop rejecting reserved OP_SEL[3:2] bits on V_PERMLANE16_B32 / V_PERMLANEX16_B32.
  • crates/xcl/src/gpu/recomp/lower_dxil.rs: add permlane_ignores_reserved_opsel_bits, verifying wave32/wave64 per-lane lowering and DXIL validation with OP_SEL=0x9 and OP_SEL=0xE, verifying ABS/NEG/CLAMP/OMOD remain refused, and checking real-GPU wave32 execution and parity with per-instruction direct DXIL.

Tested

  • Machine: Windows 11, AMD Ryzen 7 9800X3D, NVIDIA GeForce RTX 5070 12 GB (32-lane waves), Agility SDK v614, DXC + dxil.dll 1.9.2602.17.
  • cargo test -p xcl --lib permlane_ignores_reserved_opsel_bits -- --nocapture: 1 passed, 0 failed, 0 skipped; validated wave32 and wave64 DXIL and ran wave32 on the RTX 5070 with exact per-lane output and parity against per-instruction direct DXIL.
  • cargo test --workspace -- --test-threads=4 (debug): 1,155 passed, 0 failed, 46 ignored across 21 test suites.
  • XCL_RECOMP_NO_HLSL=1 XCL_RECOMP_STAGES=CS survey over a retail shader pack (2,689 compute programs, origin/main cbc296a vs 1b4f9a7):

Regression run

Matched 60 s scripts/smoke.ps1 runs on the same machine, title, and release build (XCL_D3D12_DIR set to Agility SDK v614):

Baseline (origin/main):

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 5070
title: 6ca5cab7
seconds: 60
exit: 0x0
frames shown: 1682 (PresentX 1682)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15030 MB

This PR:

xcl-smoke v1
commit: 1b4f9a737ed1736697f9f746c5b0cf6c956734de
gpu: NVIDIA GeForce RTX 5070
title: 6ca5cab7
seconds: 60
exit: 0x0
frames shown: 1684 (PresentX 1684)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15122 MB

Not tested

  • Native wave64 GPU execution (RTX 5070 exposes 32-lane waves only; wave64 per-lane lowering and DXIL validation were tested on CPU).
  • AMD or Intel GPUs, Linux/vkd3d-proton, or retail world loading past menus.

AI use

Antigravity (gemini-4-neon) diagnosed the per-lane refusal, implemented the fix and test, ran the tests and smoke run, and drafted this PR description.

On RDNA2, 32-bit V_PERMLANE16_B32 and V_PERMLANEX16_B32 only define OP_SEL[0] (FI) and OP_SEL[1] (BOUND_CTRL); OP_SEL[3:2] are reserved and ignored by hardware. Both the HLSL backend (emit.rs) and per-instruction Direct DXIL (dxil/lower_valu.rs) already mask only bits 0 and 1. Remove the spurious op_sel & !3 != 0 rejection from the per-lane lowerer while keeping ABS/NEG/CLAMP/OMOD refused.
@JJAutoCompare

Copy link
Copy Markdown

Tested

  • PR #2095 at 1b4f9a7. The PR was open at this SHA and the local checkout was clean and detached before and after the run.
  • STOR-WINLAB, Windows 11 Enterprise Evaluation 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 (x86_64-pc-windows-msvc). The fixture loaded dxcompiler and dxil 1.9.2609.5.
  • Prebuilt outside the Arc mutex with cargo test --locked -p xcl --lib --no-run (unoptimized test profile, debug info disabled), exit 0. Used two build jobs, incremental compilation disabled, and the assigned target directory below.
  • Ran the test executable with the arguments below from the repository root in a fresh PowerShell process with -NoProfile -ExecutionPolicy RemoteSigned. Set XCL_ADAPTER=A770 and pointed XCL_DXC_DIR to %LOCALAPPDATA%\XclTooling\dxc-1.9.2609\bin\x64. The mutex callback used System.Diagnostics.Process to capture the child’s two output streams and exit status. The child and mutex wrapper both exited 0. Libtest reported 1 passed, 0 failed, 0 ignored, 1124 filtered out in 0.23 s. Separate stdout and stderr showed 0 explicit GPU skips.
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    & 'L:/XclTooling/pr2014-1c971de6/target/debug/build/xcl/97fdf2b9ff8e1482/out/xcl-97fdf2b9ff8e1482.exe' gpu::recomp::lower_dxil::tests::permlane_ignores_reserved_opsel_bits --exact --nocapture --test-threads=1
}
  • Offline, both wave32 and wave64 per-lane DXIL lowered without survey refusals and passed DXIL validation with OP_SEL=0x9 on V_PERMLANEX16_B32 and OP_SEL=0xE on V_PERMLANE16_B32. The four wave32 negative cases on V_PERMLANEX16_B32 still refused ABS, NEG, CLAMP, and OMOD individually.
  • On the A770, two native wave32 dispatches ran the per-lane and per-instruction direct DXIL. The per-lane dispatch produced the expected cross-row permutation and within-row identity at all 32 lanes. All 64 output dwords matched between the two backends.

Not tested

  • GPU execution of wave64 shaders, HLSL backend parity, other adapters, the full workspace suite, retail shader surveys, or retail smoke runs.

AI use

  • T3 Code / Codex (gpt-6.2-sol) ran the exact fixture, checked the logs and source assertions, and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@thehollowedone

Copy link
Copy Markdown

Independent Windows run on 1b4f9a7. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug.

cargo build --offline --locked --workspace passed. cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --nocapture reported 1,155 passed, 0 failed, 46 ignored, with 25 runtime skip notices included in Cargo's pass count.

I extended the stock test to dispatch both permlane instructions on native wave32 for all 16 OP_SEL patterns. That exercises all four reserved patterns for every combination of the defined FI and BOUND_CTRL bits with full EXEC. All 1,024 output words matched the CPU reference and the per-instruction Direct DXIL path. Restoring the old rejection gate refused both instructions in the stock case.

cargo test --offline --locked -p xcl --lib permlane_ignores_reserved_opsel_bits -- --nocapture --test-threads=1 passed 1/0/0 with zero skips, using XCL_ADAPTER=3080 Ti and XCL_REQUIRE_GPU=wave32. Native wave64 and retail were outside this check. AI-assisted. Codex (GPT-6, exact variant unavailable) extended the fixture, ran the tests, and drafted this report.

@Chrysana

Copy link
Copy Markdown

AMD RDNA4 run of 1b4f9a7, for the native wave64 case under Not tested. The change lowers and runs correctly in 64-lane hardware waves, the PR's test passes on this card, and the title shows no regression.

Setup: AMD Radeon RX 9070 XT 16 GB (RDNA4, native wave64), driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 26200.9974, rustc 1.100.0 MSVC, DXC 1.9.2602.17. This PR's head as pushed (its base is main cbc296a).

Tested

  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 (debug): 1153 passed, 2 failed, 46 ignored. The two failures are fuzz_validate_and_gpu_1 (seed 722) and fuzz_validate_and_gpu_3 (seed 1599), the AMD seeds of DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115; main 06c9f55 fails the same two on this card.
  • SKIPPED: f16_programs_on_the_gpu (4) and f32_programs_on_the_gpu (2) (the per-lane form refuses V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32, gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (no Developer Mode).
  • permlane_ignores_reserved_opsel_bits passes. Its GPU part runs wave32, also on this card.
  • Native wave64 execution (a local test, not pushed): the PR's program with 64 threads through compute_with with wave64: true, once with split: false (WaveSize(64), native) and once with split: true, OP_SEL=0x9 on V_PERMLANEX16_B32 and 0xE on V_PERMLANE16_B32. In both forms all 64 lanes give the RDNA2 result (100 + (lane ^ 16) and 100 + lane, so X16 swaps rows 0↔1 and 2↔3), and match the per-instruction direct DXIL. I can post the test if you want it in the PR.

Regression run
scripts/smoke.ps1 -Seconds 60, retail title, XCL_PRESS_A_AT=20,25,30, two rounds alternating main cbc296a (this PR's base) and this head. Frames: main 935 and 1021, PR 994 and 984; peak commit main 16055 / 15279 MB, PR 17914 / 15285 MB. 0 device removals and 0 crashes in all four. Round 1:

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: AMD Radeon RX 9070 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 935 (PresentX 935)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16055 MB
xcl-smoke v1
commit: 1b4f9a737ed1736697f9f746c5b0cf6c956734de
gpu: AMD Radeon RX 9070 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 994 (PresentX 994)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17914 MB

With XCL_DIRECT_DXIL=1 XCL_PER_LANE=1 (one run each, otherwise the same): main 995 frames, PR 962, no device removal or crash. Both logged the same 15 per-lane fallback lines, none of them on a permlane.

Not tested

  • The retail programs with reserved OP_SEL bits that this PR is for: the title doesn't reach them in the first 60 s here, with or without the per-lane switches.
  • This head merged onto current main.

AI use

  • Claude Code (Claude Opus 5.5) built the trees, wrote the local wave64 test, ran the runs and drafted this comment. I checked it before posting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants