Recompiler: v_pack_b32_f16 applies the abs and neg half modifiers #1710

Open
b3IKK wants to merge 1 commit from upstream-pr/1720 into main
b3IKK commented 2026-11-24 19:52:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T19:52:10Z.


Addresses XCL-BT-038 from #1488.

v_pack_b32_f16 built the packed dword from OP_SEL's halves and ignored the VOP3 abs / neg source modifiers, which the rest of the 16-bit paths (hb in valu16, and the v_cvt_pknorm_*_f16 pair) apply to the picked half's sign bit. A console shader that packs -|x| or -v on one half therefore got the source's own value, and the instruction had no test at all.

This applies both modifiers to the selected half, exactly as the pknorm conversions do, in both translators: the HLSL path (Em::valu) and the direct DXIL one (dxil::lower_valu), which lowers the instruction on its own.

Since the review (@ddaikodaiko found the direct-DXIL gap, @nnonno91 measured it on AMD and NVIDIA): the first version fixed the HLSL path only, so with XCL_DIRECT_DXIL=1 the modifiers were still dropped (-|2.0| packed 0x38004000, not 0x3800C000). The same two sign-bit operations are now in lower_valu.rs, and the GPU test runs the program through both translators whatever XCL_DIRECT_DXIL says. The change in lower_valu.rs was written here from the description of the gap, not taken from the fork commit linked in the review.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: v_pack_b32_f16 applies abs (& 0x7FFF) and neg (^ 0x8000) to the half op_sel picks.
  • crates/xcl/src/gpu/dxil/lower_valu.rs: the same in the direct DXIL translator.
  • crates/xcl/src/gpu/dxil/kernel.rs: TRANSLATOR_VERSION 9 → 10 (the direct translator's output for these programs changes, and its sources are not in build.rs's hash). Other open direct-DXIL PRs bump the same line, so this will conflict with whichever merges first.
  • crates/xcl/src/gpu/recomp/tests.rs: pack_b32_f16_applies_the_half_modifiers (emitted HLSL; fails on main — the & 0x7FFF / ^ 0x8000 are absent) and GPU test gpu_pack_b32_f16_half_modifiers (pack, -|2.0|, op_sel high halves with |-4.0| and -(16.0), |-6.0|, through the default path and through the direct DXIL translator).

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 1156 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, no heap windows, and cannot disable the driver cache (Windows Developer Mode is required))
  • cargo test -p xcl --lib -- pack_b32_f16: 2 passed, 0 failed, with XCL_DIRECT_DXIL unset and with XCL_DIRECT_DXIL=1
  • the same with the lower_valu.rs change taken out: 1 passed, 1 failed — direct DXIL, lane 0: -|2.0| packs -2.0, left: 939540480, right: 939573248 (0x38004000 / 0x3800C000, the values in the review)

Regression run

main (568e7db, clean tree, no local changes):

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1640 (PresentX 1640)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15360 MB

PR (94ecdd5, clean tree, no local changes):

xcl-smoke v1
commit: 94ecdd55d5f2a761ff498c1787c2ce4d46512f74
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1640 (PresentX 1640)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15325 MB

