shader: follow whole-wave float products (v_mul_f32) #150

Manually merged
github merged 1 commit from gh-pr/150/head into gh-pr/150/base 2026-11-27 00:51:22 +00:00
Owner

@⁠m0rff on GitHub · 2026-11-26 21:31 UTC · original
m0rff:m0rff/gfx10-refused-shader-shape → main · +116 −6 · 9 files · 1 commits · merged 2026-11-26 22:38 UTC

Refs #4.

A whole-wave section made of v_mul_f32 steps is how WaveActiveProduct expands. It was refused as "a whole-wave section step the simulation does not follow: a VALU operation it does not model". The simulation now follows it:

  • wave::Op::MulF, identity 1.0, counted once per lane;
  • lowered to waveActiveOp.f32 with the product kind;
  • on a wave32 host, the two host waves multiply their results (a missing upper half leaves the lower one alone, as for sums).

Prefix products and integer products (v_mul_lo_u32) are still refused. As with the other float reductions, the host multiplies in its own order.

Scope, honestly: no run log names the unmodelled operation, so I don't know that any title shader needs a product.

Overlap: @⁠Olima34, whole-wave section steps are in your list on #4. I saw no open PR or branch of yours for this one; say if it collides and I'll rework or close.

Tests (hand-assembled GFX10, llvm-mc -mcpu=gfx1030):

  • lowering with one host wave and with two;
  • a_whole_wave_product_multiplies_both_halves runs it on Metal and checks 2^35 on all 64 lanes. It fails without the fix. It skips without the Metal Shader Converter, so Windows CI only covers the lowering.
  • The two refusal tests that used v_mul_f32 as their unmodelled example now use v_sub_f32.

Run locally: cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p xtask, the Windows-target clippy, cargo xtask policy.

ROADMAP §3 also drops "an image store of some channels", fixed by #94. The refusal count is unchanged, since measuring it needs a game run.

**@⁠m0rff** on GitHub · 2026-11-26 21:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/150) `m0rff:m0rff/gfx10-refused-shader-shape` → `main` · +116 −6 · 9 files · 1 commits · merged 2026-11-26 22:38 UTC Refs #4. A whole-wave section made of `v_mul_f32` steps is how `WaveActiveProduct` expands. It was refused as "a whole-wave section step the simulation does not follow: a VALU operation it does not model". The simulation now follows it: - `wave::Op::MulF`, identity 1.0, counted once per lane; - lowered to `waveActiveOp.f32` with the product kind; - on a wave32 host, the two host waves multiply their results (a missing upper half leaves the lower one alone, as for sums). Prefix products and integer products (`v_mul_lo_u32`) are still refused. As with the other float reductions, the host multiplies in its own order. **Scope, honestly:** no run log names the unmodelled operation, so I don't know that any title shader needs a product. **Overlap:** @⁠Olima34, whole-wave section steps are in your list on #4. I saw no open PR or branch of yours for this one; say if it collides and I'll rework or close. **Tests** (hand-assembled GFX10, `llvm-mc -mcpu=gfx1030`): - lowering with one host wave and with two; - `a_whole_wave_product_multiplies_both_halves` runs it on Metal and checks 2^35 on all 64 lanes. It fails without the fix. It skips without the Metal Shader Converter, so Windows CI only covers the lowering. - The two refusal tests that used `v_mul_f32` as their unmodelled example now use `v_sub_f32`. Run locally: `cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p xtask`, the Windows-target clippy, `cargo xtask policy`. ROADMAP §3 also drops "an image store of some channels", fixed by #94. The refusal count is unchanged, since measuring it needs a game run.
A whole-wave section of v_mul_f32 steps is WaveActiveProduct: the lanes'
product with identity 1.0. It was refused as a VALU operation the
simulation does not model. Lower it to waveActiveOp with the product
kind, and multiply the two host waves' results on a wave32 host.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:51:20 +00:00
github manually merged commit afc671c1bc into gh-pr/150/base 2026-11-27 00:51:22 +00:00
Author
Owner

@⁠Olima34 on GitHub · 2026-11-26 21:35 UTC · original

Thanks for checking first, @⁠m0rff. No collision: I have nothing open on whole-wave sections. #121 (merged) only split that refusal by cause, so a run log now names the step ("a VALU operation it does not model", etc.), and it didn't lower anything. Updating its v_mul_f32 example to v_sub_f32 in the refusal tests is the right move. Go ahead. I'm running the game on an M5 Pro now; if a log shows products in whole-wave sections, I'll post it here.

