IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo struct

CoopRow

struct CoopRow[group_size: Int]

Tracks one block's position and phase within a row group.

Fields​

  • ​rank (Int):

Implemented traits​

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable

Methods​

__init__​

def __init__(row: Int, rank: Int) -> Self

sync​

def sync(mut self, workspace: Pointer[Int32, MutAnyOrigin])

Makes each block's preceding global writes visible to its peers.

gather​

def gather[width: Int](mut self, workspace: Pointer[Int32, MutAnyOrigin], table: Pointer[Float32, address_space=AddressSpace.SHARED], vals: SIMD[.float32, width])

Publishes vals and copies each rank's slot into shared memory.

Calls alternate between two slot sets so a faster block cannot overwrite data that its peers are still reading. table[r * width + j] receives lane j from rank r.

combine​

def combine[width: Int, combine_fn: def[dtype: DType, width: SIMDLength](SIMD[dtype, width], SIMD[dtype, width]) capturing thin -> SIMD[dtype, width]](mut self, workspace: Pointer[Int32, MutAnyOrigin], table: Pointer[Float32, address_space=AddressSpace.SHARED], vals: SIMD[.float32, width]) -> SIMD[.float32, width]

Combines block-reduced vectors in rank order.

Every block returns bit-identical values and may safely branch on the result.

Returns:

SIMD[.float32, width]

Was this page helpful?