[llvm-branch-commits] [clang] [Clang] define memory scopes as a builtin enum (PR #185408)
Sameer Sahasrabuddhe via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Mar 9 09:54:31 PDT 2026
ssahasra wrote:
> In my opinion, HIP atomics should just be deprecated, any use of them should emit a warning. The OpenCL atomics are dictated by a standard and should be kept separate.
I agree completely, which is why I am fixing only the Clang builtins. I want to add AMDGCN builtins that take a numerical value as a scope argument, but I need proper checking to go with that. These are not HIP or OpenCL builtins, so they should not be using scopes from either of those languages. But everything looks the same right now, and HIP programmers will routinely shoot themselves in the foot by passing a HIP scope to these AMDGCN builtins. This new enum makes it possible to guard against that. While existing uses are a warning, I intend to issue an error for the new AMDGCN builtins so that users can't even use the HIP macros by mistake.
> Adding special checks that the normal GNU atomics don't have is breaking that expectation.
I didn't understand this. I am adding special checks to normal atomics for things that those normal atomics don't have. So it's not entirely clear to me what the objection is. And the whole point of those checks is to funnel usage in the right direction.
https://github.com/llvm/llvm-project/pull/185408
More information about the llvm-branch-commits
mailing list