Not tested

  • the full suite with XCL_DIRECT_DXIL=1 (only the two pack_b32_f16 tests ran with it)
  • AMD GPUs and native wave64 hardware on this head (@nnonno91's AMD / RTX 5090 runs were on the previous head plus the equivalent direct-DXIL change)
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Claude Fable 5.2: checked XCL-BT-038 against the code and the existing pknorm paths, wrote the fix in both translators and the tests (and confirmed each fails without it), rebased onto 689f2db, ran the test suite and scripts/smoke.ps1 regression runs, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5479250597 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T19:52:10Z. --- Addresses `XCL-BT-038` from #1488. `v_pack_b32_f16` built the packed dword from `OP_SEL`'s halves and ignored the VOP3 `abs` / `neg` source modifiers, which the rest of the 16-bit paths (`hb` in `valu16`, and the `v_cvt_pknorm_*_f16` pair) apply to the picked half's sign bit. A console shader that packs `-|x|` or `-v` on one half therefore got the source's own value, and the instruction had no test at all. This applies both modifiers to the selected half, exactly as the pknorm conversions do, in both translators: the HLSL path (`Em::valu`) and the direct DXIL one (`dxil::lower_valu`), which lowers the instruction on its own. **Since the review** (@ddaikodaiko found the direct-DXIL gap, @nnonno91 measured it on AMD and NVIDIA): the first version fixed the HLSL path only, so with `XCL_DIRECT_DXIL=1` the modifiers were still dropped (`-|2.0|` packed `0x38004000`, not `0x3800C000`). The same two sign-bit operations are now in `lower_valu.rs`, and the GPU test runs the program through both translators whatever `XCL_DIRECT_DXIL` says. The change in `lower_valu.rs` was written here from the description of the gap, not taken from the fork commit linked in the review. **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs`: `v_pack_b32_f16` applies `abs` (`& 0x7FFF`) and `neg` (`^ 0x8000`) to the half `op_sel` picks. - `crates/xcl/src/gpu/dxil/lower_valu.rs`: the same in the direct DXIL translator. - `crates/xcl/src/gpu/dxil/kernel.rs`: `TRANSLATOR_VERSION` 9 → 10 (the direct translator's output for these programs changes, and its sources are not in `build.rs`'s hash). Other open direct-DXIL PRs bump the same line, so this will conflict with whichever merges first. - `crates/xcl/src/gpu/recomp/tests.rs`: `pack_b32_f16_applies_the_half_modifiers` (emitted HLSL; fails on `main` — the `& 0x7FFF` / `^ 0x8000` are absent) and GPU test `gpu_pack_b32_f16_half_modifiers` (pack, `-|2.0|`, `op_sel` high halves with `|-4.0|` and `-(16.0)`, `|-6.0|`, through the default path and through the direct DXIL translator). **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2609.5, debug (`scripts/test.ps1`) and release (`scripts/smoke.ps1`) - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 1156 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, `no heap windows`, and `cannot disable the driver cache (Windows Developer Mode is required)`) - `cargo test -p xcl --lib -- pack_b32_f16`: 2 passed, 0 failed, with `XCL_DIRECT_DXIL` unset and with `XCL_DIRECT_DXIL=1` - the same with the `lower_valu.rs` change taken out: 1 passed, 1 failed — `direct DXIL, lane 0: -|2.0| packs -2.0`, `left: 939540480, right: 939573248` (`0x38004000` / `0x3800C000`, the values in the review) **Regression run** main (`568e7db`, clean tree, no local changes): ``` xcl-smoke v1 commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1640 (PresentX 1640) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15360 MB ``` PR (`94ecdd5`, clean tree, no local changes): ``` xcl-smoke v1 commit: 94ecdd55d5f2a761ff498c1787c2ce4d46512f74 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1640 (PresentX 1640) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15325 MB ``` **Not tested** - the full suite with `XCL_DIRECT_DXIL=1` (only the two `pack_b32_f16` tests ran with it) - AMD GPUs and native wave64 hardware on this head (@nnonno91's AMD / RTX 5090 runs were on the previous head plus the equivalent direct-DXIL change) - other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine **AI use** - OpenCode, Claude Fable 5.2: checked `XCL-BT-038` against the code and the existing pknorm paths, wrote the fix in both translators and the tests (and confirmed each fails without it), rebased onto `689f2db`, ran the test suite and `scripts/smoke.ps1` regression runs, and drafted this PR description.
ddaikodaiko commented 2026-11-24 21:09:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ddaikodaiko on 2026-11-24T19:58:38Z.


One gap for this fix: the direct DXIL translator has the same bug in a second place.

crates/xcl/src/gpu/dxil/lower_valu.rs, the "v_pack_b32_f16" arm, builds the halves from SRC0/SRC1 and OP_SEL but ignores Mods::abs/Mods::neg:

let lo = if m.opsel & 1 == 1 { self.lshrc(a, 16) } else { self.andc(a, 0xFFFF) };
let hi = if m.opsel & 2 == 2 { self.lshrc(b, 16) } else { self.andc(b, 0xFFFF) };

so with XCL_DIRECT_DXIL=1 (or =all) the modifiers are still dropped. The same two sign-bit operations on each selected half fix it there: abs → andc(h, 0x7FFF), neg → xor(h, 0x8000), with indices 0/1 of m.abs/m.neg for the low/high half.

I have that as a fork commit (ddaikodaiko/xcl contrib/valupack-abs-neg 319a384, on top of 6c89285) and the existing GPU test gpu_v_pack_b32_f16_honors_abs_neg should pin it with XCL_DIRECT_DXIL=1; I could not build or run it here, so it is unverified. The 0xC0003C00 / 0x4000BC00 pair from the description is what both paths should produce.

This also applies to #1207 if it is kept separately. AI use: written with OpenCode (DeepSeek V4.1 Flash); the person submitting any code from this is responsible for running it.

<!-- greyfinch-sync:ivall/xcl:comment:7142869022 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7142869022). Originally posted by [ddaikodaiko](https://github.com/ddaikodaiko) on 2026-11-24T19:58:38Z. --- One gap for this fix: the direct DXIL translator has the same bug in a second place. `crates/xcl/src/gpu/dxil/lower_valu.rs`, the `"v_pack_b32_f16"` arm, builds the halves from `SRC0`/`SRC1` and `OP_SEL` but ignores `Mods::abs`/`Mods::neg`: ```rust let lo = if m.opsel & 1 == 1 { self.lshrc(a, 16) } else { self.andc(a, 0xFFFF) }; let hi = if m.opsel & 2 == 2 { self.lshrc(b, 16) } else { self.andc(b, 0xFFFF) }; ``` so with `XCL_DIRECT_DXIL=1` (or `=all`) the modifiers are still dropped. The same two sign-bit operations on each selected half fix it there: `abs` → `andc(h, 0x7FFF)`, `neg` → `xor(h, 0x8000)`, with indices 0/1 of `m.abs`/`m.neg` for the low/high half. I have that as a fork commit (`ddaikodaiko/xcl` `contrib/valupack-abs-neg` `319a384`, on top of `6c89285`) and the existing GPU test `gpu_v_pack_b32_f16_honors_abs_neg` should pin it with `XCL_DIRECT_DXIL=1`; I could not build or run it here, so it is unverified. The `0xC0003C00` / `0x4000BC00` pair from the description is what both paths should produce. This also applies to #1207 if it is kept separately. AI use: written with OpenCode (DeepSeek V4.1 Flash); the person submitting any code from this is responsible for running it.
nnonno91 commented 2026-11-24 21:09:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-24T20:05:06Z.


Retest on 94ecdd55d5f2a761ff498c1787c2ce4d46512f74

@b3IKK The rebased head passed on my native-wave64 Radeon and RTX 5090. This resolves the direct-DXIL failure I reported below.

Tested

  • Clean detached head, Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11, unoptimized profile. AMD Radeon(TM) Graphics driver 32.0.21042.62 and RTX 5090 driver 32.0.16.1742.
  • Ran cargo test --locked -p xcl --lib pack_b32_f16 -- --nocapture --test-threads=1 with XCL_ADAPTER=AMD Radeon (XCL_REQUIRE_GPU=wave64) and XCL_ADAPTER=NVIDIA GeForce RTX 5090 in separate processes. Each gave 2 passed, 0 failed, 0 ignored and no skips. The fixtures covered four packed results across 64 lanes with each translation path on both GPUs.

Not tested

A retail title, the full workspace suite and partial EXEC masks in this retest.

AI use

OpenAI Codex (GPT-6.2 Sol) ran the retest and updated this report.


Independent GPU test of ca4c7df9a28c4f0079a5ee3b836b8d87fb76548d. The PR's HLSL path passes on AMD and NVIDIA. The same fixture reproduces the direct-DXIL sign-modifier gap reported above on both GPUs.

Tested

  • Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62, native wave64), NVIDIA GeForce RTX 5090 (32.0.16.1742, split wave64), Rust 1.100.0 MSVC, Windows SDK DXC 1.8.2502.11, debug/test profiles. Selected GPUs using XCL_ADAPTER.
  • On the unmodified head, cargo build --workspace --locked passed. On AMD with the default shader settings, cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output reported 860 passed, 0 failed, 42 ignored. One pass logged an explicit skip, heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.
  • cargo test --locked -p xcl --lib gpu::recomp::tests::gpu_pack_b32_f16_half_modifiers -- --exact --nocapture produced the same result on both adapters in each configuration below. All targeted invocations reported 0 ignored and no skips.
