IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

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 be DType.uint32 or DType.uint64).

Args:

  • val (Bool): The boolean vote.

Returns:

Scalar[ret_type]: A mask containing the vote of all threads in the warp.

Was this page helpful?