IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo function

zero_output

def zero_output[c_type: DType, *, output_tile_shape: IndexList[Int(2)], c_stride: Int, c_N: Int](c_ptr: Pointer[Scalar[c_type], MutAnyOrigin, _safe=False], coord: Tuple[UInt32, UInt32], group_end_idx: UInt32)

Zero-fills an output tile for skipped or invalid expert assignments.

Each thread stores a SIMD vector of zeros per row across the output tile width, masking out threads and rows that fall outside the valid tile or group boundary.

Parameters:

  • ​c_type (DType): Element type of the C output tensor.
  • ​output_tile_shape (IndexList[Int(2)]): Tile shape [rows, cols] of the output region to zero-fill, where index 0 bounds the row count and index 1 bounds the column count.
  • ​c_stride (Int): Row stride of the C output tensor in elements; the store pointer advances by this amount per row.
  • ​c_N (Int): Total width of the C output tensor in elements; bounds the column offset coord[0] to mask out-of-bound stores.

Args:

  • ​c_ptr (Pointer[Scalar[c_type], MutAnyOrigin, _safe=False]): Base pointer to the C output tensor in global memory.
  • ​coord (Tuple[UInt32, UInt32]): (m, n) element coordinates of the output tile origin, where coord[0] is the column offset and coord[1] is the row offset.
  • ​group_end_idx (UInt32): Exclusive end of the current group's valid row range; bounds the number of rows zeroed.