For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
vote
def vote[ret_type: DType](val: Bool) -> Scalar[ret_type]
Creates a 32 or 64 bit mask among all threads in the warp, where each bit is set to 1 if the corresponding thread voted True, and 0 otherwise.
This function takes a boolean value which represents the corresponding threads vote.
NVIDIA supports 32-bit masks; AMD supports 32- and 64-bit masks; Apple
Silicon (a 32-lane SIMD-group) supports 32-bit masks, and also accepts a
DType.uint64 return whose upper 32 bits are always zero.
Parameters:
- ret_type (
DType): Return type for the mask (must beDType.uint32orDType.uint64).
Args:
- val (
Bool): The boolean vote.
Returns:
Scalar[ret_type]: A mask containing the vote of all threads in the warp.