Skip to main content
Log in

Mojo function

ldg

ldg[type: DType, //, width: Int = 1, *, alignment: Int = Int(alignof[::AnyType,__mlir_type.!kgen.target]())](x: UnsafePointer[SIMD[type, 1]]) -> SIMD[type, width]

Load a register variable from global state space via non-coherent cache.

This function is used to load a register variable from the global state space through a non-coherent cache. The type of the data to be loaded must be numeric.

Parameters:

  • type (DType): The type of the data to be loaded.
  • width (Int): The width of the SIMD vector to load.
  • alignment (Int): The alignment of the data in bytes. Defaults to the alignment of the type.

Returns:

Scalar[type]: The loaded register variable.