Recompiler: direct DXIL v_cmp_class_f16 reads the mask half OP_SEL[1] picks (stacked on #1214) #1980

Open
github-bot wants to merge 2 commits from github-bot/gh-1980 into main AGit
Owner

@⁠regiumlepidi on GitHub · 2026-11-25 00:21 UTC · original
regiumlepidi:direct-dxil-pr1214 → main · +29 −2 · 3 files · 2 commits · open

Stacked on #1214. Part of #1269.

#1214 makes v_cmp_class_f16 read the class mask from the half that OP_SEL[1] picks for SRC1, in the
HLSL path (recomp/emit.rs). The direct RDNA2 -> DXIL translator (XCL_DIRECT_DXIL=1,
gpu/dxil/lower_valu.rs) still read the low half, so the PR's own GPU test fails there
((0,0) instead of (4294967295,0)). This adds the same rule to the direct path.

What is in it

  • first commit: #1214 by @⁠b3IKK, cherry-picked unchanged onto current main (its head predates gpu/dxil/)
  • second commit (the only new code, 3 lines): the vopc f16 class lowering takes the mask with half(self, 1, ub) and shifts that

If #1214 merges first, only the second commit remains; if the author prefers to take it into #1214, this can be closed.

Tested

  • RTX 5070 Ti 16 GB (Blackwell, wave32), driver 617.42, Ryzen 7 9800X3D, Windows 11 26300; Rust 1.100.0, debug
  • cargo test --workspace -- --test-threads=4, default path: 941 passed, 4 failed, 25 ignored (23 SKIPPED GPU tests); the new test passes
  • same with XCL_DIRECT_DXIL=1: 941 passed, 4 failed, 25 ignored (23 SKIPPED); the new test passes
  • the 4 fuzz_validate_and_gpu_* failures are the same on main on this machine (#1905, E_OUTOFMEMORY on this driver)
  • control: gpu_cmp_class_f16_honours_opsel1 with XCL_DIRECT_DXIL=1 on the first commit alone: FAILED (so the second commit is what fixes it)

Regression run
Run by @⁠Toons29 on a retail title, AMD Radeon RX 9070, release build, 60 s (#1980); blocks as posted there. Within the CONTRIBUTING.md limits: frames 100 % of main, no crash, no device removal.

main:

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1623 (PresentX 1623)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14648 MB

PR:

xcl-smoke v1
commit: 8b5aea71c9e39d89b515c782b15a59e5031c69bf
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1630 (PresentX 1630)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14813 MB

Not tested

  • wave64 (this GPU runs wave32 only)
  • release build, real titles

AI use

  • Claude Code, model Claude Opus 5.5 (Anthropic). The agent wrote the fix, ran the tests above and opened this PR from the regiumlepidi account at the account owner's request.

🤖 Generated with Claude Code

**@⁠regiumlepidi** on GitHub · 2026-11-25 00:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1980) `regiumlepidi:direct-dxil-pr1214` → `main` · +29 −2 · 3 files · 2 commits · open Stacked on #1214. Part of #1269. #1214 makes `v_cmp_class_f16` read the class mask from the half that OP_SEL[1] picks for SRC1, in the HLSL path (`recomp/emit.rs`). The direct RDNA2 -> DXIL translator (`XCL_DIRECT_DXIL=1`, `gpu/dxil/lower_valu.rs`) still read the low half, so the PR's own GPU test fails there (`(0,0)` instead of `(4294967295,0)`). This adds the same rule to the direct path. **What is in it** - first commit: #1214 by @⁠b3IKK, cherry-picked unchanged onto current `main` (its head predates `gpu/dxil/`) - second commit (the only new code, 3 lines): the vopc f16 class lowering takes the mask with `half(self, 1, ub)` and shifts that If #1214 merges first, only the second commit remains; if the author prefers to take it into #1214, this can be closed. **Tested** - RTX 5070 Ti 16 GB (Blackwell, wave32), driver 617.42, Ryzen 7 9800X3D, Windows 11 26300; Rust 1.100.0, debug - `cargo test --workspace -- --test-threads=4`, default path: 941 passed, 4 failed, 25 ignored (23 SKIPPED GPU tests); the new test passes - same with `XCL_DIRECT_DXIL=1`: 941 passed, 4 failed, 25 ignored (23 SKIPPED); the new test passes - the 4 `fuzz_validate_and_gpu_*` failures are the same on `main` on this machine (#1905, E_OUTOFMEMORY on this driver) - control: `gpu_cmp_class_f16_honours_opsel1` with `XCL_DIRECT_DXIL=1` on the first commit alone: FAILED (so the second commit is what fixes it) **Regression run** Run by @⁠Toons29 on a retail title, AMD Radeon RX 9070, release build, 60 s (https://git.gtahub.st/github/xcl-dev--xcl/pulls/1980); blocks as posted there. Within the CONTRIBUTING.md limits: frames 100 % of `main`, no crash, no device removal. main: ``` xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1623 (PresentX 1623) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14648 MB ``` PR: ``` xcl-smoke v1 commit: 8b5aea71c9e39d89b515c782b15a59e5031c69bf gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1630 (PresentX 1630) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14813 MB ``` **Not tested** - wave64 (this GPU runs wave32 only) - release build, real titles **AI use** - Claude Code, model Claude Opus 5.5 (Anthropic). The agent wrote the fix, ran the tests above and opened this PR from the `regiumlepidi` account at the account owner's request. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
In V_CMP_CLASS_F16 (rdna2_spec.rs), SRC1 is a 16-bit operand so
OP_SEL[1] == 1 selects its upper 16-bit half as the class mask.
The emitter applied half(0, &ua) to SRC0 but passed ub unchanged,
ignoring OP_SEL[1].

Select SRC1 via half(1, &ub), with a GPU test covering OP_SEL[1]=0/1
and OP_SEL=3 across wave32 and split wave64.

Assisted-by: OpenCode (Gemini 4 Neon)
The direct DXIL translator (XCL_DIRECT_DXIL=1) shifted the whole 32-bit
SRC1 by the class index in v_cmp_class_f16, so OP_SEL[1] never selected
the mask's high half, as the HLSL path did before #1214. Take the half
OP_SEL[1] picks, as #1214 does in the HLSL path.

#1214's GPU test failed with XCL_DIRECT_DXIL=1 on an RTX 5070 Ti and
passes with this change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:39 +00:00
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-25 00:47 UTC · original

AMD run with native 64-lane waves, which this PR lists as not tested (the author's GPU runs wave32 only).

Tested: pass, head 8b5aea7 applied on main 6567c5f, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.
cargo test -p xcl --lib -- gpu:: --test-threads=4:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, waves 32..64: 465 passed, 2 failed, 21 ignored. gpu_cmp_class_f16_honours_opsel1 ok. The 2 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and _3, which fail the same way on main 6567c5f without this PR on this card.
  • NVIDIA RTX 3060, driver 32.0.16.1088: 467 passed, 0 failed, 21 ignored. Same test ok.

Not tested: release build; the whole workspace suite; a title.

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

**@⁠DarkPanda69** on GitHub · 2026-11-25 00:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1980#issuecomment-7148877582) AMD run with native 64-lane waves, which this PR lists as not tested (the author's GPU runs wave32 only). **Tested:** pass, head `8b5aea7` applied on `main` `6567c5f`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17. `cargo test -p xcl --lib -- gpu:: --test-threads=4`: - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, waves 32..64: 465 passed, 2 failed, 21 ignored. `gpu_cmp_class_f16_honours_opsel1` ok. The 2 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` and `_3`, which fail the same way on `main` `6567c5f` without this PR on this card. - NVIDIA RTX 3060, driver 32.0.16.1088: 467 passed, 0 failed, 21 ignored. Same test ok. **Not tested:** release build; the whole workspace suite; a title. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:19 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 03:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/1980#issuecomment-7151812028) 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!
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 03:54 UTC · original

Arc A770 verification for XCL PR #1980
#1980

2026-11-25 | STOR-WINLAB | 8b5aea71c9
The PR was open at this head before and after the run. The assigned checkout was clean and detached at the same SHA. Read AGENTS.md and CONTRIBUTING.md, which match the previous checkout. The PR lists an RTX 5070 Ti author run and has two existing reports covering AMD and NVIDIA. Its conversation, inline comments, reviews, and a repository search for the exact fixture with A770 showed no Arc duplicate. The overlapping PR #1214 is the stated HLSL prerequisite.

Tested

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). Both runs logged dxcompiler and DXIL 1.9.2609.5. The test profile was unoptimized with debug info disabled.

Prebuilt outside the Arc mutex with cargo test --locked -p xcl --lib --no-run (exit 0, 40.06 s). CARGO_TARGET_DIR=L:/XclTooling/pr2014-1c971de6/target, CARGO_BUILD_JOBS=2, CARGO_INCREMENTAL=0, CARGO_PROFILE_DEV_DEBUG=0, CARGO_PROFILE_TEST_DEBUG=0. XCL_ADAPTER=A770 and XCL_DXC_DIR=$env:LOCALAPPDATA/XclTooling/dxc-1.9.2609/bin/x64. TEMP and TMP used build-temp, test-0-temp, or test-1-temp under L:/XclTooling/pr1980.

Each invocation below ran in its own powershell.exe -NoProfile -ExecutionPolicy RemoteSigned process, with the indicated XCL_DIRECT_DXIL setting and separate stdout and stderr logs from process start.

$env:XCL_DIRECT_DXIL='0'
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    & 'L:/XclTooling/pr2014-1c971de6/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' 'gpu::recomp::tests::gpu_cmp_class_f16_honours_opsel1' --exact --nocapture --test-threads=1
}

$env:XCL_DIRECT_DXIL='1'
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    & 'L:/XclTooling/pr2014-1c971de6/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' 'gpu::recomp::tests::gpu_cmp_class_f16_honours_opsel1' --exact --nocapture --test-threads=1
}

