[PATCH] D131247: [WIP][ELF] Parallelize writes of different OutputSections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 01:24:15 PDT 2022


MaskRay created this revision.
MaskRay added reviewers: andrewng, ikudrin, peter.smith.
Herald added subscribers: StephenFan, hiraditya, kristof.beyls, arichardson, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We currently process one OutputSection at a time and for each OutputSection
write contained input sections in parallel. This strategy does not leverage
threads well. Instead, parallelize writes of different OutputSections.

- Move llvm::parallel::detail::TaskGroup to llvm::parallel::TaskGroup
- Add llvm::asyncParallelFor. We also make TaskSize a paramemter. The default often leads to inferior sharding.
- Change writeSections to declare TaskGroup and pass it to writeTo.

Linking clang and chrome is 1.15x as fast.

WIP as some tests need investigation:

  Failed Tests (5):
    lld :: ELF/arm-thumb-interwork-notfunc.s
    lld :: ELF/common-archive-lookup.s
    lld :: ELF/hexagon-jump-error.s
    lld :: ELF/linkerscript/overlapping-sections.s
    lld :: ELF/ppc64-toc-relax-ifunc.s


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131247

Files:
  lld/ELF/OutputSections.cpp
  lld/ELF/OutputSections.h
  lld/ELF/Writer.cpp
  lld/test/ELF/arm-thumb-interwork-notfunc.s
  lld/test/ELF/hexagon-jump-error.s
  llvm/include/llvm/Support/Parallel.h
  llvm/lib/Support/Parallel.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131247.450253.patch
Type: text/x-patch
Size: 10437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220805/c4b9d085/attachment-0001.bin>


More information about the llvm-commits mailing list