Mojo trait
MHAMask
The MHAMask trait describes masks for MHA kernels, such as the causal mask.
Implemented traits
AnyType
,
UnknownDestructibility
Methods
mask
mask[type: DType, width: Int, //, *, element_type: DType = uint32](self: _Self, coord: Index[4, element_type=element_type], score_vec: SIMD[type, width]) -> SIMD[type, width]
Return mask vector at given coordinates.
Arguments:
coord is (seq_id, head, q_idx, k_idx)
score_vec is at coord
of the score matrix
The functor could capture an mask tensor and add to the score e.g. Replit.
status
status[*, element_type: DType = uint32](self: _Self, tile_offset: Index[2, element_type=element_type], tile_size: Index[2, element_type=element_type]) -> TileMaskStatus
Given a tile's index range, return its masking status.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!