[PATCH] D70739: [OPENMP50]Add device/isa context selector support.

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 12:37:47 PST 2019


jdoerfert added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:9320
   using OMPCtxSelectorData =
-      OpenMPCtxSelectorData<SmallVector<OMPCtxStringType, 4>, ExprResult>;
+      OpenMPCtxSelectorData<SmallVector<llvm::Any, 4>, ExprResult>;
 
----------------
ABataev wrote:
> jdoerfert wrote:
> > I would like to avoid the Any type here and I hope we can if we don't allow "strings". See also my last comment.
> The only possible solution I see here is to convert kind/vendor strings into exprs and store all data as `Expr *`
Should we define a struct to be used as variant here maybe? If we only have <5 different types we might not want to go to Any or Expr directly.


================
Comment at: clang/test/OpenMP/nvptx_declare_variant_device_isa_codegen.cpp:48
+
+#pragma omp declare variant(foo) match(device = {isa("nvptx64")})
+int bar() { return 1; }
----------------
ABataev wrote:
> jdoerfert wrote:
> > I'm not sure we want these to be strings. I would have assumed `isa(nvptx64)`, similar to `vendor(arm)`, or `kind(host)` and `kind(gpu)`
> Here is the message from Joachim Protze:
> ```
> vendor and kind are special, because we define the kind-name and 
> vendor-name in the context definition side document. (We could change 
> that to "kind-name" or define kind-name as any of "cpu", "gpu", "fpga" ???)
> 
> For the others, according to the syntax diagram in the OpenMP Context 
> section, the content of the () can only be string or const-int-exp.
> 
> - Joachim
> ```
> That's why we need to represent them as strings, this is per OpenMP standard.
While you say it, I wanted to mention that we moved the discussion on the openmp-lang list.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70739





More information about the cfe-commits mailing list