[PATCH] D93585: [AArch64] Enable out-of-line atomics by default.

Pavel Iliin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 20 11:28:24 PST 2020


ilinpv added a comment.

Outline atomics were added with gcc 9.3.1 and turned on by default in gcc 10.1. Consequently most of distributions had libgcc with outline atomics already.
Besides Linux, Android will utilize them as well. Don't know about iOs and MacOs, I guess they are compiling with LSE enabled, so outline atomics should not affect them.
As for benchmarks, I rely on investigations completed during gcc outline atomics enablement work.
Choice of solution ../gcc/libgcc/config/aarch64/lse.S:

  The problem that we are trying to solve is operating system deployment
  of ARMv8.1-Atomics, also known as Large System Exensions (LSE).
  
  There are a number of potential solutions for this problem which have
  been proposed and rejected for various reasons.  To recap:
  
  (1) Multiple builds.  The dynamic linker will examine /lib64/atomics/
  if HWCAP_ATOMICS is set, allowing entire libraries to be overwritten.
  However, not all Linux distributions are happy with multiple builds,
  and anyway it has no effect on main applications.
  (2) IFUNC.  We could put these functions into libgcc_s.so, and have
  a single copy of each function for all DSOs.  However, ARM is concerned
  that the branch-to-indirect-branch that is implied by using a PLT,
  as required by IFUNC, is too much overhead for smaller cpus.
  (3) Statically predicted direct branches.  This is the approach that
  is taken here.  These functions are linked into every DSO that uses them.
  All of the symbols are hidden, so that the functions are called via a
  direct branch.  The choice of LSE vs non-LSE is done via one byte load
  followed by a well-predicted direct branch.  The functions are compiled
  separately to minimize code size.

Performance impact:

  Various members in the Arm ecosystem have measured the performance impact of this indirection on a diverse set of systems and we were happy to find out that it was minimal compared to the benefit of using the LSE instructions for better scalability at large core counts.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93585/new/

https://reviews.llvm.org/D93585



More information about the llvm-commits mailing list