[OpenMP] Added memory scope to atomic::inc API and used the device scope in reduction.
authorDhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>
Fri, 30 Jun 2023 18:02:12 +0000 (14:02 -0400)
committerDhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>
Fri, 30 Jun 2023 19:05:01 +0000 (15:05 -0400)
commit6a1d1f7eefe81faa1f7c6c47e8b9da0bfeb8c2e8
tree5a980932d23fa84fbba1327814455d61fc04155b
parent917eddfdcb15bddf67a54ede1f1643d5fc83628d
[OpenMP] Added memory scope to atomic::inc API and used the device scope in reduction.

With https://reviews.llvm.org/D137524, memory scope and ordering
attributes are being used to generate the required instructions for
atomic inc/dec on AMDGPU. This patch adds the memory scope attribute to
the atomic::inc API and uses the device scope in reduction. Without
the device scope in atomic_inc, the default system scope leads to
unnecessary L2 write-backs/invalidates.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D154172
openmp/libomptarget/DeviceRTL/include/Synchronization.h
openmp/libomptarget/DeviceRTL/src/Reduction.cpp
openmp/libomptarget/DeviceRTL/src/Synchronization.cpp