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
min
def min[dtype: DType, width: SIMDLength, //, *, block_size: Int, broadcast: Bool = True](val: SIMD[dtype, width]) -> SIMD[dtype, width]
Computes the minimum value across all threads in a block.
Performs a parallel reduction using warp-level operations and shared memory to find the global minimum across all threads in the block.
Parameters:
- βdtype (
DType): The data type of the SIMD elements. - βwidth (
SIMDLength): The number of elements in each SIMD vector. - βblock_size (
Int): The total number of threads in the block. - βbroadcast (
Bool): If True, the final minimum is broadcast to all threads in the block. If False, only the first thread will have the complete min.
Args:
- βval (
SIMD[dtype, width]): The SIMD value to reduce. Each thread contributes its value to find the minimum.
Returns:
SIMD[dtype, width]: If broadcast is True, each thread in the block will receive the minimum
value across the entire block. Otherwise, only the first thread will
have the complete result.
def min[dtype: DType, width: SIMDLength, //, *, block_dim_x: Int, block_dim_y: Int, block_dim_z: Int = Int(1), broadcast: Bool = True](val: SIMD[dtype, width]) -> SIMD[dtype, width]
Computes the minimum value across all threads in a multi-dimensional block.
Performs a parallel reduction using warp-level operations and shared memory
to find the global minimum across all threads in the block. Thread IDs are
linearized in row-major order: x + y * dim_x + z * dim_x * dim_y.
Parameters:
- βdtype (
DType): The data type of the SIMD elements. - βwidth (
SIMDLength): The number of elements in each SIMD vector. - βblock_dim_x (
Int): The number of threads along the X dimension. - βblock_dim_y (
Int): The number of threads along the Y dimension. - βblock_dim_z (
Int): The number of threads along the Z dimension (default: 1). - βbroadcast (
Bool): If True, the final minimum is broadcast to all threads in the block. If False, only the first thread will have the complete min.
Args:
- βval (
SIMD[dtype, width]): The SIMD value to reduce. Each thread contributes its value to find the minimum.
Returns:
SIMD[dtype, width]: If broadcast is True, each thread in the block will receive the minimum
value across the entire block. Otherwise, only the first thread will
have the complete result.