[Openmp-commits] [PATCH] D97329: [OpenMP] Fixed a crash when offloading to x86_64 with target nowait

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 23 12:45:10 PST 2021


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

PR#49334 reports a crash when offloading to x86_64 with `target nowait`,
which is caused by referencing a nullptr. The root cause of the issue is, when
pushing a hidden helper task in `__kmp_push_task`, it also maps the gtid to its
shadow gtid, which is wrong.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97329

Files:
  openmp/runtime/src/kmp_tasking.cpp


Index: openmp/runtime/src/kmp_tasking.cpp
===================================================================
--- openmp/runtime/src/kmp_tasking.cpp
+++ openmp/runtime/src/kmp_tasking.cpp
@@ -326,7 +326,8 @@
   kmp_info_t *thread = __kmp_threads[gtid];
   kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
 
-  if (taskdata->td_flags.hidden_helper) {
+  // We don't need to map to shadow gtid if it is already hidden helper thread
+  if (taskdata->td_flags.hidden_helper && !KMP_HIDDEN_HELPER_THREAD(gtid)) {
     gtid = KMP_GTID_TO_SHADOW_GTID(gtid);
     thread = __kmp_threads[gtid];
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97329.325880.patch
Type: text/x-patch
Size: 597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210223/404384da/attachment.bin>


More information about the Openmp-commits mailing list