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

Joshua Cranmer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 11:12:08 PST 2023


jcranmer-intel added inline comments.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:10986
+  // for more details).
+  SmallVector<unsigned, 7> IntParams = {0, 0, 0, 0, 0, 0};
+
----------------
Anastasia wrote:
> I think the list initialization doesn't do what you are trying to achieve with `SmallVector` as it appends the elements. You should probably just be using constructor with size i.e. IntParams(6)?
The list initialization is filling in 6 0 elements, which is intentional.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:10992
+  if (OpenCLName.startswith("image2d"))
+    IntParams[0] = 1; // 1D
+  else if (OpenCLName.startswith("image3d"))
----------------
Anastasia wrote:
> Ok, is the order of parameters defined or documented somewhere? Would it make sense to create some kind of a local enum map containing the indices and use enum members instead of constants to improve readability/maintenance?
They're documented in the link given in the first comment in this method: https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpTypeImage


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141008



More information about the cfe-commits mailing list