[Openmp-commits] [PATCH] D159316: [OpenMP] Change default gtid mode to 2 for darwin

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Aug 31 15:29:16 PDT 2023


tianshilei1992 created this revision.
tianshilei1992 added reviewers: tlwilmar, jlpeyton.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, jplehr, sstefan1.
Herald added a project: OpenMP.

On Darwin the default gtid mode is 0, which means it will be determined
based on number of threads. On my current Intel-based Mac, it is set to 1. On Windows,
the default value is 2. However, based on `openmp/runtime/src/kmp_settings.cpp:4168`,
both Darwin and Windows support mode 2. I'm not sure why on Darwin it is set to
0 while on Windows it is 2 at the first place. This patch changes the default
mode to 2 for Darwin as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159316

Files:
  openmp/runtime/src/kmp_global.cpp


Index: openmp/runtime/src/kmp_global.cpp
===================================================================
--- openmp/runtime/src/kmp_global.cpp
+++ openmp/runtime/src/kmp_global.cpp
@@ -175,7 +175,7 @@
 #if KMP_OS_LINUX && defined(KMP_TDATA_GTID)
 int __kmp_gtid_mode = 3; /* use __declspec(thread) TLS to store gtid */
 int __kmp_adjust_gtid_mode = FALSE;
-#elif KMP_OS_WINDOWS
+#elif KMP_OS_WINDOWS || KMP_OS_DARWIN
 int __kmp_gtid_mode = 2; /* use TLS functions to store gtid */
 int __kmp_adjust_gtid_mode = FALSE;
 #else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159316.555182.patch
Type: text/x-patch
Size: 529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230831/0bbe7e28/attachment.bin>


More information about the Openmp-commits mailing list