[PATCH] [OpenCL] Promoting OpenCL image types

Joey Gouly joey.gouly at arm.com
Wed Feb 20 03:23:57 PST 2013


> > functions, such as: ASTContext::getCanonicalParamType,
> > and ASTContext::getAdjustedParameterType, had to be changed to keep the
> > qualifiers for OpenCL image types.

> I do not understand. Those functions are designed to strip off qualifiers,
so that makes sense. Can you give an example of why using Qualifiers does
not work?
Then we lose the access info. The main problem I found was (we had a  few
other problems, but I can't remember off hand):

void img_ro(read_only image2d_t src);

kernel void test(write_only image2d_t dst) {
  img_ro(dst);
}

We didn't error on this, because
  a) img_ro was built with a ASTContext::getFunctionType(), which calls
getCanonicalParamType, which loses the qualifiers
  b) in Sema::CheckAssignmentConstraints (to check if we can call img_ro
with dst), the types are compared using the unqualified types

Another issue: We'd like to be able to have the access qualifiers around at
CodeGen stage.

I've attached a *rough* patch that shows how we did this with Qualifiers.
Please note, I do not expect this to apply, or work cleanly,
this is just to give you a basic idea of our current solution, against my
proposed solution.

-Tanya

> 
> Therefore, my proposal is to promote the OpenCL image types from builtin
> types, to their own type. This will allow us
> to store the modifiers in the type directly.
> 
> The first patch implements this, and the second patch implements basic
> support for the qualifiers.
> 
> Please review and comment!
> 
> Thanks,
> Joey
>
<image_types_p2.diff><image_types_p1.diff>__________________________________
_____________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmp.patch
Type: application/octet-stream
Size: 19196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130220/0350d4fb/attachment.obj>


More information about the cfe-commits mailing list