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
broadcast
def broadcast[val_type: DType, simd_width: SIMDLength, //](val: SIMD[val_type, simd_width]) -> SIMD[val_type, simd_width]
Broadcasts a SIMD value from lane 0 to all lanes in the warp.
This function takes a SIMD value from lane 0 and copies it to all other lanes in the warp, effectively broadcasting the value across the entire warp. This is useful for sharing data between threads in a warp without using shared memory.
Parameters:
- โval_type (
DType): The data type of the SIMD elements (e.g. float32, int32). - โsimd_width (
SIMDLength): The number of elements in the SIMD vector.
Args:
- โval (
SIMD[val_type, simd_width]): The SIMD value to broadcast from lane 0.
Returns:
SIMD[val_type, simd_width]: A SIMD value where all lanes contain a copy of the input value from lane 0.