For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
mask_select8
def mask_select8[byte_idx: Int](s0: Float32, s1: Float32, s2: Float32, s3: Float32, s4: Float32, s5: Float32, s6: Float32, s7: Float32, mask_bits: UInt32) -> _RegisterPackType[Float32, Float32, Float32, Float32, Float32, Float32, Float32, Float32]
Masks 8 contiguous scores against one byte of a 32-column bitmask.
Lane j keeps its score if bit 8*byte_idx + j of mask_bits is set,
otherwise it becomes MASK_VALUE (-10000). The 8 and/setp/selp are
confined to a single opaque PTX block so the bit-extraction sits adjacent to
the selects: the predicate live-set stays bounded (avoiding the wide
up-front bit pre-extraction that spills) and the shape stays R2P-eligible.
Parameters:
- βbyte_idx (
Int): Which mask byte to apply (0..3), i.e. columns8*byte_idx .. 8*byte_idx + 7.
Args:
- βs0 (
Float32): Already-scaled score for lane 0. - βs1 (
Float32): Already-scaled score for lane 1. - βs2 (
Float32): Already-scaled score for lane 2. - βs3 (
Float32): Already-scaled score for lane 3. - βs4 (
Float32): Already-scaled score for lane 4. - βs5 (
Float32): Already-scaled score for lane 5. - βs6 (
Float32): Already-scaled score for lane 6. - βs7 (
Float32): Already-scaled score for lane 7. - βmask_bits (
UInt32): Packed 32-column visibility mask.
Returns:
_RegisterPackType[Float32, Float32, Float32, Float32, Float32, Float32, Float32, Float32]: The 8 masked scores, register-packed (index [0] .. [7]).
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!