[clang] [Clang][HIP] Change atomic behavior from atomic to language (PR #189454)

Sameer Sahasrabuddhe via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 20:17:40 PDT 2026


ssahasra wrote:

I didn't understand the purpose of this patch. From the users' perspective this is asking them to replace the spelling `__opencl_*`" with the spelling "`__scoped_*`" combined with OpenCL mode. That smells wrong. How is it okay to make a builtin modal? Shouldn't a builtin always do one and only one thing independent of its environment?

The scoped atomics and the language atomics have distinct semantics, and I thought our plan was to just entirely get rid of the special language semantics, at least for HIP.
- OpenCL is a language supported by many frontends. It defines its own atomics. If Clang scoped atomics don't already include the required semantics, then it makes sense to keep the `__opencl_*` builtins around forever.
- HIP currently has only one frontend, so we have the luxury of just defining HIP semantics to be the same as Clang scoped atomics. All we have to do is deprecate the HIP things and eventually remove them.

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


More information about the cfe-commits mailing list