[PATCH] D141008: [Clang][SPIR-V] Emit target extension types for OpenCL types on SPIR-V.

Alexey Bader via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 14:26:52 PST 2023


bader added a comment.

@jcranmer-intel, thanks a lot for working on this. I'm so excited to see these changes!
Overall, it looks good to me, but I'd like to avoid some runtime computations if possible.



================
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};
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141008



More information about the llvm-commits mailing list