[Openmp-commits] [openmp] [openmp] Segfaults/assertion errors on certain omp statements after calling `omp_pause_resource_all(omp_pause_hard)` (PR #154204)
via Openmp-commits
openmp-commits at lists.llvm.org
Fri Sep 5 07:20:33 PDT 2025
================
@@ -8343,6 +8345,10 @@ void __kmp_cleanup(void) {
__kmpc_destroy_allocator(KMP_GTID_SHUTDOWN, __kmp_def_allocator);
__kmp_def_allocator = omp_default_mem_alloc;
+#ifdef KMP_TDATA_GTID
+ /*reset __kmp_gtid to initial value*/
+ __kmp_gtid = KMP_GTID_DNE;
+#endif
----------------
jprotze wrote:
When you look at code generated for an OpenMP program (IR or disassembled objdump), you will see that each function that contains `__kmpc*` calls initially gets the gtid using `__kmpc_global_thread_num`, which triggers serial initialization. This gtid is then passed to many `__kmpc` calls. You already ran into the issue that `__kmpc_push_num_threads` assumes that serial initialization has happened. I think, that the runtime must be in serial initialized state after omp_pause_resource[_all] to not break the assumptions of compiler+runtime implementation.
https://github.com/llvm/llvm-project/pull/154204
More information about the Openmp-commits
mailing list