[Openmp-commits] [openmp] d839839 - [OpenMP] Use TLS for gtid on Solaris (#138508)
via Openmp-commits
openmp-commits at lists.llvm.org
Tue May 6 00:11:47 PDT 2025
Author: Rainer Orth
Date: 2025-05-06T09:11:43+02:00
New Revision: d83983999d975357ada46d482c29b83fac41b90c
URL: https://github.com/llvm/llvm-project/commit/d83983999d975357ada46d482c29b83fac41b90c
DIFF: https://github.com/llvm/llvm-project/commit/d83983999d975357ada46d482c29b83fac41b90c.diff
LOG: [OpenMP] Use TLS for gtid on Solaris (#138508)
When running the `openmp` testsuite on Solaris/amd64, many tests `FAIL`
like
```
# | OMP: Error #11: Stack overflow detected for OpenMP thread #1
```
In a `Debug` build, I also get
```
# | Assertion failure at kmp_runtime.cpp(203): __kmp_gtid_get_specific() < 0 || __kmp_gtid_get_specific() == i.
```
Further investigation shows that just setting `__kmp_gtid_mode` to 3
massively reduces the number of failures.
Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.
Added:
Modified:
openmp/runtime/src/kmp_global.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/kmp_global.cpp b/openmp/runtime/src/kmp_global.cpp
index c3bc235a44fa3..87c0a66a16c0a 100644
--- a/openmp/runtime/src/kmp_global.cpp
+++ b/openmp/runtime/src/kmp_global.cpp
@@ -172,7 +172,7 @@ int __kmp_ncores = 0;
int __kmp_chunk = 0;
int __kmp_force_monotonic = 0;
int __kmp_abort_delay = 0;
-#if (KMP_OS_LINUX || KMP_OS_AIX) && defined(KMP_TDATA_GTID)
+#if (KMP_OS_LINUX || KMP_OS_AIX || KMP_OS_SOLARIS) && 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
More information about the Openmp-commits
mailing list