shader: say which cross-lane operation outside compute, and in which stage #158

Manually merged
github merged 3 commits from gh-pr/158/head into gh-pr/158/base 2026-11-27 00:51:58 +00:00
Owner

@⁠m0rff on GitHub · 2026-11-26 22:13 UTC · original
m0rff:shader/name-cross-lane-outside-compute → main · +117 −11 · 3 files · 3 commits · merged 2026-11-26 22:39 UTC

A refusal split, like #118 and #131: it names the form instead of lowering it. Refs #4.

Why. "a cross-lane operation outside compute" is the largest refusal group nobody has claimed in the M5 Ultra log of #147 (commit 57b7ebd): 127 of 639, all vertex/pixel pairs. docs/native-host.md puts them on the pixel programs into the HDR scene colour (RGBA16F + R32_UINT). The message does not say which operation, and the right lowering depends on it. A quad-local op can use quad operations. A row op (DPP16 row_*, v_permlane16) stays inside 16 lanes, and Metal SIMD-groups hold whole rows. A constant-lane v_readlane reads a console lane that a pixel wave on the host does not have. Lowering any of these blind risks wrong values with no refusal at all, which is worse than refusing.

What. cross_lane takes the refusal text from each call site: the same prefix, then the operation and the stage (outside_compute! builds the two static strings with concat!):

  • ds_swizzle_b32 within a quad, ds_swizzle_b32 across quads, ds_bpermute_b32
  • DPP8, DPP quad_perm (refused only outside pixel programs), DPP row_shl, row_shr or row_ror, DPP row_mirror or row_half_mirror, DPP row_share or row_xmask, DPP with another row control (DPP_CTRL ranges, RDNA2 ISA)
  • v_readlane_b32 of a constant lane or of a computed lane, v_writelane_b32, v_permlane16_b32 or v_permlanex16_b32, v_mbcnt of a console lane mask

Each one ends with in a pixel program or in a vertex program, because the log line names both stages and not the one that refused. Tallies that group by a cross-lane operation outside compute still match. Nothing new is lowered.

Test. gfx_refusal_tests::a_cross_lane_operation_outside_compute_says_which_and_where: row_shr, ds_bpermute and a constant-lane v_readlane in a pixel program, and ds_bpermute and quad_perm in a vertex program, each with its exact text. A quad_perm DPP in a pixel program still lowers. It fails on main. No other test or doc used the old text.

Checks. cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p xtask, Windows clippy with -D warnings, and cargo xtask policy all pass. I don't have the game, so this has not been run in game. The next tester log will show which form dominates, and the lowering for it comes next.

**@⁠m0rff** on GitHub · 2026-11-26 22:13 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/158) `m0rff:shader/name-cross-lane-outside-compute` → `main` · +117 −11 · 3 files · 3 commits · merged 2026-11-26 22:39 UTC A refusal split, like #118 and #131: it names the form instead of lowering it. Refs #4. **Why.** "a cross-lane operation outside compute" is the largest refusal group nobody has claimed in the M5 Ultra log of #147 (commit 57b7ebd): 127 of 639, all vertex/pixel pairs. `docs/native-host.md` puts them on the pixel programs into the HDR scene colour (RGBA16F + R32_UINT). The message does not say which operation, and the right lowering depends on it. A quad-local op can use quad operations. A row op (DPP16 row_*, `v_permlane16`) stays inside 16 lanes, and Metal SIMD-groups hold whole rows. A constant-lane `v_readlane` reads a console lane that a pixel wave on the host does not have. Lowering any of these blind risks wrong values with no refusal at all, which is worse than refusing. **What.** `cross_lane` takes the refusal text from each call site: the same prefix, then the operation and the stage (`outside_compute!` builds the two static strings with `concat!`): - `ds_swizzle_b32 within a quad`, `ds_swizzle_b32 across quads`, `ds_bpermute_b32` - `DPP8`, `DPP quad_perm` (refused only outside pixel programs), `DPP row_shl, row_shr or row_ror`, `DPP row_mirror or row_half_mirror`, `DPP row_share or row_xmask`, `DPP with another row control` (DPP_CTRL ranges, RDNA2 ISA) - `v_readlane_b32 of a constant lane` or `of a computed lane`, `v_writelane_b32`, `v_permlane16_b32 or v_permlanex16_b32`, `v_mbcnt of a console lane mask` Each one ends with ` in a pixel program` or ` in a vertex program`, because the log line names both stages and not the one that refused. Tallies that group by `a cross-lane operation outside compute` still match. Nothing new is lowered. **Test.** `gfx_refusal_tests::a_cross_lane_operation_outside_compute_says_which_and_where`: row_shr, ds_bpermute and a constant-lane `v_readlane` in a pixel program, and ds_bpermute and quad_perm in a vertex program, each with its exact text. A quad_perm DPP in a pixel program still lowers. It fails on main. No other test or doc used the old text. **Checks.** `cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p xtask`, Windows clippy with `-D warnings`, and `cargo xtask policy` all pass. I don't have the game, so this has not been run in game. The next tester log will show which form dominates, and the lowering for it comes next.
A refusal split, like #118 and #131: it names the form instead of
lowering it. "a cross-lane operation outside compute" is the largest
unclaimed refusal in the M5 Ultra log of #147 (127 of 639, all graphics
pipelines), and the message did not say which operation, so there was
nothing safe to lower yet.

Each cross_lane call site now passes its own text after the same prefix,
for a pixel and a vertex program: ds_swizzle_b32 with a bit-mask
pattern, ds_bpermute_b32, DPP8, DPP row shifts/rotates, row mirrors,
row share/xmask, v_readlane_b32 of a constant lane, v_writelane_b32,
v_permlane16/x16, v_mbcnt of a console lane mask. Nothing new is
lowered.

Test: gfx_refusal_tests::a_cross_lane_operation_outside_compute_says_which_and_where
(row_shr, ds_bpermute and a constant-lane v_readlane in a pixel program,
ds_bpermute in a vertex program; quad_perm still lowers). It fails on main.
A quad_perm DPP or a quad-mode ds_swizzle passes in a pixel program but
is refused in a vertex one, where it was named as a row control or a
bit-mask pattern. A v_readlane of a computed lane outside Ps and Vs was
named a constant lane.
# Conflicts:
#	crates/victory-shader/src/emit/gfx_refusal_tests.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:51:56 +00:00
github manually merged commit 8e864fe597 into gh-pr/158/base 2026-11-27 00:51:58 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 22:39 UTC · original · review (dismissed)

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:39 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/158#pullrequestreview-6081189552) · **review (dismissed)** Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!
Author
Owner

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

I merged main into this branch and resolved the conflict with the PR merged before it (both changes kept). 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:39 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/158#pullrequestreview-6081191180) · **approved these changes** I merged main into this branch and resolved the conflict with the PR merged before it (both changes kept). 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.