[PATCH] D148984: [Support][Parallel] Change check for nested TaskGroups.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 22 02:19:45 PDT 2023


avl created this revision.
avl added reviewers: MaskRay, andrewng, dexonsmith.
Herald added a subscriber: hiraditya.
Herald added a project: All.
avl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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;

Pool.async(Fn);
Pool.async(Fn);

Pool.wait();

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 avoid this.

This patch is a followup of discussion from D142318 <https://reviews.llvm.org/D142318>

Depends on D148916 <https://reviews.llvm.org/D148916>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148984

Files:
  llvm/include/llvm/Support/Parallel.h
  llvm/lib/Support/Parallel.cpp
  llvm/unittests/Support/ParallelTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148984.516046.patch
Type: text/x-patch
Size: 3640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230422/f3eb002b/attachment.bin>


More information about the llvm-commits mailing list