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 module

masked_load_apple

Apple M5 (AGX3) hardware edge-masked vector loads.

build_edge_mask computes a per-lane in-bounds mask; the *edge_masked_load family does a predicated vector load that zeroes masked-off lanes, letting a kernel vectorize a boundary tile without a scalar remainder loop or an out-of-bounds read. The three entry points differ only in address-space resolution:

  • edge_masked_load — the pointer's own space (must be GLOBAL or SHARED).
  • gmem_edge_masked_load — reinterprets any pointer as device (global).
  • smem_edge_masked_load — reinterprets any pointer as threadgroup (shared).

Apple M5 only: the AGX3 intrinsics don't exist elsewhere, so callers dispatch on compute_capability() == 5.

Functions

  • build_edge_mask: Computes the per-lane edge mask for a vector access (Apple M5 only).
  • edge_masked_load: Loads a predicated (edge-masked) vector in the pointer's own address space (Apple M5 only).
  • gmem_edge_masked_load: Loads an edge-masked vector, treating ptr as device (global) memory (Apple M5 only).
  • smem_edge_masked_load: Loads an edge-masked vector, treating ptr as threadgroup (shared) memory (Apple M5 only).