[all-commits] [llvm/llvm-project] a9ca82: [libc] Use clang's scoped atomics if available fro...

Joseph Huber via All-commits all-commits at lists.llvm.org
Thu Jan 18 12:43:21 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a9ca820529c69674e01d2e90cadc69e361ecf339
      https://github.com/llvm/llvm-project/commit/a9ca820529c69674e01d2e90cadc69e361ecf339
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-01-18 (Thu, 18 Jan 2024)

  Changed paths:
    M libc/src/__support/CPP/atomic.h
    M libc/src/__support/RPC/rpc.h

  Log Message:
  -----------
  [libc] Use clang's scoped atomics if available from the compiler (#74769)

Summary:
A recent patch in https://github.com/llvm/llvm-project/pull/72280
provided `clang` the ability to easily use scoped atomics. These are a
special modifier on atomics that some backends support. They are
intended for providing more fine-grained control over the affected
memory of an atomic action. The default is a "system" scope, e.g.
coherence with the GPU and CPU memory on a heterogeneous system. If we
use "device" scope, that implies that the memory is only ordered with
respect to the current GPU.

These builtins are direct replacements for the GCC atomic builitins in
cases where the backend doesn't do anything with the information, so
these should be a drop-in. This introduces some noise, but hopefully it
isn't too contentious.




More information about the All-commits mailing list