[libc] Add intrinsic for thread fence to the atomic support
authorJoseph Huber <jhuber6@vols.utk.edu>
Wed, 8 Mar 2023 21:17:14 +0000 (15:17 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Thu, 9 Mar 2023 12:36:54 +0000 (06:36 -0600)
commita9cb298b394034856f88aebe66523c4a61c0df2e
tree28b7525b3918f56a7940a13b33e02e2b81b7f126
parent8d4998b478028b08c6bc50a1b49573517a6e973c
[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
libc/src/__support/CPP/atomic.h