Mojo function
broadcast
broadcast[type: DType, width: Int, //, *, block_size: Int](val: SIMD[type, width], src_thread: UInt = UInt(0)) -> SIMD[type, width]
Broadcasts a value from a source thread to all threads in a block.
This function takes a SIMD value from the specified source thread and copies it to all other threads in the block, effectively broadcasting the value across the entire block.
Parameters:
- type (
DType
): The data type of the SIMD elements. - width (
Int
): The number of elements in each SIMD vector. - block_size (
Int
): The total number of threads in the block.
Args:
- val (
SIMD[type, width]
): The SIMD value to broadcast from the source thread. - src_thread (
UInt
): The thread ID of the source thread (default: 0).
Returns:
A SIMD value where all threads contain a copy of the input value from the source thread.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!