[Openmp-commits] [openmp] Draft: [OpenMP] Fix td_tdg_task_id underflow with taskloop and taskgraph (PR #150877)

via Openmp-commits openmp-commits at lists.llvm.org
Wed Jul 30 01:02:28 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- openmp/runtime/src/kmp.h openmp/runtime/src/kmp_tasking.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp
index b1b79d635..74e43de7f 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -4436,7 +4436,8 @@ kmp_task_t *__kmp_task_dup_alloc(kmp_info_t *thread, kmp_task_t *task_src
 #if OMPX_TASKGRAPH
   if (taskdata->is_taskgraph && !taskloop_recur &&
       __kmp_tdg_is_recording(taskdata_src->tdg->tdg_status))
-    taskdata->td_tdg_task_id = KMP_ATOMIC_INC(&taskdata_src->tdg->__kmp_tdg_task_id_next);
+    taskdata->td_tdg_task_id =
+        KMP_ATOMIC_INC(&taskdata_src->tdg->__kmp_tdg_task_id_next);
 #endif
   taskdata->td_task_id = KMP_GEN_TASK_ID();
   if (task->shareds != NULL) { // need setup shareds pointer
@@ -4951,10 +4952,10 @@ static void __kmp_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
     __kmpc_taskgroup(loc, gtid);
   }
 
-/* #if OMPX_TASKGRAPH */
-/*   if (taskdata->is_taskgraph) */
-/*     KMP_ATOMIC_DEC(&__kmp_tdg_task_id); */
-/* #endif */
+  /* #if OMPX_TASKGRAPH */
+  /*   if (taskdata->is_taskgraph) */
+  /*     KMP_ATOMIC_DEC(&__kmp_tdg_task_id); */
+  /* #endif */
   // =========================================================================
   // calculate loop parameters
   kmp_taskloop_bounds_t task_bounds(task, lb, ub);

``````````

</details>


https://github.com/llvm/llvm-project/pull/150877


More information about the Openmp-commits mailing list