[Openmp-commits] [PATCH] D94745: [OpenMP][WIP] Build the deviceRTLs with OpenMP instead of target dependent language - NOT FOR REVIEW
Jon Chesterfield via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Jan 20 14:44:20 PST 2021
JonChesterfield added inline comments.
================
Comment at: openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h:154
-template <typename T> INLINE T __kmpc_atomic_inc(T *address, T val) {
- return atomicInc(address, val);
+template <typename T> INLINE T __kmpc_atomic_inc(T *Address, T Val) {
+ T Old;
----------------
JonChesterfield wrote:
> I can't remember what the semantics of atomic_inc are but I do remember them being surprising.
>
> In general I prefer the clang intrinsics, but if this generates the same IR then so be it.
>
> What IR does it emit? Will be easier to tell if we land D95093 first as we can llvm-dis target_impl.bc, instead of scraping together examples of the calls from various places.
> I can't remember what the semantics of atomic_inc are but I do remember them being surprising.
>From docs, writes ((old >= val) ? 0 : (old+1)) to memory and returns old. I would guess that needs to be spelled
*Address = (Old >= Val) ? 0 : (Old+1). We'd also need the *Address read and the *Address store to occur atomically for this to be correct.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94745/new/
https://reviews.llvm.org/D94745
More information about the Openmp-commits
mailing list