[PATCH] D46015: [OpenCL] Add separate read_only and write_only pipe IR types

Stuart Brady via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 25 08:25:29 PDT 2018


stuart added a comment.

In https://reviews.llvm.org/D46015#1077401, @AlexeySotkin wrote:

> It is not clear why we need two versions of get_pipe_num_packets and get_pipe_max_packets builtins. There is only one instruction per builtin in the SPIR-V spec. I think splitting the IR type is enough for translation to SPIR-V purposes.


This is so that when we emit the builtin expression, we can call a function that matches the access qualifier of the argument to the builtin, without the need for a bitcast of either the builtin's argument or the __get_pipe_max/num_packets() function itself.



================
Comment at: lib/CodeGen/CGOpenCLRuntime.h:65
   virtual llvm::Type *getPipeType(const PipeType *T);
+  virtual llvm::Type *getPipeType(const PipeType *T, StringRef Name,
+                                  llvm::Type *&PipeTy);
----------------
AlexeySotkin wrote:
> I'm not sure that it is a good idea to make this function public, as its parameter supposed to be a reference to protected member.
That's a good point. I have changed the function to be protected, to match the visibility of the data member.


https://reviews.llvm.org/D46015





More information about the cfe-commits mailing list