Lane masks and whole-wave sections of wave64 programs on 32-lane hosts #99

Closed
Castyan wants to merge 51 commits from upstream-pr/99 into main
Castyan commented 2026-11-26 20:05:07 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by Castyan on 2026-11-26T20:05:07Z.


Stacked on #98 (0x218, itself on #64 and #61). The changes to review are the 8 commits after 60ff2e8.

What

Wave64 programs on 32-lane hosts: lane masks and whole-wave sections that were refused, or computed wrongly.

  • 1745c11, 66347fb EXEC set to constant lanes (s_bfm_b64 exec, 32, 0, halves moved apart with s_mov_b32 exec_lo/exec_hi, s_bitreplicate_b64_b32, s_pack_*, s_movk_i32, s_brev_b32) is taken as that constant mask. An execution test runs 8 cases against the console's 64-lane result.
  • 898fc6d Bug fix: a lane read inside a whole-wave section is no longer taken as each lane's own value. v_readlane_b32 s14, v1, 3 with v1 = t + 1 gave each thread t + 1 where the console gives 4. This bug predates #64. Such a read is now refused instead of computing a wrong value.
  • f60719a A lane of a reduction read after EXEC is restored is taken.
  • 76ad683 SCC of a mask operation read as a number (src_scc, s_cselect, a carry after s_and_b64 s, vcc, exec) is "some lane of the console wave". It is exact in the paired form, or where the result is held in the lanes running there. Otherwise it stays refused.
  • 14c63a5 The sections of a block are simulated in order, so a section can read a lane of the one before it (the 0x218 reductions come two by two).
  • 9e0cd49 A section with no restore ends at the first EXEC write the simulation does not follow (m128 leaves its section for lane 0 alone).
  • 8b8f401 VCC on entry to a compute wave is read as 0, as the SGPRs above the hardware inputs already are. In run4 m159, m160 and m162 it only reaches a mask on the execz edge, where s_orn2 s, vcc, exec with EXEC 0 sets every bit whatever VCC holds. Its test runs that shape for 32- and 64-lane console waves against the console's result.

Results

Replay of two sets of 200 captured 0x218 descriptions on the RTX 5060 (programs reaching a hardware pipeline, dump-218 / dump-218-run4). Each change was measured on the tree it was developed on (the old #64 head), with no program lost: 898fc6d and f60719a together +2 / +3, 76ad683 +17 / +9, 14c63a5 +3 / +3, 9e0cd49 +1 / +1, 8b8f401 +0 / +3 (m159, m160, m162).

Checks (RTX 5060, at 8b8f401)

cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean. cargo test --workspace --locked: 748 passed, 0 failed, 11 ignored.

🤖 Generated with Claude Code

<!-- greyfinch-sync:DexNom/VIctory:issue:5516458741 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/99). Originally posted by [Castyan](https://github.com/Castyan) on 2026-11-26T20:05:07Z. --- **Stacked on #98** (0x218, itself on #64 and #61). The changes to review are the 8 commits after `60ff2e8`. ## What Wave64 programs on 32-lane hosts: lane masks and whole-wave sections that were refused, or computed wrongly. - **`1745c11`, `66347fb` EXEC set to constant lanes** (`s_bfm_b64 exec, 32, 0`, halves moved apart with `s_mov_b32 exec_lo/exec_hi`, `s_bitreplicate_b64_b32`, `s_pack_*`, `s_movk_i32`, `s_brev_b32`) is taken as that constant mask. An execution test runs 8 cases against the console's 64-lane result. - **`898fc6d` Bug fix: a lane read inside a whole-wave section is no longer taken as each lane's own value.** `v_readlane_b32 s14, v1, 3` with `v1 = t + 1` gave each thread `t + 1` where the console gives 4. This bug predates #64. Such a read is now refused instead of computing a wrong value. - **`f60719a`** A lane of a reduction read after EXEC is restored is taken. - **`76ad683` SCC of a mask operation read as a number** (`src_scc`, `s_cselect`, a carry after `s_and_b64 s, vcc, exec`) is "some lane of the console wave". It is exact in the paired form, or where the result is held in the lanes running there. Otherwise it stays refused. - **`14c63a5` The sections of a block are simulated in order**, so a section can read a lane of the one before it (the 0x218 reductions come two by two). - **`9e0cd49` A section with no restore** ends at the first EXEC write the simulation does not follow (m128 leaves its section for lane 0 alone). - **`8b8f401` VCC on entry to a compute wave is read as 0**, as the SGPRs above the hardware inputs already are. In run4 m159, m160 and m162 it only reaches a mask on the `execz` edge, where `s_orn2 s, vcc, exec` with EXEC 0 sets every bit whatever VCC holds. Its test runs that shape for 32- and 64-lane console waves against the console's result. ## Results Replay of two sets of 200 captured 0x218 descriptions on the RTX 5060 (programs reaching a hardware pipeline, dump-218 / dump-218-run4). Each change was measured on the tree it was developed on (the old #64 head), with no program lost: `898fc6d` and `f60719a` together +2 / +3, `76ad683` +17 / +9, `14c63a5` +3 / +3, `9e0cd49` +1 / +1, `8b8f401` +0 / +3 (m159, m160, m162). ## Checks (RTX 5060, at `8b8f401`) `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. `cargo test --workspace --locked`: 748 passed, 0 failed, 11 ignored. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
andrewDoing commented 2026-11-27 01:01:45 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by andrewDoing on 2026-11-27T01:01:45Z.


Independent native Windows D3D12 check at 8b8f401 on a physical RTX 5070 (10de:2f04): extended the eight constant EXEC-mask cases to workgroups of 64, 128, 192 and 256 threads. The oracle requires mask bits to repeat per 64-lane console wave while enabled writes retain the workgroup-local thread ID. Both the selected wave32 lowering and explicitly paired lowering matched all 20,480 output DWORDs across eight dispatches, including numeric copies of both EXEC halves. Rust 1.98.1 release test passed.

This covers complete synthetic console waves, not partial waves, title captures, or gameplay. Verification was AI-assisted with GPT-6.2 Astra.

<!-- greyfinch-sync:DexNom/VIctory:comment:7206950303 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/99#issuecomment-7206950303). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-27T01:01:45Z. --- Independent native Windows D3D12 check at `8b8f401` on a physical RTX 5070 (`10de:2f04`): extended the eight constant EXEC-mask cases to workgroups of 64, 128, 192 and 256 threads. The oracle requires mask bits to repeat per 64-lane console wave while enabled writes retain the workgroup-local thread ID. Both the selected wave32 lowering and explicitly paired lowering matched all 20,480 output DWORDs across eight dispatches, including numeric copies of both EXEC halves. Rust 1.98.1 release test passed. This covers complete synthetic console waves, not partial waves, title captures, or gameplay. Verification was AI-assisted with GPT-6.2 Astra.
Castyan commented 2026-11-27 07:40:29 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by Castyan on 2026-11-27T07:40:29Z.


Merged into #64 (83bfddc), where this work continues. Closing as superseded.

<!-- greyfinch-sync:DexNom/VIctory:comment:7212704647 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/99#issuecomment-7212704647). Originally posted by [Castyan](https://github.com/Castyan) on 2026-11-27T07:40:29Z. --- Merged into #64 (`83bfddc`), where this work continues. Closing as superseded.

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
DexNom/VIctory!99
No description provided.