[PATCH] D148728: [Support][Parallel] Add sequential mode to TaskGroup::spawn().

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 10:21:11 PDT 2023


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

This patch allows to specify that some part of tasks should be
done in sequential order. It makes it possible to not use
condition operator for separating sequential tasks:

TaskGroup tg;
for () {

  if(condition)      ==>   tg.spawn(condition)
    tg.execute();
  else
    tg.spawn();

}

It also prevents execution on main thread. Which allows adding
checks for getThreadIndex() function discussed in D142318 <https://reviews.llvm.org/D142318>.

The patch also replaces std::stack with std::queue in the
ThreadPoolExecutor to have natural execution order in case
(parallel::strategy.ThreadsRequested == 1).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148728

Files:
  lld/ELF/OutputSections.cpp
  lld/ELF/Relocations.cpp
  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: D148728.515012.patch
Type: text/x-patch
Size: 6751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230419/e49788f3/attachment.bin>


More information about the llvm-commits mailing list