Configuration AMD RTX 5090
PR head, XCL_DIRECT_DXIL=0 1 passed 1 passed
PR head, XCL_DIRECT_DXIL=1 1 failed 1 failed
PR head plus the local direct-DXIL diff, XCL_DIRECT_DXIL=1 1 passed 1 passed

In the direct failure the -|2.0| case stopped at lane 0, producing 0x38004000 instead of 0x3800C000. For the last row I temporarily applied only the lower_valu.rs diff from ddaikodaiko's fork commit 319a384 to the PR head. The fixture passed all four packed-word checks across 64 lanes on each GPU. I restored the worktree afterward.

Not tested

Retail-title output, a full workspace run with the local direct-DXIL diff, or the full workspace on NVIDIA.

AI use

OpenAI Codex (GPT-6 family, exact variant unavailable) ran and checked the tests and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7143019013 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7143019013). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-24T20:05:06Z. --- **Retest on `94ecdd55d5f2a761ff498c1787c2ce4d46512f74`** @b3IKK The rebased head passed on my native-wave64 Radeon and RTX 5090. This resolves the direct-DXIL failure I reported below. **Tested** - Clean detached head, Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11, unoptimized profile. AMD Radeon(TM) Graphics driver 32.0.21042.62 and RTX 5090 driver 32.0.16.1742. - Ran `cargo test --locked -p xcl --lib pack_b32_f16 -- --nocapture --test-threads=1` with `XCL_ADAPTER=AMD Radeon` (`XCL_REQUIRE_GPU=wave64`) and `XCL_ADAPTER=NVIDIA GeForce RTX 5090` in separate processes. Each gave 2 passed, 0 failed, 0 ignored and no skips. The fixtures covered four packed results across 64 lanes with each translation path on both GPUs. **Not tested** A retail title, the full workspace suite and partial EXEC masks in this retest. **AI use** OpenAI Codex (GPT-6.2 Sol) ran the retest and updated this report. --- Independent GPU test of `ca4c7df9a28c4f0079a5ee3b836b8d87fb76548d`. The PR's HLSL path passes on AMD and NVIDIA. The same fixture reproduces the direct-DXIL sign-modifier gap reported above on both GPUs. **Tested** - Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62, native wave64), NVIDIA GeForce RTX 5090 (32.0.16.1742, split wave64), Rust 1.100.0 MSVC, Windows SDK DXC 1.8.2502.11, debug/test profiles. Selected GPUs using `XCL_ADAPTER`. - On the unmodified head, `cargo build --workspace --locked` passed. On AMD with the default shader settings, `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output` reported **860 passed, 0 failed, 42 ignored**. One pass logged an explicit skip, `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows`. - `cargo test --locked -p xcl --lib gpu::recomp::tests::gpu_pack_b32_f16_half_modifiers -- --exact --nocapture` produced the same result on both adapters in each configuration below. All targeted invocations reported 0 ignored and no skips. | Configuration | AMD | RTX 5090 | | --- | --- | --- | | PR head, `XCL_DIRECT_DXIL=0` | 1 passed | 1 passed | | PR head, `XCL_DIRECT_DXIL=1` | 1 failed | 1 failed | | PR head plus the local direct-DXIL diff, `XCL_DIRECT_DXIL=1` | 1 passed | 1 passed | In the direct failure the `-|2.0|` case stopped at lane 0, producing `0x38004000` instead of `0x3800C000`. For the last row I temporarily applied only the `lower_valu.rs` diff from [ddaikodaiko's fork commit `319a384`](https://github.com/ddaikodaiko/xcl/commit/319a38468e4c8f6cf9219bb9cd4a393518284152) to the PR head. The fixture passed all four packed-word checks across 64 lanes on each GPU. I restored the worktree afterward. **Not tested** Retail-title output, a full workspace run with the local direct-DXIL diff, or the full workspace on NVIDIA. **AI use** OpenAI Codex (GPT-6 family, exact variant unavailable) ran and checked the tests and wrote this report.
b3IKK commented 2026-11-24 22:06:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T21:49:45Z.


Rebased onto 1d027e5 and re-ran both with the current scripts/smoke.ps1 (#677's hashed itle: line): 961 passed, 0 failed, 43 ignored.

<!-- greyfinch-sync:ivall/xcl:comment:7145442829 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7145442829). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T21:49:45Z. --- Rebased onto 1d027e5 and re-ran both with the current scripts/smoke.ps1 (#677's hashed itle: line): 961 passed, 0 failed, 43 ignored.
DavidM1911 commented 2026-11-24 23:08:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T22:28:48Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7146279271 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7146279271). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T22:28:48Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. Thanks!
b3IKK commented 2026-11-25 00:08:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T23:25:08Z.


@ddaikodaiko @nnonno91 thank you both: the direct DXIL translator had the same gap, and the measurement (0x38004000 instead of 0x3800C000 at lane 0) is exactly what I get here without the change.

Pushed 3edf769 (rebased onto 689f2db):

  • dxil/lower_valu.rs: abs (& 0x7FFF) and neg (^ 0x8000) on the half op_sel picks, indices 0 / 1 for the low / high half, as in the HLSL path. I wrote this from the description of the gap rather than taking the fork commit, which its author said was not built or run.
  • gpu_pack_b32_f16_half_modifiers now runs the program through the default path and through the direct translator in the same test, so it does not depend on XCL_DIRECT_DXIL being set. With the lower_valu.rs change taken out it fails at direct DXIL, lane 0: -|2.0| packs -2.0 (left: 939540480, right: 939573248).
  • TRANSLATOR_VERSION goes 7 → 8, as kernel.rs asks for a change in the direct translator's output. Other open direct-DXIL PRs bump the same line, so one of us will have a one-line conflict.

Suite: 977 passed, 0 failed, 45 ignored. The two pack_b32_f16 tests pass with XCL_DIRECT_DXIL unset and with =1. Not run: the whole suite with XCL_DIRECT_DXIL=1, and AMD on this head.

On #1207: I have not looked at it.

AI use: OpenCode, Claude Fable 5.2 made the change, ran the tests and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7147376569 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7147376569). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T23:25:08Z. --- @ddaikodaiko @nnonno91 thank you both: the direct DXIL translator had the same gap, and the measurement (`0x38004000` instead of `0x3800C000` at lane 0) is exactly what I get here without the change. Pushed `3edf769` (rebased onto `689f2db`): - `dxil/lower_valu.rs`: `abs` (`& 0x7FFF`) and `neg` (`^ 0x8000`) on the half `op_sel` picks, indices 0 / 1 for the low / high half, as in the HLSL path. I wrote this from the description of the gap rather than taking the fork commit, which its author said was not built or run. - `gpu_pack_b32_f16_half_modifiers` now runs the program through the default path and through the direct translator in the same test, so it does not depend on `XCL_DIRECT_DXIL` being set. With the `lower_valu.rs` change taken out it fails at `direct DXIL, lane 0: -|2.0| packs -2.0` (`left: 939540480, right: 939573248`). - `TRANSLATOR_VERSION` goes 7 → 8, as `kernel.rs` asks for a change in the direct translator's output. Other open direct-DXIL PRs bump the same line, so one of us will have a one-line conflict. Suite: 977 passed, 0 failed, 45 ignored. The two `pack_b32_f16` tests pass with `XCL_DIRECT_DXIL` unset and with `=1`. Not run: the whole suite with `XCL_DIRECT_DXIL=1`, and AMD on this head. On #1207: I have not looked at it. AI use: OpenCode, Claude Fable 5.2 made the change, ran the tests and wrote this comment.
b3IKK commented 2026-11-25 00:09:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T23:45:53Z.


