xshader: let a paired compare read the scalar its mask replaces #613

Merged
NickStallman merged 3 commits from upstream-pr/613 into main 2026-12-01 13:55:47 +00:00
NickStallman commented 2026-12-01 08:44:21 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T08:44:21Z.


In the paired wave64 translation each lane's copy of an instruction gets a local for a mask it writes, starting at zero. When the mask's registers are also a source, as in s[0:1] = s0 < v0, the local hid the scalar, so the compare read 0. The local now starts from the value the instruction reads.

VCC had the opposite problem: every instruction that named it read its own lane's bit, though only a select, a carry-in and v_div_fmas use it as a mask. Elsewhere it is now a scalar value. An instruction that uses the same registers as a mask and a value, or EXEC as a value, is refused; none is recorded.

Refs #533.

Affects programs translated in the paired form: 64-lane compute on hosts with 32-lane waves, and groups that fill part of a wave or exchange lanes in a loop on any host.

Measured

  • 5,366 recorded compute requests of one title, main 717a74c4, translated for a 32-lane host: 314 change, 4,545 don't, 507 are refused before and after; 0 newly refused. 306 change with the first commit alone; 12 read VCC as a value. Without that host option 32 of the 314 change.

  • All 314 compile and validate (DXC with the runtime's compute flags, dxv): 279 compiled, 35 identical copies. DXIL size +0.1%.

  • Tests: 9 unit tests, 6 of which fail on the parent; 18 mutations, all caught. The recorded host profiles don't change.

  • GPU check paired-wave64: three programs (compare, carry, VCC), each in whole and part waves, 12 cases, against the console model; the model is checked against a closed form. It passes on both cards in the full checks below (140 programs). Controls on the RTX 5090: with the parent's translator the check fails on exactly the 12 new cases (12 of 140 programs); with only the first commit (mask sources, no VCC as a value) it fails on exactly the 4 vcc_source* cases.

  • In a title we traced, on a 32-lane host, an integration build with this and #611 put lit, textured surfaces on screen that were missing (one run; it carries other open PRs, so I don't claim it for this alone).

  • Full python tuxbox.py check of f7790ed2 (GE-Proton11-15): RTX 5090 (10de:2b85, 620.70.10) 208 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 207 pass, 0 fail.

Evidence: TuxBox check of f7790ed23f, no uncommitted changes, GPU 10de:2b85: 17 passed, 0 failed, 0 not run
Evidence: TuxBox check of f7790ed23f, no uncommitted changes, GPU 1002:13c0: 17 passed, 0 failed, 0 not run

Not covered

  • v_div_scale with a scalar mask destination is still refused in the paired form, as before.
  • No Lanes scenario: the translator GPU check covers it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5582167932 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/613). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-12-01T08:44:21Z. --- In the paired wave64 translation each lane's copy of an instruction gets a local for a mask it writes, starting at zero. When the mask's registers are also a source, as in `s[0:1] = s0 < v0`, the local hid the scalar, so the compare read 0. The local now starts from the value the instruction reads. VCC had the opposite problem: every instruction that named it read its own lane's bit, though only a select, a carry-in and `v_div_fmas` use it as a mask. Elsewhere it is now a scalar value. An instruction that uses the same registers as a mask and a value, or EXEC as a value, is refused; none is recorded. Refs #533. Affects programs translated in the paired form: 64-lane compute on hosts with 32-lane waves, and groups that fill part of a wave or exchange lanes in a loop on any host. ## Measured - **5,366 recorded compute requests** of one title, main 717a74c4, translated for a 32-lane host: 314 change, 4,545 don't, 507 are refused before and after; 0 newly refused. 306 change with the first commit alone; 12 read VCC as a value. Without that host option 32 of the 314 change. - **All 314 compile and validate** (DXC with the runtime's compute flags, dxv): 279 compiled, 35 identical copies. DXIL size +0.1%. - **Tests:** 9 unit tests, 6 of which fail on the parent; 18 mutations, all caught. The recorded host profiles don't change. - **GPU check `paired-wave64`:** three programs (compare, carry, VCC), each in whole and part waves, 12 cases, against the console model; the model is checked against a closed form. It passes on both cards in the full checks below (140 programs). Controls on the RTX 5090: with the parent's translator the check fails on exactly the 12 new cases (12 of 140 programs); with only the first commit (mask sources, no VCC as a value) it fails on exactly the 4 `vcc_source*` cases. - In a title we traced, on a 32-lane host, an integration build with this and #611 put lit, textured surfaces on screen that were missing (one run; it carries other open PRs, so I don't claim it for this alone). - Full `python tuxbox.py check` of f7790ed2 (GE-Proton11-15): RTX 5090 (`10de:2b85`, 620.70.10) 208 pass, 0 fail; AMD iGPU (`1002:13c0`, RADV) 207 pass, 0 fail. Evidence: TuxBox check of f7790ed23f79, no uncommitted changes, GPU 10de:2b85: 17 passed, 0 failed, 0 not run Evidence: TuxBox check of f7790ed23f79, no uncommitted changes, GPU 1002:13c0: 17 passed, 0 failed, 0 not run ## Not covered - `v_div_scale` with a scalar mask destination is still refused in the paired form, as before. - No Lanes scenario: the translator GPU check covers it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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
brcly/TuxBox!613
No description provided.