[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
Tue Jan 10 12:58:54 PST 2023
jcranmer-intel added a comment.
================
Comment at: clang/lib/CodeGen/CGOpenCLRuntime.cpp:80
+
+ if (useSPIRVTargetExtType(CGM)) {
+ switch (cast<BuiltinType>(T)->getKind()) {
----------------
Anastasia wrote:
> Perhaps it's best to split into separate functions and reflect in naming what they correspond to.
I've decided to pull this out into a new subclass of CGOpenCLRuntime that's target specific.
================
Comment at: clang/lib/CodeGen/CGOpenCLRuntime.cpp:100
+#define INTEL_SUBGROUP_AVC_TYPE(Name, Id) \
+ case BuiltinType::OCLIntelSubgroupAVC##Id: \
+ return llvm::TargetExtType::get(Ctx, "spirv.Avc" #Id "INTEL");
----------------
Anastasia wrote:
> Why does this need special handling?
The `EXT_OPAQUE_TYPE` macro doesn't map cleanly to the SPIR-V OpType* names--the parameters you'd get would be `intel_sub_group_avc_mce_payload_t, OCLIntelSubgroupAVCMcePayload, cl_intel_device_side_avc_motion_estimation` whereas the SPIR-V type name is supposed to be `AvcMcePayloadINTEL`. Using the `INTEL_SUBGROUP_AVC_TYPE` instead allows me to construct the correct SPIR-V type name without having to manually write out each case statement, or adjust macros used in many, many more places. (As it is, I need to rename 4 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 cfe-commits
mailing list