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 function
zero_output
def zero_output[c_type: DType, *, output_tile_shape: Coord[output_tile_shape.element_types], c_stride: Int, c_N: Int, ComputeFnType: ElementwiseComputeFn = inflated$def[identity_compute_fn[_, _, _, _, _]], has_compute_fn: Bool = False](c_ptr: Pointer[Scalar[c_type], MutAnyOrigin], coord: Tuple[UInt32, UInt32], group_end_idx: UInt32, compute_fn: ComputeFnType)
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 (
Coord[output_tile_shape.element_types]): 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 offsetcoord[0]to mask out-of-bound stores. - ComputeFnType (
ElementwiseComputeFn): Type ofcompute_fn. - has_compute_fn (
Bool): Whethercompute_fnmaps the zeros before they are stored, as it would an unfused zero output (defaults to False).
Args:
- c_ptr (
Pointer[Scalar[c_type], MutAnyOrigin]): Base pointer to the C output tensor in global memory. - coord (
Tuple[UInt32, UInt32]):(m, n)element coordinates of the output tile origin, wherecoord[0]is the column offset andcoord[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. - compute_fn (
ComputeFnType): Maps each zero vector whenhas_compute_fnis set.