[PATCH] D152840: A new code layout algorithm for function reordering [3a/3]

Sergey Pupyrev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 12:15:58 PDT 2023


spupyrev created this revision.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: MaskRay.
Herald added a project: All.
spupyrev retitled this revision from "A new code layout algorithm for function reordering [3/3]" to "A new code layout algorithm for function reordering [3a/3]".
spupyrev edited the summary of this revision.
spupyrev edited the summary of this revision.
Herald added subscribers: wlei, wenlei.
spupyrev added subscribers: ellis, kyulee.
spupyrev updated this revision to Diff 531453.
spupyrev added a comment.
spupyrev added reviewers: wenlei, hoy, wlei.
spupyrev published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

upd


We are brining a new algorithm for function layout (reordering) based on the
call graph (extracted from a profile data). The algorithm is an improvement of
top of a known heuristic, C^3. It tries to co-locate hot and frequently executed
together functions in the resulting ordering. Unlike C^3, it explores a larger
search space and have an objective closely tied to the performance of
instruction and i-TLB caches. Hence, the name CDS = Cache-Directed Sort.
The algorithm can be used at the linking or post-linking (e.g., BOLT) stage.

This diff adds a linker option to replace the existing C^3 heuristic with CDS.

**Perf-impact**
clang-10 binary (built with LTO+AutoFDO/CSSPGO): wins on top of C^3 in [0.3%..0.8%]
rocksDB-8 binary (built with LTO+CSSPGO): wins on top of C^3 in [0.8%..1.5%]


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152840

Files:
  lld/ELF/CMakeLists.txt
  lld/ELF/CallGraphSort.cpp
  lld/ELF/CallGraphSort.h
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/Options.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152840.531453.patch
Type: text/x-patch
Size: 5980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230614/cdff3766/attachment.bin>


More information about the llvm-commits mailing list