Mojo function
store_volatile
store_volatile[type: DType, //, memory: Bool = True](ptr: UnsafePointer[SIMD[type, 1], address_space=address_space, alignment=alignment, mut=mut, origin=origin], value: SIMD[type, 1])
Performs a volatile store operation that cannot be optimized away.
This function guarantees that the store operation will be performed exactly as specified, without being reordered or optimized away by the compiler.
Note: - Only supported on NVIDIA GPUs. - Maps directly to PTX st.volatile instruction. - Prevents compiler optimization of the store operation. - Useful for memory-mapped I/O or synchronization primitives. - May have performance implications compared to regular stores.
Parameters:
- type (
DType
): The data type to store. - memory (
Bool
): Whether to include memory side effects in constraints (default: True).
Args:
- ptr (
UnsafePointer[SIMD[type, 1], address_space=address_space, alignment=alignment, mut=mut, origin=origin]
): Pointer to the memory location to store to. - value (
SIMD[type, 1]
): Value to store.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!