[PATCH] D15914: [OpenCL] Pipe builtin functions
Anastasia Stulova via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 11 10:41:21 PST 2016
Anastasia added inline comments.
Comment at: lib/CodeGen/CGBuiltin.cpp:2033
@@ +2032,3 @@
+ *Arg1 = EmitScalarExpr(E->getArg(1));
+ llvm::Type *ReservedIDTy = ConvertType(getContext().OCLReserveIDTy);
> Anastasia wrote:
> > Why do we need to modify user defined functions? Only builtins will have this extra parameter.
> > I think packet size would be useful for builtin implementation to know the number of bytes to be read/written. I don't see how to implement it correctly otherwise. As mentioned earlier relying on the metadata is not a conventional compilation approach and should be avoided if possible.
> The pipe struct can have the packet size in its header before the actual ring buffer or whatever, which can be used as a fallback unless the compiler can optimize it to a larger access. Correct implementation thus doesn't require a "hidden parameter". Adding it as a compile time hidden constant argument should help the optimizers, that's of course true, but I don't think it's strictly required.
> If you think having a special behavior for the built-ins calls isn't problematic, then fine, I'm not having so strong opinion on this.
So where would this size be initialized/set? Note that host code might have different type sizes.
I am thinking that having a size parameter makes the generated function more generic since we lose information about the type here and recovering it might involve extra steps. I am currently not clear about how to do that.
More information about the cfe-commits