[all-commits] [llvm/llvm-project] 06b617: [Support][Parallel] Change check for nested TaskGr...

avl-llvm via All-commits all-commits at lists.llvm.org
Thu May 4 02:32:33 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 06b617064a997574df409c7d846b6f6b492f5124
  Author: Alexey Lapshin <a.v.lapshin at mail.ru>
  Date:   2023-05-04 (Thu, 04 May 2023)

  Changed paths:
    M llvm/include/llvm/Support/Parallel.h
    M llvm/lib/Support/Parallel.cpp
    M llvm/unittests/Support/ParallelTest.cpp

  Log Message:
  [Support][Parallel] Change check for nested TaskGroups.

This patch changes check for nested TaskGroups so that it allows
parallel execution for TaskGroups. Following pattern would not work
parallelly with current check:

std::function<void()> Fn = [&]() {
  parallel::TaskGroup tg;

  tg.spawn([&]() { });

ThreadPool Pool;



One of the TaskGroup would work sequentially as current check
verifies overall number of TaskGroup. Two not nested
TaskGroups can work parallelly but current check prevents this.

Also this patch avoids parallel mode for TaskGroup
in parallel::strategy.ThreadsRequested == 1 case.

This patch is a followup of discussion from D142318

Differential Revision: https://reviews.llvm.org/D148984

More information about the All-commits mailing list