Shaders: v_permlane16/v_permlanex16 run in the console's lanes (were missed by the cross-lane check) #79
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/79"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from uiliannn/VItoriaBr. Originally posted by lcg007xd-c on 2026-11-25T22:01:42Z.
What
A compute program whose code reads other lanes has to run in the console's wave size and lane order (
console_lanes: aWaveSize, and threads relabelled so host lane = console lane). The check for such code matchesds_swizzle,permute(ds_permute/ds_bpermute), DPP,v_mbcntandv_readlane/v_writelane. It missesv_permlane16_b32/v_permlanex16_b32: their names saypermlane, notpermute. The comment just below already counts them as cross-lane code.So take a program whose only cross-lane instruction is a permlane, with a group larger than one wave and no LDS:
WaveSizeand no relabelling, so its permlanes read whichever lanes the host's wave put there (64 wide on some GPUs).cross_lane'sdebug_assert!(threads.is_none() || console_lanes).Both names now count as cross-lane code.
How it was found
I lowered every VALU opcode on its own in a small compute program.
v_permlane16_b32andv_permlanex16_b32were the only ones that panicked instead of lowering or returningUnsupported.Test
permlanes_ask_for_console_laneslowers each of the two in a 64-thread group, with LLVM's encoding ofv_permlane16_b32 v0, v1, s1, s2and the 0x378 equivalent. It checks that the result declares wave operations and runs in waves of 32. Without the fix, it fails in a debug build at thedebug_assert, and in--releasewithwave_sizeNoneinstead ofSome(32).The portable CI commands and Windows-target clippy (
--target x86_64-pc-windows-msvc) pass locally.Not tested: running a permlane shader on a GPU, so the lane results themselves are unchecked.
🤖 Generated with Claude Code