HLSL + DXC (0) and direct DXIL (1) each exited 0 with 1 passed, 0 failed, 0 ignored, 0 measured, 969 filtered out, and 0.19 s elapsed. Total 2 passed, 0 failed, 0 ignored, 0 skips. Neither stream contained a skip notice. The fixture selects direct DXIL without fallback for setting 1.

Both processes exercised native wave32. The earlier #2089 capability probe on this host and driver measured a wave lane range of 8–32. At this revision the fixture's gpu_waves() helper adds wave64 only when hardware supports it natively.

The synthetic program used v0=0x00003C00 (low FP16 +1.0), v1=0x01000000 (high positive-normal class mask 0x0100, low mask 0), and v2=0x3C000000 (high FP16 +1.0, low +0.0). Each backend asserted (SGPR low, high) masks of (0xFFFFFFFF, 0) for OP_SEL=2 (low SRC0, high SRC1), (0, 0) for OP_SEL=0 (both low), and (0xFFFFFFFF, 0) for OP_SEL=3 (both high).

Build and test stdout/stderr logs are in L:/XclTooling/pr1980. Both wrappers logged lock release. The final Arc mutex release was at 04:53:08 CET and the target slot L:/XclTooling/pr2014-1c971de6/target is released for reuse.

Not tested

Other fixtures or FP16 classes, native or split wave64, other adapters, release builds, the workspace suite, fuzz tests, ancestor controls, and real-title smoke tests.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the fixture in both backends, inspected its assertions and the logs, and wrote this report.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 03:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1980#issuecomment-7152347229) Arc A770 verification for XCL PR #1980 https://git.gtahub.st/github/xcl-dev--xcl/pulls/1980 2026-11-25 | STOR-WINLAB | 8b5aea71c9e39d89b515c782b15a59e5031c69bf The PR was open at this head before and after the run. The assigned checkout was clean and detached at the same SHA. Read AGENTS.md and CONTRIBUTING.md, which match the previous checkout. The PR lists an RTX 5070 Ti author run and has two existing reports covering AMD and NVIDIA. Its conversation, inline comments, reviews, and a repository search for the exact fixture with A770 showed no Arc duplicate. The overlapping PR #1214 is the stated HLSL prerequisite. Tested 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). Both runs logged dxcompiler and DXIL 1.9.2609.5. The test profile was unoptimized with debug info disabled. Prebuilt outside the Arc mutex with cargo test --locked -p xcl --lib --no-run (exit 0, 40.06 s). CARGO_TARGET_DIR=L:/XclTooling/pr2014-1c971de6/target, CARGO_BUILD_JOBS=2, CARGO_INCREMENTAL=0, CARGO_PROFILE_DEV_DEBUG=0, CARGO_PROFILE_TEST_DEBUG=0. XCL_ADAPTER=A770 and XCL_DXC_DIR=$env:LOCALAPPDATA/XclTooling/dxc-1.9.2609/bin/x64. TEMP and TMP used build-temp, test-0-temp, or test-1-temp under L:/XclTooling/pr1980. Each invocation below ran in its own powershell.exe -NoProfile -ExecutionPolicy RemoteSigned process, with the indicated XCL_DIRECT_DXIL setting and separate stdout and stderr logs from process start. $env:XCL_DIRECT_DXIL='0' & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { & 'L:/XclTooling/pr2014-1c971de6/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' 'gpu::recomp::tests::gpu_cmp_class_f16_honours_opsel1' --exact --nocapture --test-threads=1 } $env:XCL_DIRECT_DXIL='1' & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { & 'L:/XclTooling/pr2014-1c971de6/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' 'gpu::recomp::tests::gpu_cmp_class_f16_honours_opsel1' --exact --nocapture --test-threads=1 } HLSL + DXC (0) and direct DXIL (1) each exited 0 with 1 passed, 0 failed, 0 ignored, 0 measured, 969 filtered out, and 0.19 s elapsed. Total 2 passed, 0 failed, 0 ignored, 0 skips. Neither stream contained a skip notice. The fixture selects direct DXIL without fallback for setting 1. Both processes exercised native wave32. The earlier #2089 capability probe on this host and driver measured a wave lane range of 8–32. At this revision the fixture's gpu_waves() helper adds wave64 only when hardware supports it natively. The synthetic program used v0=0x00003C00 (low FP16 +1.0), v1=0x01000000 (high positive-normal class mask 0x0100, low mask 0), and v2=0x3C000000 (high FP16 +1.0, low +0.0). Each backend asserted (SGPR low, high) masks of (0xFFFFFFFF, 0) for OP_SEL=2 (low SRC0, high SRC1), (0, 0) for OP_SEL=0 (both low), and (0xFFFFFFFF, 0) for OP_SEL=3 (both high). Build and test stdout/stderr logs are in L:/XclTooling/pr1980. Both wrappers logged lock release. The final Arc mutex release was at 04:53:08 CET and the target slot L:/XclTooling/pr2014-1c971de6/target is released for reuse. Not tested Other fixtures or FP16 classes, native or split wave64, other adapters, release builds, the workspace suite, fuzz tests, ancestor controls, and real-title smoke tests. AI use T3 Code / Codex (gpt-6.2-sol) ran the fixture in both backends, inspected its assertions and the logs, and wrote this report.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 04:38 UTC · original

Regression run of 8b5aea71 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on cbc296ab, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1623 (PresentX 1623)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14648 MB
xcl-smoke v1
commit: 8b5aea71c9e39d89b515c782b15a59e5031c69bf
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1630 (PresentX 1630)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14813 MB

Against the limits in CONTRIBUTING.md: 100 % of main's frames, 101 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.

**@⁠Toons29** on GitHub · 2026-11-25 04:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/1980#issuecomment-7153032151) Regression run of `8b5aea71` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `cbc296ab`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1623 (PresentX 1623) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14648 MB ``` ``` xcl-smoke v1 commit: 8b5aea71c9e39d89b515c782b15a59e5031c69bf gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1630 (PresentX 1630) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14813 MB ``` Against the limits in CONTRIBUTING.md: 100 % of `main`'s frames, 101 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; a script posted this right after the run, with both blocks exactly as printed.
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/1980/head:github-bot/gh-1980'
git switch 'github-bot/gh-1980'

Merge

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