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

Closed
opened 2026-11-27 14:16:38 +00:00 by github-bot · 5 comments
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-27 14:08 UTC · original

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** on GitHub · 2026-11-27 14:08 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361) 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 14:16:38 +00:00
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-27 14:08 UTC · original

/claim

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-27 14:08 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7220405895) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-27 14:09 UTC · original

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

**@⁠github-actions[bot]** on GitHub · 2026-11-27 14:09 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7220409799) Claimed by @⁠tiagonogueiraa-bit. Open a draft pull request with `Refs #361` in its description within 24 hours, or the claim expires.
Author
Owner

@⁠Olima34 on GitHub · 2026-11-27 14:14 UTC · original

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.

**@⁠Olima34** on GitHub · 2026-11-27 14:14 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7220541211) 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.
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-27 14:20 UTC · original

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. #365 now gains 17 compute shaders with no regressions.

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-27 14:20 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7220662051) 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. #365 now gains 17 compute shaders with no regressions.
github-bot referenced this issue from a commit 2026-11-27 16:13:14 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-28 00:35 UTC · original

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 #365. 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.

**@⁠LakshanSivakumar** on GitHub · 2026-11-28 00:35 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/361#issuecomment-7231033784) 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 #365. 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.