[all-commits] [llvm/llvm-project] e6aebf: [ELF] Parallelize relocation scanning

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Sep 12 12:56:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e6aebff67426fa0f9779a0c19d6188a043bf15e7
      https://github.com/llvm/llvm-project/commit/e6aebff67426fa0f9779a0c19d6188a043bf15e7
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-09-12 (Mon, 12 Sep 2022)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Relocations.cpp
    M lld/ELF/Symbols.h
    M lld/ELF/SyntheticSections.cpp
    M lld/ELF/SyntheticSections.h
    M lld/ELF/Writer.cpp
    M lld/test/ELF/combreloc.s
    M lld/test/ELF/comdat-discarded-error.s
    M lld/test/ELF/undef-multi.s
    M lld/test/ELF/undef.s
    M llvm/include/llvm/Support/Parallel.h
    M llvm/lib/Support/Parallel.cpp

  Log Message:
  -----------
  [ELF] Parallelize relocation scanning

* Change `Symbol::flags` to a `std::atomic<uint16_t>`
* Add `llvm::parallel::threadIndex` as a thread-local non-negative integer
* Add `relocsVec` to part.relaDyn and part.relrDyn so that relative relocations can be added without a mutex
* Arbitrarily change -z nocombreloc to move relative relocations to the end. Disable parallelism for deterministic output.

MIPS and PPC64 use global states for relocation scanning. Keep serial scanning.

Speed-up with mimalloc and --threads=8 on an Intel Skylake machine:

* clang (Release): 1.27x as fast
* clang (Debug): 1.06x as fast
* chrome (default): 1.05x as fast
* scylladb (default): 1.04x as fast

Speed-up with glibc malloc and --threads=16 on a ThunderX2 (AArch64):

* clang (Release): 1.31x as fast
* scylladb (default): 1.06x as fast

Reviewed By: andrewng

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




More information about the All-commits mailing list