[PATCH] D127579: [clang][WIP] add option to keep types of ptr args for non-kernel functions in metadata
Joshua Cranmer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 15 11:28:03 PDT 2022
jcranmer-intel added a comment.
In D127579#3585553 <https://reviews.llvm.org/D127579#3585553>, @bader wrote:
> And in addition to that ISA defines types, which are not natively supported by LLVM IR e.g. image. To represent those types clang in OpenCL language mode emits a pointer to an opaque structure with special name like opencl.<ISA_type_name> (e.g. opencl.image2d_t). All ISA types, which are defined that way look the same with type-less pointers.
> https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/OpenCLImageTypes.def
One of the important facts about these types is that the SPIR-V specification doesn't let you actually cast between these types and other types such as integers. (Which is an issue because I've just come across a testcase where, in opaque pointer mode, an OpenCL event type is being used in a `ptrtoint` to store to a variable as an `i64`, which I can't legally translate to SPIR-V.) Of course, this probably means that these types need to have their representation in LLVM changed entirely, but I haven't yet done the legwork to experiment in that mode.
I haven't yet tested whether or not this patch is sufficient to support all of the use cases I need for type scavenging for SPIR-V, but one of the things I do see is that there's no support for return type information, which may be a bit of an issue.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127579/new/
https://reviews.llvm.org/D127579
More information about the cfe-commits
mailing list