**@⁠Olima34** on GitHub · 2026-11-26 21:35 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/150#issuecomment-7203877033) Thanks for checking first, @⁠m0rff. No collision: I have nothing open on whole-wave sections. #121 (merged) only split that refusal by cause, so a run log now names the step ("a VALU operation it does not model", etc.), and it didn't lower anything. Updating its `v_mul_f32` example to `v_sub_f32` in the refusal tests is the right move. Go ahead. I'm running the game on an M5 Pro now; if a log shows products in whole-wave sections, I'll post it here.
Author
Owner

@⁠m0rff on GitHub · 2026-11-26 22:09 UTC · original

Thanks, @⁠Olima34. If your M5 Pro log shows any "whole-wave section step the simulation does not follow: …" lines, products or not, I'd be glad to see them. A v_mul_f32 in one would confirm this PR matters for the title.

**@⁠m0rff** on GitHub · 2026-11-26 22:09 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/150#issuecomment-7204414635) Thanks, @⁠Olima34. If your M5 Pro log shows any "whole-wave section step the simulation does not follow: …" lines, products or not, I'd be glad to see them. A `v_mul_f32` in one would confirm this PR matters for the title.
Author
Owner

@⁠Olima34 on GitHub · 2026-11-26 22:10 UTC · original

Here's what my M5 Pro runs show (Series S, windowed, d41052c, which includes #121's split). The longest run reached the first world frame (4140) before the known image+0x55e56f8 crash:

  • 6× whole-wave section step the simulation does not follow: a value that is no reduction or prefix
  • 3× whole-wave section step the simulation does not follow: an EXEC write that is no constant

Two later, shorter runs show the same two forms (3 and 1). None of them says a VALU operation it does not model, so no v_mul_f32 product reaches this refusal in what I've loaded so far. "no reduction or prefix" means every step was modelled but the result isn't a single reduction or prefix. If that's the shape you'd expect from a product mixed with something else, it may be worth a look. I'll post again if a longer run shows the VALU form.

**@⁠Olima34** on GitHub · 2026-11-26 22:10 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/150#issuecomment-7204434711) Here's what my M5 Pro runs show (Series S, windowed, `d41052c`, which includes #121's split). The longest run reached the first world frame (4140) before the known `image+0x55e56f8` crash: - 6× `whole-wave section step the simulation does not follow: a value that is no reduction or prefix` - 3× `whole-wave section step the simulation does not follow: an EXEC write that is no constant` Two later, shorter runs show the same two forms (3 and 1). None of them says `a VALU operation it does not model`, so no `v_mul_f32` product reaches this refusal in what I've loaded so far. "no reduction or prefix" means every step was modelled but the result isn't a single reduction or prefix. If that's the shape you'd expect from a product mixed with something else, it may be worth a look. I'll post again if a longer run shows the VALU form.
Author
Owner

@⁠m0rff on GitHub · 2026-11-26 22:25 UTC · original

Thanks, @⁠Olima34, that's useful. On your question: I don't think the "no reduction or prefix" ones involve a product. On d41052c, any v_mul_f32 in a section would have reported "a VALU operation it does not model" instead. The "EXEC write that is no constant" ones are less certain, since the simulation stops at that write and never sees what follows. So #150 doesn't fix anything in your logs as far as they show; it only closes the gap for plain products.

**@⁠m0rff** on GitHub · 2026-11-26 22:25 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/150#issuecomment-7204658223) Thanks, @⁠Olima34, that's useful. On your question: I don't think the "no reduction or prefix" ones involve a product. On `d41052c`, any `v_mul_f32` in a section would have reported "a VALU operation it does not model" instead. The "EXEC write that is no constant" ones are less certain, since the simulation stops at that write and never sees what follows. So #150 doesn't fix anything in your logs as far as they show; it only closes the gap for plain products.
Author
Owner

@⁠Olima34 on GitHub · 2026-11-26 22:35 UTC · original

Agreed, @⁠m0rff: with #121's split, a product would have named itself, so #150 is a gap closed ahead of need rather than a fix for these logs. That's still worth having, since WaveActiveProduct is a plain HLSL intrinsic.

On the "EXEC write that is no constant" ones: I can run the game here in a few minutes. If a diagnostic would tell us what the section does after that write (the next steps, or the EXEC source), point me at a branch, or say what to log, and I'll post the forms from a world-load run.

**@⁠Olima34** on GitHub · 2026-11-26 22:35 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/150#issuecomment-7204817285) Agreed, @⁠m0rff: with #121's split, a product would have named itself, so #150 is a gap closed ahead of need rather than a fix for these logs. That's still worth having, since `WaveActiveProduct` is a plain HLSL intrinsic. On the "EXEC write that is no constant" ones: I can run the game here in a few minutes. If a diagnostic would tell us what the section does after that write (the next steps, or the EXEC source), point me at a branch, or say what to log, and I'll post the forms from a world-load run.
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 22:38 UTC · original · approved these changes

Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 22:38 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/150#pullrequestreview-6081186162) · **approved these changes** Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.