Mojo function
partial_simd_load
partial_simd_load[type: DType, //, width: Int](storage: UnsafePointer[SIMD[type, 1], address_space, exclusive, alignment], lbound: Int, rbound: Int, pad_value: SIMD[type, 1]) -> SIMD[$0, $1]
Loads a vector with dynamic bound.
Out of bound data will be filled with pad value. Data is valid if lbound <= idx < rbound for idx from 0 to (simd_width-1). For example:
addr 0 1 2 3
data x 42 43 x
partial_simd_load[4](addr0, 1, 3) #gives [0 42 43 0]
addr 0 1 2 3
data x 42 43 x
partial_simd_load[4](addr0, 1, 3) #gives [0 42 43 0]
Parameters:
- βtype (
DType
): The DType of storage. - βwidth (
Int
): The system simd vector size.
Args:
- βstorage (
UnsafePointer[SIMD[type, 1], address_space, exclusive, alignment]
): Pointer to the address to perform load. - βlbound (
Int
): Lower bound of valid index within simd (inclusive). - βrbound (
Int
): Upper bound of valid index within simd (non-inclusive). - βpad_value (
SIMD[type, 1]
): Value to fill for out of bound indices.
Returns:
The SIMD vector loaded and zero-filled.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
π What went wrong?