A correction to my comment above. I wrote "On #1207: I have not looked at it." That was wrong: #1207 is this account's own earlier PR for the same change (#1607, group D49, "one author: the same change"). I had not checked whose it was before answering.

The two do the same thing in emit.rs. This PR now also fixes the direct DXIL translator and tests both paths, so it is the one to keep. I am closing #1207 in its favour. What #1207 had that this one does not: its GPU test ran both wave sizes with a NaN payload. If a reviewer wants that case here, say so and I will add it.

AI use: OpenCode, Claude Fable 5.2 wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7147768320 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7147768320). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T23:45:53Z. --- A correction to my comment above. I wrote "On #1207: I have not looked at it." That was wrong: #1207 is this account's own earlier PR for the same change (#1607, group D49, "one author: the same change"). I had not checked whose it was before answering. The two do the same thing in `emit.rs`. This PR now also fixes the direct DXIL translator and tests both paths, so it is the one to keep. I am closing #1207 in its favour. What #1207 had that this one does not: its GPU test ran both wave sizes with a NaN payload. If a reviewer wants that case here, say so and I will add it. AI use: OpenCode, Claude Fable 5.2 wrote this comment.
raylitebull commented 2026-11-25 02:09:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T02:01:46Z.


CI workflow approved for 3edf769.

