Mojo function
store_volatile
store_volatile[dtype: DType, //, memory: Bool = True](ptr: UnsafePointer[Scalar[dtype], address_space=address_space, mut=mut, origin=origin], value: Scalar[dtype])
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:
- βdtype (
DType
): The data type to store. - βmemory (
Bool
): Whether to include memory side effects in constraints (default: True).
Args:
- βptr (
UnsafePointer
): Pointer to the memory location to store to. - βvalue (
Scalar
): Value to store.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!