Whole-wave sections: an EXEC set by s_bfm_b32 of constant counts is refused (wave32 prefix sums, 10 compute shaders) #361

Closed
opened 2026-11-27 14:08:54 +00:00 by tiagonogueiraa-bit · 5 comments
tiagonogueiraa-bit commented 2026-11-27 14:08:54 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by tiagonogueiraa-bit on 2026-11-27T14:08:54Z.


A shape from #4's list ("a whole-wave section step the simulation does not follow").

What is refused. The title's wave32 compute prefix sums build an inclusive sum in each row of 16 lanes (DPP row_shr 1, 2, 4, 8). Then they set EXEC to the upper row with s_bfm_b32 exec_lo, 16, 16 and add lane 15 through v_permlanex16_b32 v46, v47, -1, -1. In Lower::section_inst, wave::register_only does not take the s_bfm, so the section stops there with "GFX10 code at …: s_bfm_b32 is not supported". The simulator follows only s_mov EXEC writes, even though this is a constant lane set too (0xffff0000).

How many. 10 unique compute shaders in a 12,020-shader corpus (Series S, boot to the menus, main 905e7aa) are refused for s_bfm_b32. All 10 are this shape.

Plan.

  • The section simulator follows s_bfm_b32 and s_bfm_b64 EXEC writes of two constant counts as the lane set they give.
  • An s_bfm with a count in an SGPR stays refused.
  • Tests: the lowering, and the prefix sum on Metal.
  • A by-output corpus sweep in the PR.
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6648062778 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361). Originally posted by [tiagonogueiraa-bit](https://github.com/tiagonogueiraa-bit) on 2026-11-27T14:08:54Z. --- A shape from #4's list ("a whole-wave section step the simulation does not follow"). **What is refused.** The title's wave32 compute prefix sums build an inclusive sum in each row of 16 lanes (DPP `row_shr` 1, 2, 4, 8). Then they set EXEC to the upper row with `s_bfm_b32 exec_lo, 16, 16` and add lane 15 through `v_permlanex16_b32 v46, v47, -1, -1`. In `Lower::section_inst`, `wave::register_only` does not take the `s_bfm`, so the section stops there with "GFX10 code at …: s_bfm_b32 is not supported". The simulator follows only `s_mov` EXEC writes, even though this is a constant lane set too (0xffff0000). **How many.** 10 unique compute shaders in a 12,020-shader corpus (Series S, boot to the menus, main `905e7aa`) are refused for `s_bfm_b32`. All 10 are this shape. **Plan.** - The section simulator follows `s_bfm_b32` and `s_bfm_b64` EXEC writes of two constant counts as the lane set they give. - An `s_bfm` with a count in an SGPR stays refused. - Tests: the lowering, and the prefix sum on Metal. - A by-output corpus sweep in the PR.
tiagonogueiraa-bit commented 2026-11-27 14:08:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by tiagonogueiraa-bit on 2026-11-27T14:08:56Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7220405895 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7220405895). Originally posted by [tiagonogueiraa-bit](https://github.com/tiagonogueiraa-bit) on 2026-11-27T14:08:56Z. --- /claim
github-actions[bot] commented 2026-11-27 14:09:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T14:09:06Z.


Claimed by @tiagonogueiraa-bit. Open a draft pull request with Refs #361 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7220409799 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7220409799). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T14:09:06Z. --- Claimed by @tiagonogueiraa-bit. Open a draft pull request with `Refs #361` in its description within 24 hours, or the claim expires.
Olima34 commented 2026-11-27 14:14:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-27T14:14:59Z.


Thanks, this looks worth doing, and our data agrees with yours. Our corpus of shaders refused at boot (M5 Pro, Series S, main 60baf130, native host options) has the same count: 10 compute shaders refused with "s_bfm_b32 is not supported", nothing else with that message:

1ba04ed0bdb9d8f7 34046961ba5a083e 6c7f547fee86539d 6eb2cad0734f0844 71ffd0d7b57f5413 8c9f69d0d905ffe3 b8c3843f71fb4eaa c38c7bd6ba697164 cbd298c95c519202 d9be592e55ce3180

Pointers that may save you time:

  • Where it's refused: wave::register_only (emit/wave.rs) admits only s_mov/s_and plus Op::salu_of for section steps. The simulator's EXEC tracking is where s_bfm needs to become a constant lane set.
  • Existing constant s_bfm handling you can reuse instead of writing it again:
    • resource.rs (around l. 2911): s_bfm_b32/s_bfm_b64 with two constant operands;
    • structure.rs (around l. 1149): s_bfm with constant width and offset in the lane algebra;
    • mask_tests.rs: tests for s_bfm_b64 exec, 8, 4 and for a count in an SGPR, which must stay refused.
  • What the maintainer asks for on translator PRs: a test with values (here, the prefix sum on Metal, checking every lane's result), a negative test (an SGPR count stays refused), and a by-output corpus comparison (gained / lost / changed per stage).

When your draft is up, mention @Olima34 and we'll run it over our two boot sets (4,129 refused and 4,921 translated containers) and post the table.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7220541211 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7220541211). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-27T14:14:59Z. --- Thanks, this looks worth doing, and our data agrees with yours. Our corpus of shaders refused at boot (M5 Pro, Series S, main 60baf130, native host options) has the same count: **10 compute shaders** refused with "s_bfm_b32 is not supported", nothing else with that message: `1ba04ed0bdb9d8f7` `34046961ba5a083e` `6c7f547fee86539d` `6eb2cad0734f0844` `71ffd0d7b57f5413` `8c9f69d0d905ffe3` `b8c3843f71fb4eaa` `c38c7bd6ba697164` `cbd298c95c519202` `d9be592e55ce3180` Pointers that may save you time: - **Where it's refused:** `wave::register_only` (`emit/wave.rs`) admits only `s_mov`/`s_and` plus `Op::salu_of` for section steps. The simulator's EXEC tracking is where `s_bfm` needs to become a constant lane set. - **Existing constant `s_bfm` handling you can reuse** instead of writing it again: - `resource.rs` (around l. 2911): `s_bfm_b32`/`s_bfm_b64` with two constant operands; - `structure.rs` (around l. 1149): `s_bfm` with constant width and offset in the lane algebra; - `mask_tests.rs`: tests for `s_bfm_b64 exec, 8, 4` and for a count in an SGPR, which must stay refused. - **What the maintainer asks for on translator PRs:** a test with values (here, the prefix sum on Metal, checking every lane's result), a negative test (an SGPR count stays refused), and a by-output corpus comparison (gained / lost / changed per stage). When your draft is up, mention @Olima34 and we'll run it over our two boot sets (4,129 refused and 4,921 translated containers) and post the table.
tiagonogueiraa-bit commented 2026-11-27 14:20:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by tiagonogueiraa-bit on 2026-11-27T14:20:37Z.


Widened to the wave64 form of the same prefix sums: s_bitreplicate_b64_b32 exec, 0xff00ff00 then s_bfm_b64 exec, 32, 32. That adds 2 shaders refused by name and 6 whose section values were unknown, which were refused later at a mask read. #362 now gains 17 compute shaders with no regressions.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7220662051 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7220662051). Originally posted by [tiagonogueiraa-bit](https://github.com/tiagonogueiraa-bit) on 2026-11-27T14:20:37Z. --- Widened to the wave64 form of the same prefix sums: `s_bitreplicate_b64_b32 exec, 0xff00ff00` then `s_bfm_b64 exec, 32, 32`. That adds 2 shaders refused by name and 6 whose section values were unknown, which were refused later at a mask read. #362 now gains 17 compute shaders with no regressions.
LakshanSivakumar commented 2026-11-28 00:35:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-28T00:35:26Z.


Thank you for the careful report and the PR. Both commits (s_bfm for the wave32 sums, s_bitreplicate for the wave64 form) are on main through #362. Your corpus sweep showed 17 more compute shaders translating, with no regressions and no changed outputs. I did not re-run the sweep and I have not seen these shaders work in the game, so this rests on your numbers. Closing as fixed. If one of the 10 shaders is still refused for s_bfm on a6a58361, please tell me and I will reopen it.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7231033784 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7231033784). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-28T00:35:26Z. --- Thank you for the careful report and the PR. Both commits (s_bfm for the wave32 sums, s_bitreplicate for the wave64 form) are on main through #362. Your corpus sweep showed 17 more compute shaders translating, with no regressions and no changed outputs. I did not re-run the sweep and I have not seen these shaders work in the game, so this rests on your numbers. Closing as fixed. If one of the 10 shaders is still refused for s_bfm on a6a58361, please tell me and I will reopen it.
Sign in to join this conversation.
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
LakshanSivakumar/Native-Victory-macOS#361
No description provided.