Diff looks clean (emit.rs and dxil/lower_valu.rs apply abs/neg to the selected op_sel half). Remaining before merge: rebase onto current main (dropping the kernel.rs manual TRANSLATOR_VERSION bump since merged #1947 auto-hashes gpu/dxil/* via XCL_DIRECT_DXIL_SOURCE_ID), and obtain an AMD GPU verification pass on the rebased head.

<!-- greyfinch-sync:ivall/xcl:comment:7150234647 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7150234647). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T02:01:46Z. --- `CI` workflow approved for `3edf769`. Diff looks clean (`emit.rs` and `dxil/lower_valu.rs` apply `abs`/`neg` to the selected `op_sel` half). **Remaining before merge:** rebase onto current `main` (dropping the `kernel.rs` manual `TRANSLATOR_VERSION` bump since merged `#1947` auto-hashes `gpu/dxil/*` via `XCL_DIRECT_DXIL_SOURCE_ID`), and obtain an **AMD** GPU verification pass on the rebased head.
JJAutoCompare commented 2026-11-25 05:08:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T04:39:35Z.


Tested

Independent Arc A770 verification of open PR #1720 at 3edf769e5a841ce271cd8f4ab99941f26d1ac704. The reused checkout was clean and detached at that SHA before and after.

STOR-WINLAB, Windows 11 Enterprise Evaluation 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5. The unoptimized build used two Cargo jobs with incremental compilation and debug info disabled.

