microsoft / microsoft/STL

`<atomic>`: Consider using `__atomic_load_n`/`__atomic_store_n` for Clang

Open
#3,659 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance
Dominant language
C++
Stars
11.2k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

In https://github.com/llvm/llvm-project/issues/62103#issuecomment-1505869207 , @efriedma-quic asked us to consider an alternative to the ARM64 __load_acquire/__stlr intrinsics we've started using for MSVC (see #3399 and #3651):

If possible, I'd strongly prefer if you could change the MS STL to use __atomic_load_n/__atomic_store_n. It's not clear to me what the semantics of the target-specific intrinsics are supposed to be, and LLVM optimizations already know how to optimize the existing atomic intrinsics.

(ldapr is part of armv8.3, so I assume MSVC won't generate it unless you pass flags that indicate the target supports it.)

On the one hand, this would mean maintaining dedicated codepaths for Clang. On the other hand, getting compilers to do our work for us is awesome.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked LLVM issue comment and the existing changes referenced in #3399 and #3651. Compare the proposed atomic intrinsics with the current ARM64 implementation and establish the required compiler behavior and tests; done means an agreed, validated approach for Clang.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.