[Openmp-commits] [openmp] [OpenMP] Adding a throttling threshold to bound dependent tasking mem… (PR #82274)

via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 23 09:22:07 PST 2024


================
@@ -438,10 +438,9 @@ static kmp_int32 __kmp_push_priority_task(kmp_int32 gtid, kmp_info_t *thread,
 
   __kmp_acquire_bootstrap_lock(&thread_data->td.td_deque_lock);
   // Check if deque is full
-  if (TCR_4(thread_data->td.td_deque_ntasks) >=
-      TASK_DEQUE_SIZE(thread_data->td)) {
-    if (__kmp_enable_task_throttling &&
-        __kmp_task_is_allowed(gtid, __kmp_task_stealing_constraint, taskdata,
+  if (__kmp_enable_task_throttling && TCR_4(thread_data->td.td_deque_ntasks) >=
+                                          __kmp_task_maximum_ready_per_thread) {
+    if (__kmp_task_is_allowed(gtid, __kmp_task_stealing_constraint, taskdata,
----------------
jprotze wrote:

**Performance**
An alternative approach might be to only count tasks enqueued/added to the dependence graph, not tasks generated/freed. This would resolve the performance impact for if0 tasks.

**Unit Tests**
Make the define a cmake option (check for example `LIBOMP_OMPT_SUPPORT`). Follow the flow of LIBOMP_OMPT_SUPPORT to the tests. Finally the option ends up as a lit feature and we can use it as `// REQUIRES: ompt` in ompt tests.

**Broken Logic**
I think, the function should still consider the global task limit and not enqueue the task if the limit is reached.

PS: it would be better to keep general discussion at the global level and not in a code comment ;)

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


More information about the Openmp-commits mailing list