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
calculate_warp_offset
def calculate_warp_offset[MaskType: DType](state: Bool) -> Tuple[UInt64, UInt64]
Computes warp-level write counts and per-thread offsets using warp voting.
Given a per-thread boolean vote, returns the total number of threads in the warp that voted true and this thread's write offset among the preceding threads that voted true.
Parameters:
- MaskType (
DType): Unsigned integer DType wide enough to hold one bit per thread in the warp.
Args:
- state (
Bool): Per-thread boolean indicating whether this thread contributes a write.
Returns:
Tuple[UInt64, UInt64]: A tuple of (writes, offset) where writes is the total number of threads
in the warp that voted true, and offset is the number of preceding
threads (lower thread IDs) that voted true.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!