Repository navigation
Shared subgroup digit match (GPU Multisplit Alg. 3); OneSweep's WLMS built on it - #78
Merged
Merged
Conversation
…WLMS built on it subgroupDigitMatch (wgslFunctions) emits the ballot-based match that OneSweep's WLMS used inline: for a digit of a key, the lanes of the subgroup with the same digit, how many are below me, and the highest of them (Ashkiani et al., GPU Multisplit, Algorithm 3). It emits statements rather than a function, so callers' code is as if written inline. subgroupLaneMasks/subgroupLaneMaskLt supply the lane masks: u32, or vec4<u32> when the device's subgroups can be wider than 32. wideSubgroups moves from OneSweep to BasePrimitive. OneSweep's WLMS is now one template on these helpers instead of two copies. Its generated WGSL, with comments and whitespace removed, is identical to before for every configuration checked (subgroup ranges 32-32, 8-32, 32-64, 4-128; u32/i32/f32/u64; keys only and key-value), so sort performance is unchanged. This is the core a stable multisplit can reuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015kfNC6id65zEHzuAAH4jtJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 2 of the GPU Multisplit plan: factor out the ballot-based digit match, Algorithm 3 of Ashkiani et al. and the core of OneSweep's
WLMS, so that a stable multisplit can reuse it.subgroupDigitMatch({ key, shift, bits, rank, peer })inwgslFunctions: one ballot per digit bit. It yieldseq_mask(the lanes with my digit),<rank>(how many of them are below me) and<peer>(the highest of them). It emits statements rather than a function, so a caller's code is exactly what it would be if written inline.subgroupLaneMasks()/subgroupLaneMaskLt(): the lane masks areu32, orvec4<u32>when the device's subgroups can be wider than 32. The choice is made when the WGSL is generated, as in OneSweep: support subgroups wider than 32 (AMD RDNA wave64) #75.wideSubgroupsmoves from OneSweep toBasePrimitive.WLMSis now one template built on these helpers, instead of separate 32-bit and wide copies.Verification:
Generated by Claude Code