Skip to content

Commit d839839

Browse files
authored
[OpenMP] Use TLS for gtid on Solaris (llvm#138508)
When running the `openmp` testsuite on Solaris/amd64, many tests `FAIL` like ``` # | OMP: Error rust-lang#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`.
1 parent ca59a2b commit d839839

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

openmp/runtime/src/kmp_global.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int __kmp_ncores = 0;
172172
int __kmp_chunk = 0;
173173
int __kmp_force_monotonic = 0;
174174
int __kmp_abort_delay = 0;
175-
#if (KMP_OS_LINUX || KMP_OS_AIX) && defined(KMP_TDATA_GTID)
175+
#if (KMP_OS_LINUX || KMP_OS_AIX || KMP_OS_SOLARIS) && defined(KMP_TDATA_GTID)
176176
int __kmp_gtid_mode = 3; /* use __declspec(thread) TLS to store gtid */
177177
int __kmp_adjust_gtid_mode = FALSE;
178178
#elif KMP_OS_WINDOWS

0 commit comments

Comments
 (0)