[PATCH] D75917: Expose llvm fence instruction as clang intrinsic

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 11 05:09:02 PDT 2020


JonChesterfield added a comment.

In D75917#1916160 <https://reviews.llvm.org/D75917#1916160>, @sameerds wrote:

> how this builtin fits in with the overall scheme of language-specific and target-specific details of an atomic operation. For example, is this meant only for OpenCL? Does it work with CUDA? Or HIP? What is the behaviour for scope in C++?


Identical to the fence instruction. Which is assumed well thought through already, given it's an IR instruction.

As far as I can tell, fence composes sensibly with other IR then generates the right thing at the back end. So it looks fit for purpose, just not currently available from clang.



================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3707
+    Value *Scope = EmitScalarExpr(E->getArg(1));
+    auto ScopeModel = AtomicScopeModel::create(AtomicScopeModelKind::OpenCL);
+
----------------
sameerds wrote:
> The proposed builtin does not claim to be an OpenCL builtin, so it's probably not correct to simply assume the OpenCL model. Should the model be chosen based on the source language specified?
The only values for AtomicScopeModelKind are none and OpenCL.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75917/new/

https://reviews.llvm.org/D75917





More information about the cfe-commits mailing list