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

build_edge_mask

def build_edge_mask(index: Int32, lower_bound: Int32, upper_bound: Int32) -> Int16

Computes the per-lane edge mask for a vector access (Apple M5 only).

Bit i of the result is set when element index + i lies in [lower_bound, upper_bound). Pass it as an *edge_masked_load mask. Emits the AGX3 edgecheck instruction.

Args:

  • โ€‹index (Int32): Linear element index of lane 0.
  • โ€‹lower_bound (Int32): Inclusive lower bound of the valid range.
  • โ€‹upper_bound (Int32): Exclusive upper bound of the valid range.

Returns:

Int16: A 16-bit per-lane mask (up to 4 lanes).