[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 16 14:23:20 PST 2023


jhuber6 wrote:

> > I figured we can just treat these as clang extensions for the time being. We already have two variants that are more or less redundant for specific use-cases, (OpenCL and HIP), which should be able to be removed after this.
> 
> I'm not sure what you mean here. If you mean that users are expected to use the OpenCL/HIP/etc. standard APIs, and you only expect to use these as part of language runtimes, then maybe we don't care so much if it's clang-only.

They should be available to users, but this level of programming is highly compiler-dependent already so I don't see it as much different.

> It might be worth considering using string literals instead of numbers for the different scopes. It removes any question of whether the list of scopes is complete and the order of of numbers on the list. And it doesn't require defining a bunch of new preprocessor macros.

The underlying implementation is a string literal in the LLVM `syncscope` argument, but the problem is that this isn't standardized at all and varies between backends potentially. I suppose we could think of this are more literally "target the LLVM `syncscope` argument". I'd like something that's "reasonably" consistent between targets since a lot of this can be shared as simple hierarchy. it would be really annoying if each target had to define separate strings for something that's mostly common in concept.

https://github.com/llvm/llvm-project/pull/72280


More information about the cfe-commits mailing list