[Openmp-commits] [PATCH] D99020: [OpenMP] Disable hidden helper task by default

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Mar 21 14:23:17 PDT 2021


tianshilei1992 updated this revision to Diff 332177.
tianshilei1992 added a comment.

update tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99020/new/

https://reviews.llvm.org/D99020

Files:
  openmp/runtime/src/kmp_runtime.cpp
  openmp/runtime/src/kmp_settings.cpp
  openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp
  openmp/runtime/test/worksharing/for/kmp_sch_simd_guided.c


Index: openmp/runtime/test/worksharing/for/kmp_sch_simd_guided.c
===================================================================
--- openmp/runtime/test/worksharing/for/kmp_sch_simd_guided.c
+++ openmp/runtime/test/worksharing/for/kmp_sch_simd_guided.c
@@ -48,9 +48,6 @@
 // End of definitions copied from OpenMP RTL.
 // ---------------------------------------------------------------------------
 static id loc = {0, 2, 0, 0, ";file;func;0;0;;"};
-// This variable is defined in OpenMP RTL but we can't have it exposed so we
-// need to redefine it here.
-static int __kmp_hidden_helper_threads_num = 8;
 
 // ---------------------------------------------------------------------------
 int run_loop_64(i64 loop_lb, i64 loop_ub, i64 loop_st, int loop_chunk) {
@@ -62,9 +59,6 @@
   int rc;
   int tid = omp_get_thread_num();
   int gtid = tid;
-  if (gtid) {
-    gtid += __kmp_hidden_helper_threads_num;
-  }
   int last;
 #if DEBUG
   printf("run_loop_<%d>(lb=%d, ub=%d, st=%d, ch=%d)\n",
@@ -217,9 +211,6 @@
   int rc;
   int tid = omp_get_thread_num();
   int gtid = tid;
-  if (gtid) {
-    gtid += __kmp_hidden_helper_threads_num;
-  }
   int last;
 #if DEBUG
   printf("run_loop_<%d>(lb=%d, ub=%d, st=%d, ch=%d)\n",
@@ -407,13 +398,6 @@
 // ---------------------------------------------------------------------------
 int main()
 {
-  {
-    const char *env = getenv("LIBOMP_NUM_HIDDEN_HELPER_THREADS");
-    if (env) {
-      __kmp_hidden_helper_threads_num = atoi(env);
-    }
-  }
-
   int n, err = 0;
   for (n = 1; n <= 4; ++ n) {
     err += run_32(n);
Index: openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp
===================================================================
--- openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp
+++ openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp
@@ -1,4 +1,5 @@
 // RUN: %libomp-cxx-compile-and-run
+// XFAIL: *
 
 /*
  * This test aims to check whether hidden helper thread has right gtid. We also
Index: openmp/runtime/src/kmp_settings.cpp
===================================================================
--- openmp/runtime/src/kmp_settings.cpp
+++ openmp/runtime/src/kmp_settings.cpp
@@ -1220,6 +1220,12 @@
          ("__kmp_stg_parse_use_hidden_helper: Disable hidden helper task on "
           "non-Linux platform although it is enabled by user explicitly.\n"));
 #endif
+  // Set the number to 0 if hidden helper task is disabled
+  if (__kmp_enable_hidden_helper == FALSE) {
+    __kmp_hidden_helper_threads_num = 0;
+  } else {
+    __kmp_hidden_helper_threads_num = 8;
+  }
 } // __kmp_stg_parse_use_hidden_helper
 
 static void __kmp_stg_print_use_hidden_helper(kmp_str_buf_t *buffer,
Index: openmp/runtime/src/kmp_runtime.cpp
===================================================================
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -8645,13 +8645,9 @@
 // Globals and functions for hidden helper task
 kmp_info_t **__kmp_hidden_helper_threads;
 kmp_info_t *__kmp_hidden_helper_main_thread;
-kmp_int32 __kmp_hidden_helper_threads_num = 8;
+kmp_int32 __kmp_hidden_helper_threads_num = 0;
 std::atomic<kmp_int32> __kmp_unexecuted_hidden_helper_tasks;
-#if KMP_OS_LINUX
-kmp_int32 __kmp_enable_hidden_helper = TRUE;
-#else
 kmp_int32 __kmp_enable_hidden_helper = FALSE;
-#endif
 
 namespace {
 std::atomic<kmp_int32> __kmp_hit_hidden_helper_threads_num;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99020.332177.patch
Type: text/x-patch
Size: 3384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210321/e5a9b147/attachment.bin>


More information about the Openmp-commits mailing list