mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 03:56:16 +08:00
[libc] Add intrinsic for thread fence to the atomic support
This function mimics the std::atomic_thread_fence function from <atomic>. This has no uses in source currently, but this will be used by the proposed RPC client for the GPU mode support. There is varying support for direct memory ordering for the GPU atomics on shared memory resources. So the implementation will use relaxed atomics and explicit memory fences. Some additional work may need to be done to map this to `NVPTX` system level fences. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D145608
This commit is contained in:
@@ -92,6 +92,11 @@ public:
|
||||
void set(T rhs) { val = rhs; }
|
||||
};
|
||||
|
||||
// Issue a thread fence with the given memory ordering.
|
||||
LIBC_INLINE void atomic_thread_fence(MemoryOrder mem_ord) {
|
||||
__atomic_thread_fence(int(mem_ord));
|
||||
}
|
||||
|
||||
} // namespace cpp
|
||||
} // namespace __llvm_libc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user