[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

GitOrigin-RevId: ef922c692fdb971497d79cc8fa6b9d221733db3d
diff --git a/libomptarget/DeviceRTL/src/Workshare.cpp b/libomptarget/DeviceRTL/src/Workshare.cpp
index 071702e..89c10b1 100644
--- a/libomptarget/DeviceRTL/src/Workshare.cpp
+++ b/libomptarget/DeviceRTL/src/Workshare.cpp
@@ -114,14 +114,10 @@
   ////////////////////////////////////////////////////////////////////////////////
   // Support for Static Init
 
-  static void for_static_init(int32_t gtid, int32_t schedtype,
+  static void for_static_init(int32_t, int32_t schedtype,
                               int32_t *plastiter, T *plower, T *pupper,
                               ST *pstride, ST chunk, bool IsSPMDExecutionMode) {
-    // When IsRuntimeUninitialized is true, we assume that the caller is
-    // in an L0 parallel region and that all worker threads participate.
-
-    // Assume we are in teams region or that we use a single block
-    // per target region
+    int32_t gtid = omp_get_thread_num();
     int numberOfActiveOMPThreads = omp_get_num_threads();
 
     // All warps that are in excess of the maximum requested, do