cargo test --locked -p xcl --lib --no-run
$exe = 'L:/XclTooling/pr2008-dc0d25fe/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe'
& $exe gpu::recomp::tests::pack_b32_f16_applies_the_half_modifiers --exact --nocapture --test-threads=1
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    & $exe gpu::recomp::tests::gpu_pack_b32_f16_half_modifiers --exact --nocapture --test-threads=1
}

The build and CPU fixture ran outside the mutex. The CPU fixture confirmed HLSL uses & 0x7FFF for ABS and ^ 0x8000 for NEG. The GPU fixture dispatched HLSL/DXC and direct DXIL, with 512 output assertions across both backends. All 64 logical lanes matched the expected four dwords 0x38004000, 0x3800C000, 0xCC004400, and 0x4600C000. The cases covered unmodified low halves, ABS/NEG, high-half selection, and source-one ABS. The wrapper logged mutex release.

2 passed, 0 failed, 0 ignored, 0 skipped. Each fixture exited 0 and filtered out 952 tests. CPU took 0.02 s and GPU 0.68 s.

Not tested

Partial or zero EXEC masks, other adapters, the workspace suite, and retail smoke.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixtures and wrote the test report.

<!-- greyfinch-sync:ivall/xcl:comment:7153046363 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7153046363). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T04:39:35Z. --- **Tested** Independent Arc A770 verification of open PR #1720 at `3edf769e5a841ce271cd8f4ab99941f26d1ac704`. The reused checkout was clean and detached at that SHA before and after. STOR-WINLAB, Windows 11 Enterprise Evaluation 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5. The unoptimized build used two Cargo jobs with incremental compilation and debug info disabled. ```powershell cargo test --locked -p xcl --lib --no-run $exe = 'L:/XclTooling/pr2008-dc0d25fe/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' & $exe gpu::recomp::tests::pack_b32_f16_applies_the_half_modifiers --exact --nocapture --test-threads=1 & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { & $exe gpu::recomp::tests::gpu_pack_b32_f16_half_modifiers --exact --nocapture --test-threads=1 } ``` The build and CPU fixture ran outside the mutex. The CPU fixture confirmed HLSL uses `& 0x7FFF` for ABS and `^ 0x8000` for NEG. The GPU fixture dispatched HLSL/DXC and direct DXIL, with 512 output assertions across both backends. All 64 logical lanes matched the expected four dwords `0x38004000`, `0x3800C000`, `0xCC004400`, and `0x4600C000`. The cases covered unmodified low halves, ABS/NEG, high-half selection, and source-one ABS. The wrapper logged mutex release. **2 passed, 0 failed, 0 ignored, 0 skipped.** Each fixture exited 0 and filtered out 952 tests. CPU took 0.02 s and GPU 0.68 s. **Not tested** Partial or zero EXEC masks, other adapters, the workspace suite, and retail smoke. **AI use** T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixtures and wrote the test report.
b3IKK commented 2026-11-25 11:09:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-25T10:48:34Z.


Rebased onto 568e7db; the only conflict was TRANSLATOR_VERSION, which main had already taken to 9, so this head is 10. Head 94ecdd5: 1156 passed, 0 failed, 46 ignored, and the smoke pair in the description is 568e7db / 94ecdd5 run one after the other (both 1640 frames, 0 crashes, 0 device removals). AI use: OpenCode, Claude Fable 5.2.

<!-- greyfinch-sync:ivall/xcl:comment:7160201470 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7160201470). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-25T10:48:34Z. --- Rebased onto `568e7db`; the only conflict was `TRANSLATOR_VERSION`, which `main` had already taken to 9, so this head is 10. Head `94ecdd5`: 1156 passed, 0 failed, 46 ignored, and the smoke pair in the description is `568e7db` / `94ecdd5` run one after the other (both 1640 frames, 0 crashes, 0 device removals). AI use: OpenCode, Claude Fable 5.2.
zhouzhidong3-hash commented 2026-11-25 11:09:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by zhouzhidong3-hash on 2026-11-25T11:06:10Z.


Independent RTX 5070 focused check of clean head 94ecdd55d5f2a761ff498c1787c2ce4d46512f74.

Windows 10 x64, i7-12700KF, RTX 5070 driver 591.86, Rust 1.100.0 MSVC debug, DXC/DXIL 1.8.2502.11, local D3D12 Agility SDK; XCL_ADAPTER=5070.

cargo test --locked -p xcl --lib pack_b32_f16 -- --test-threads=1 --nocapture

  • XCL_DIRECT_DXIL=0: 2 passed, 0 failed, 0 ignored, 1124 filtered out, 6.99 s.
  • XCL_DIRECT_DXIL=all: 2 passed, 0 failed, 0 ignored, 1124 filtered out, 0.26 s.
  • No skip messages. The GPU fixture exercises its selected default path and an explicit Direct DXIL container. The other test checks translation text.

