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

Merged
m0rff merged 3 commits from upstream-pr/158 into main 2026-11-26 22:39:51 +00:00
m0rff commented 2026-11-26 22:13:33 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by m0rff on 2026-11-26T22:13:33Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5517864854 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/158). Originally posted by [m0rff](https://github.com/m0rff) on 2026-11-26T22:13:33Z. --- 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.
LakshanSivakumar commented 2026-11-26 22:39:29 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T22:39:29Z.

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!

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6081189552 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/158#pullrequestreview-6081189552). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T22:39:29Z. **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 commented 2026-11-26 22:39:47 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T22:39:47Z.

Review: APPROVED


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!

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6081191180 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/158#pullrequestreview-6081191180). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T22:39:47Z. **Review:** APPROVED --- 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!
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
LakshanSivakumar/Native-Victory-macOS!158
No description provided.