[Libclc-dev] [PATCH] vload/vstore: Use casts instead of scalarizing everything in CLC version

Tom Stellard tom at stellard.net
Fri Aug 15 10:10:23 PDT 2014


On Fri, Aug 15, 2014 at 09:57:25AM -0700, Matt Arsenault wrote:
> On 08/15/2014 09:55 AM, Matt Arsenault wrote:
> >On 08/15/2014 09:43 AM, Tom Stellard wrote:
> >>I don't think it's possible to implement a single store version
> >>of vec3 using
> >>OpenCL C, because if you cast a pointer as a vec3 type, clang will will
> >>try to store a vec4 value to it, because sizeof(vec3) == sizeof(vec4) in
> >>memory.
> >>
> >>-Tom
> >I guess it would be appropriate to write this one directly in IR then
> Actually that kind of seems like a clang bug. It should be emitting
> the load on the actual type with whatever alignment, not the type
> the rounded size happens to be

What clang is doing is legal as far as I can tell, it just is inefficient,
so I think we'll still need an IR version.

The problem with an IR version, though, is that it has to be target
specific, since the address spaces are different for different targets.

My recommendation is to commit the version I suggested which works,
and then we can figure out how to optimize it with IR in a follow
up commit.

-Tom




More information about the Libclc-dev mailing list