Additional reproduction, separate from the clean-head run: copied this PR's test-only hunk onto older 7a1f5a2 with no runtime changes. The GPU test failed in both modes at -|2.0|, actual packed word 939540480 versus expected 939573248. Applying this PR's two runtime emitter hunks there (leaving that older tree's cache-version constant alone) made the two focused tests pass in both modes, without skips. This is a ported before/after control, not a parent-commit control for the rebased head.

Not tested: full workspace, Release, native wave64, AMD/Intel, retail smoke, or gameplay impact. Durations are single runs and are not a performance comparison.

Logs: nvidia-pr1720-head-0.log, nvidia-pr1720-head-all.log, nvidia-pack-before-{0,all}.log, nvidia-pack-after-{0,all}.log under I:\neospace\work\xcl-1994-5070.

AI assistance: OpenAI Codex ran the unchanged upstream tests, prepared and restored the older-tree control, checked the logs and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7160589364 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7160589364). Originally posted by [zhouzhidong3-hash](https://github.com/zhouzhidong3-hash) on 2026-11-25T11:06:10Z. --- Independent RTX 5070 focused check of clean head `94ecdd55d5f2a761ff498c1787c2ce4d46512f74`. Windows 10 x64, i7-12700KF, RTX 5070 driver 591.86, Rust 1.100.0 MSVC debug, DXC/DXIL 1.8.2502.11, local D3D12 Agility SDK; `XCL_ADAPTER=5070`. `cargo test --locked -p xcl --lib pack_b32_f16 -- --test-threads=1 --nocapture` - `XCL_DIRECT_DXIL=0`: 2 passed, 0 failed, 0 ignored, 1124 filtered out, 6.99 s. - `XCL_DIRECT_DXIL=all`: 2 passed, 0 failed, 0 ignored, 1124 filtered out, 0.26 s. - No skip messages. The GPU fixture exercises its selected default path and an explicit Direct DXIL container. The other test checks translation text. Additional reproduction, separate from the clean-head run: copied this PR's test-only hunk onto older `7a1f5a2` with no runtime changes. The GPU test failed in both modes at `-|2.0|`, actual packed word 939540480 versus expected 939573248. Applying this PR's two runtime emitter hunks there (leaving that older tree's cache-version constant alone) made the two focused tests pass in both modes, without skips. This is a ported before/after control, not a parent-commit control for the rebased head. Not tested: full workspace, Release, native wave64, AMD/Intel, retail smoke, or gameplay impact. Durations are single runs and are not a performance comparison. Logs: nvidia-pr1720-head-0.log, nvidia-pr1720-head-all.log, nvidia-pack-before-{0,all}.log, nvidia-pack-after-{0,all}.log under I:\neospace\work\xcl-1994-5070. AI assistance: OpenAI Codex ran the unchanged upstream tests, prepared and restored the older-tree control, checked the logs and drafted this report.
DavidM1911 commented 2026-11-26 07:03:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T06:17:09Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7184278079 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7184278079). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T06:17:09Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
github-actions[bot] commented 2026-11-30 08:43:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:43:12Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7273257841 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7273257841). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:43:12Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 06:34:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:34:59Z.


Triage (#1607) – head 94ecdd5

#1207 made the same change and its author closed it as a duplicate of this PR (group D49 in #1607). Main's v_pack_b32_f16 in emit.rs and dxil/lower_valu.rs still ignores abs/neg, so the fix is not on main. #1158 and #1777 test or fix only the op_sel half selection.
I checked the expected values of the HLSL and GPU tests by hand.
The branch conflicts with main, which has since moved TRANSLATOR_VERSION to 12. The bump needs to be redone on rebase.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303038113 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1720#issuecomment-7303038113). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:34:59Z. --- **Triage (#1607)** – head 94ecdd5 #1207 made the same change and its author closed it as a duplicate of this PR (group D49 in #1607). Main's `v_pack_b32_f16` in `emit.rs` and `dxil/lower_valu.rs` still ignores abs/neg, so the fix is not on main. #1158 and #1777 test or fix only the op_sel half selection. I checked the expected values of the HLSL and GPU tests by hand. The branch conflicts with main, which has since moved `TRANSLATOR_VERSION` to 12. The bump needs to be redone on rebase. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1720:upstream-pr/1720'
git switch 'upstream-pr/1720'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1720'
git switch 'upstream-pr/1720'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1720'
git switch 'upstream-pr/1720'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1720'
git switch 'main'
git merge --squash 'upstream-pr/1720'
git switch 'main'
git merge --ff-only 'upstream-pr/1720'
git switch 'main'
git merge 'upstream-pr/1720'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1710
No description provided.