Recompiler: a bridged v_cmp writes 0 for the lanes outside EXEC (#2458) #2497

Closed
xpatfussy69x wants to merge 1 commit from upstream-pr/2507 into main
xpatfussy69x commented 2026-11-25 21:07:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T21:07:17Z.


Part of #2458 (bug 1 only). In the per-lane form, a V_CMP_* that goes through #1426's lowering (float, 16- and 64-bit, V_CMP_CLASS, VOP3-modified) kept its raw result in the lanes outside EXEC, where the console writes 0. lane_masks never guards a V_CMP, so the bridge ran it with the guard true, and fe78c81 masked the result with EXEC only for v_cmpx. Under a narrowed EXEC, a later branch or v_cndmask on VCC then saw those lanes as set. Every bridged V_CMP* now ANDs its lane bit with EXEC, as the per-lane form's own U32/I32 compares already do.

What is in it

  • crates/xcl/src/gpu/recomp/lower.rs: the bridge takes the lane's EXEC bit into the result of every V_CMP*, not only V_CMPX*
  • crates/xcl/src/gpu/recomp/lower_dxil.rs: a_bridged_v_cmp_writes_0_for_the_lanes_outside_exec: EXEC = lanes 0–15, v_cmp_le_f32 true in every lane, EXEC restored, v_cndmask on VCC. Fails without the fix (7 in lane 16), passes with it

Tested

  • NVIDIA GeForce RTX 3060 (driver 32.0.16.2124, 32-lane waves only), AMD Ryzen 5 7500F, Windows 11, Rust 1.100.0, debug build for the tests, release for the smoke runs
  • cargo test --workspace -- --test-threads=4: 1422 passed, 0 failed, 46 ignored
  • SKIPPED (25): 21 × no wave64; 1 × no heap windows; 3 × per-lane form refused V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 (on main too; #2182 removes them)
  • cargo test -p xcl --lib a_bridged_v_cmp: 2 passed (the new test and the existing v_cmpx one)

Regression run

main:

xcl-smoke v1
commit: e0d93c84ad8253f6e17738d14741c1bab7061127
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 768 (PresentX 769)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14869 MB

PR:

xcl-smoke v1
commit: fe72311c1f837fedf974e1a9a0a07779ca53fe58
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1132 (PresentX 1133)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14801 MB

Not tested

  • AMD / native wave64: the new test runs wave32 only, and the wave64 variants of the GPU tests were skipped on this card
  • Whether the title reaches a bridged v_cmp under a narrowed EXEC (smoke run with default settings, not XCL_PER_LANE=1): it is a regression check only. The frame difference is most likely run-to-run variance in loading
  • Bug 2 of #2458 (writes to NULL); #2136 touches NULL destinations in upper_lanes

AI use

  • Claude Code, Claude Opus 5.5: wrote the fix, the test and this description, ran the tests and both smoke runs on the hardware above
<!-- greyfinch-sync:ivall/xcl:issue:6613771050 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2507). Originally posted by [xpatfussy69x](https://github.com/xpatfussy69x) on 2026-11-25T21:07:17Z. --- Part of #2458 (bug 1 only). In the per-lane form, a `V_CMP_*` that goes through #1426's lowering (float, 16- and 64-bit, `V_CMP_CLASS`, VOP3-modified) kept its raw result in the lanes outside EXEC, where the console writes 0. `lane_masks` never guards a `V_CMP`, so the bridge ran it with the guard `true`, and fe78c81 masked the result with EXEC only for `v_cmpx`. Under a narrowed EXEC, a later branch or `v_cndmask` on VCC then saw those lanes as set. Every bridged `V_CMP*` now ANDs its lane bit with EXEC, as the per-lane form's own U32/I32 compares already do. **What is in it** - `crates/xcl/src/gpu/recomp/lower.rs`: the bridge takes the lane's EXEC bit into the result of every `V_CMP*`, not only `V_CMPX*` - `crates/xcl/src/gpu/recomp/lower_dxil.rs`: `a_bridged_v_cmp_writes_0_for_the_lanes_outside_exec`: EXEC = lanes 0–15, `v_cmp_le_f32` true in every lane, EXEC restored, `v_cndmask` on VCC. Fails without the fix (7 in lane 16), passes with it **Tested** - NVIDIA GeForce RTX 3060 (driver 32.0.16.2124, 32-lane waves only), AMD Ryzen 5 7500F, Windows 11, Rust 1.100.0, debug build for the tests, release for the smoke runs - `cargo test --workspace -- --test-threads=4`: 1422 passed, 0 failed, 46 ignored - SKIPPED (25): 21 × no wave64; 1 × no heap windows; 3 × per-lane form refused `V_MUL_F16` / `V_PK_MUL_F16` / `V_CVT_F16_F32` (on `main` too; #2182 removes them) - `cargo test -p xcl --lib a_bridged_v_cmp`: 2 passed (the new test and the existing `v_cmpx` one) **Regression run** main: ``` xcl-smoke v1 commit: e0d93c84ad8253f6e17738d14741c1bab7061127 gpu: NVIDIA GeForce RTX 3060 title: c3f791f3 seconds: 60 exit: 0x0 frames shown: 768 (PresentX 769) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14869 MB ``` PR: ``` xcl-smoke v1 commit: fe72311c1f837fedf974e1a9a0a07779ca53fe58 gpu: NVIDIA GeForce RTX 3060 title: c3f791f3 seconds: 60 exit: 0x0 frames shown: 1132 (PresentX 1133) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14801 MB ``` **Not tested** - AMD / native wave64: the new test runs wave32 only, and the wave64 variants of the GPU tests were skipped on this card - Whether the title reaches a bridged `v_cmp` under a narrowed EXEC (smoke run with default settings, not `XCL_PER_LANE=1`): it is a regression check only. The frame difference is most likely run-to-run variance in loading - Bug 2 of #2458 (writes to `NULL`); #2136 touches `NULL` destinations in `upper_lanes` **AI use** - Claude Code, Claude Opus 5.5: wrote the fix, the test and this description, ran the tests and both smoke runs on the hardware above
upstream-sync closed this pull request 2026-11-25 22:06:22 +00:00
SlopTart commented 2026-11-25 22:06:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T21:15:37Z.


gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of a_bridged_v_cmp_writes_0_for_the_lanes_outside_exec: passed. Pairs with #2503's test (a_bridged_v_cmp_clears_inactive_lanes_outside_exec), also green here.

<!-- greyfinch-sync:ivall/xcl:comment:7174829906 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2507#issuecomment-7174829906). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T21:15:37Z. --- `gpu_` suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. Targeted run of `a_bridged_v_cmp_writes_0_for_the_lanes_outside_exec`: passed. Pairs with #2503's test (`a_bridged_v_cmp_clears_inactive_lanes_outside_exec`), also green here.
xpatfussy69x commented 2026-11-25 22:06:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T21:23:52Z.


Closing as a duplicate of #2503, which makes the same change to Lower::bridge and was opened first. I'll post this branch's test and smoke results there instead.

<!-- greyfinch-sync:ivall/xcl:comment:7175021483 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2507#issuecomment-7175021483). Originally posted by [xpatfussy69x](https://github.com/xpatfussy69x) on 2026-11-25T21:23:52Z. --- Closing as a duplicate of #2503, which makes the same change to `Lower::bridge` and was opened first. I'll post this branch's test and smoke results there instead.
DavidM1911 commented 2026-11-25 22:06:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T21:24:00Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7175024678 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2507#issuecomment-7175024678). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T21:24:00Z. --- 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!

Pull request closed

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!2497
No description provided.