[OPENMP][NVPTX]Fix barriers and parallel level counters, NFC.
authorAlexey Bataev <a.bataev@hotmail.com>
Wed, 22 May 2019 19:50:32 +0000 (19:50 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Wed, 22 May 2019 19:50:32 +0000 (19:50 +0000)
commit9d9e406684de7ae2da5c3ee2a45eca80eb0e3534
tree7e13ef39b99f69183828d7d240c9666c2439be67
parentbb7357750e7f6035313ccc300b6d9e1b0ffd6b19
[OPENMP][NVPTX]Fix barriers and parallel level counters, NFC.

Summary:
Parallel level counter should be volatile to prevent some dangerous
optimiations by the ptxas. Otherwise, ptxas optimizations lead to
undefined behaviour in some cases.
Also, use __threadfence() for #pragma omp flush and if the barrier
should not be used (we have only one thread in the team), still perform
flush operation since the standard requires implicit flush when
executing barriers.

Reviewers: gtbercea, kkwli0, grokos

Subscribers: guansong, jfb, jdoerfert, openmp-commits, caomhin

Tags: #openmp

Differential Revision: https://reviews.llvm.org/D62199

llvm-svn: 361421
openmp/libomptarget/deviceRTLs/nvptx/src/omp_data.cu
openmp/libomptarget/deviceRTLs/nvptx/src/omptarget-nvptx.h
openmp/libomptarget/deviceRTLs/nvptx/src/sync.cu