Skip to main content
Log in

Mojo function

prefetch

prefetch[type: DType, //, params: PrefetchOptions = {PrefetchRW(0), PrefetchLocality(3), PrefetchCache(1)}](addr: UnsafePointer[SIMD[type, 1], address_space=address_space, alignment=alignment, mut=mut, origin=origin])

Prefetches an instruction or data into cache before it is used.

The prefetch function provides prefetching hints for the target to prefetch instruction or data into cache before they are used.

Parameters:

  • type (DType): The DType of value stored in addr.
  • params (PrefetchOptions): Configuration options for the prefect intrinsic.

Args:

  • addr (UnsafePointer[SIMD[type, 1], address_space=address_space, alignment=alignment, mut=mut, origin=origin]): The data pointer to prefetch.