Mojo function
sum
sum(val: SIMD[dtype, size]) -> Scalar[dtype]
Computes the sum of values across all lanes in a warp.
This is a convenience wrapper around lane_group_sum_and_broadcast that operates on the entire warp. It performs a parallel reduction using warp shuffle operations to find the global sum across all lanes in the warp.
Args:
- val (
SIMD): The SIMD value to reduce. Each lane contributes its value to the sum.
Returns:
Scalar: The scalar sum of values across all lanes in the warp.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!