[PATCH] [OpenCL] Promoting OpenCL image types

Benyei, Guy guy.benyei at intel.com
Mon Feb 25 05:34:14 PST 2013


Hi all,
First, I'm in favor of the qualifiers solution, and I also think that qualifiers are enough for checking image access restrictions (in some past version we did that by using only the attributes in the AST, using the qualifiers would be even more straight forward).
I'm also not sure you cannot have an image without access qualifier: there are built-in functions that do exactly this: get_image_width, get_image_height, get_image_channel_data_type etc... have a single prototype, but should accept both read_only and write_only images. Also, in the future, we might have read_write images too, so it would make sense to have a solution that enables us to pass an image only to a function accepting images with the same or lesser permissions.
Having something like:

  image_access_none       = 0,
  image_access_read_only  = 1,
  image_access_write_only = 2,
  image_access_read_write = 3

would make sense. Given a function expecting image with access qualifier fncq, passing an argument with qualifier argq is accepted iff:

((~argq) & fncq) == 0

Thanks
    Guy


-----Original Message-----
From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Joey Gouly
Sent: Monday, February 25, 2013 14:04
To: 'Tanya Lattner'
Cc: cfe-commits at cs.uiuc.edu
Subject: RE: [PATCH] [OpenCL] Promoting OpenCL image types

> Ok, so take AddressSpaces for example. These are implemented as 
> qualifiers
and if you changed the read_only/write_only to an address space (and make them different) you would get an error a> > bout changing address space pointers when passing dst to that function. Address spaces are also available at codgen too.

> Using AddressSpaces as my example, to me it seems like its doable with
qualifiers. Maybe take a look at how that works and see if maybe you are just missing something? I think its cleaner to > use qualifiers.

Thinking about this, the reason image access qualifiers are different to address space qualifiers is that you cannot have an image *without* an access qualifier. There isn't an "image2d_t" type, only "read_only image2d_t" and "write_only image2d_t" (and read_write, but it's invalid). This is why I think it's better to have them as actual distinct types.

Joey







_______________________________________________
cfe-commits mailing list
cfe-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the cfe-commits mailing list