bader added inline comments.

================
Comment at: clang/lib/CodeGen/CGOpenCLRuntime.cpp:40
+static llvm::Type *getSPIRVType(llvm::LLVMContext &Ctx, StringRef BaseType,
+                                StringRef OpenCLName, StringRef ReadSuffix) {
+  SmallVector<unsigned, 7> IntParams = {0, 0, 0, 0, 0, 0};
----------------
jcranmer-intel wrote:
> bader wrote:
> > I believe this can be done at "compile time" (i.e. during the clang build, 
> > not clang run).
> > Can we have a pre-computed map from an OpenCL built-in type to a SPIR-V 
> > type?
> > Another option is compile-time evaluated function. This should be possible, 
> > right?
> > 
> > If I get it right, here we take a string representation of an OpenCL image 
> > type and process it at runtime, which seems to be unnecessary as we have 
> > pre-defined (by the spec) set of the types.
> I can definitely switch the read suffix to use a compile-time enum, since 
> there are only 3 cases (plus, it's a static assert). Making the openCL name 
> to int param conversion be a compile-time constant might be doable with some 
> tricks, but I'll have to think about it for a little bit. It's a little 
> harder because we're taking a string to 6 array values.
I was going to suggest ripping of https://reviews.llvm.org/D108034, but it 
looks like it produces types which have OpenCL names with __spirv_* prefix. So 
unfortunately, I don't have a good example. The only thing coming to my mind is 
to build another table with SPIR-V type names, which can be obtained via OpenCL 
type id (offset?).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141008

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to