Skip to content

Commit ef922c6

Browse files
committed
[OpenMP][FIX] Query proper thread ID information to support nesting
The OpenMP thread ID is not the hardware thread ID if we have nesting. We need to ask the runtime properly to ensure correct results. Note that the loop interface is going to change soon so we do not adjust it now but simply ignore the extra argument. Reviewed By: tianshilei1992 Differential Revision: https://reviews.llvm.org/D111950
1 parent 4c88341 commit ef922c6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

openmp/libomptarget/DeviceRTL/src/Workshare.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,10 @@ template <typename T, typename ST> struct omptarget_nvptx_LoopSupport {
114114
////////////////////////////////////////////////////////////////////////////////
115115
// Support for Static Init
116116

117-
static void for_static_init(int32_t gtid, int32_t schedtype,
117+
static void for_static_init(int32_t, int32_t schedtype,
118118
int32_t *plastiter, T *plower, T *pupper,
119119
ST *pstride, ST chunk, bool IsSPMDExecutionMode) {
120-
// When IsRuntimeUninitialized is true, we assume that the caller is
121-
// in an L0 parallel region and that all worker threads participate.
122-
123-
// Assume we are in teams region or that we use a single block
124-
// per target region
120+
int32_t gtid = omp_get_thread_num();
125121
int numberOfActiveOMPThreads = omp_get_num_threads();
126122

127123
// All warps that are in excess of the maximum requested, do

0 commit comments

Comments
 (0)