Serge Martin <edb+m...@sigluy.net> writes: > From: Vedran Miletić <ved...@miletic.net> > > Make sure that a struct argument did not get compiled into a pointer > type with the byval attribute. If we try to handle the pointer with > byval, we end up with the pointer size instead of the struct size. > Ugh, is that a bug in the code below? How are byval pointers supposed to be handled here? Exactly as if the argument wasn't a pointer at all by providing a copy of the pointed-to object as-is in the kernel input buffer? In that case wouldn't the code below need to pass the correct size of the pointed-to object as target/api size rather than the size of the pointer?
> Struct arguments on AMD GPUs will work correctly once Clang gets patched > with http://reviews.llvm.org/D20168 or an equivalent patch. > > Reviewed-by: Serge Martin <edb+m...@sigluy.net> > > Cc: 12.0 <mesa-sta...@lists.freedesktop.org> > --- > src/gallium/state_trackers/clover/llvm/invocation.cpp | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp > b/src/gallium/state_trackers/clover/llvm/invocation.cpp > index e2cadda..03487d6 100644 > --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp > +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp > @@ -461,6 +461,10 @@ namespace { > for (const auto &arg: kernel_func->args()) { > > llvm::Type *arg_type = arg.getType(); > + assert(!(arg_type->isPointerTy() && arg.hasByValAttr() && > + arg_type->getPointerElementType()->isStructTy()) && > + "Unable to handle struct compiled as pointer with byval."); > + > const unsigned arg_store_size = TD.getTypeStoreSize(arg_type); > > // OpenCL 1.2 specification, Ch. 6.1.5: "A built-in data > -- > 2.5.5 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev