[Mesa-dev] OpenCL/clover buffers vs images

Tom Stellard tom at stellard.net
Mon Mar 24 13:16:13 PDT 2014


On Mon, Mar 24, 2014 at 02:35:04PM +0000, Dorrington, Albert wrote:
> I have been experimenting with adding image support to the clover implementation, and have been trying to understand the differences between the existing buffer support and what would be required to support images.
> 
> From what I'm gathering, buffers are laid out in VRAM in a linear format, while images would be laid out in some sort of tiled format.
> 
> I have been trying to do some research on tiled memory layout, and have not yet been able to find anything which describes the tiled format that is in use on R600 and Evergreen GPUs.
> 
> I have also tried going through the OpenGL code to understand how image textures are transferred to the R600/Evergreen GPUs, since I am making the assumption that OpenGL would be transferring the images to GPU RAM in the same tiled format that an OpenCL texture would use.
> 
> I have been trying to do some comparisons with the Catalyst driver's implementation, but I have not determined a way to view the internals of the registers and CB areas within the catalyst environment.
> 
> For example, looking at the IL and ISA generated using the Catalyst SDK, I can see that there are 8 32-bit fields being read from CB1 for an read_only image kernel parameter.
> I have been able to determine that the first three are integer width, height, depth. The fourth is the image channel data type, the 8th is the image channel order.
> The 5th and 6th are involved in offset calculations for sampler coordinates (not sure if they are row and slice pitches of some sort) while the 7th seems unused (I'm assuming it must have something to do with 3D images)
>

If you send me your example code, I can look at the kernel analyzer and
try to figure out what is going on.

> I have been thinking that it should be possible to use Mesa's OpenGL texture transfer routines within the Clover transfer routines (rather than the current path through soft_copy_op, which uses direct memcpy instructions)
> 
> Unfortunately, so far I've only been able to look at a 4x4 image, anything beyond that causes the GPU CP to stall on me.
> 
> If anyone can shed some light on these parameters that the Catalyst driver uses, or provide some information on how the Mesa OpenGL implementation transfers texture data to the radeon GPUs, I'd appreciate it.
> 
> My online research hasn't been very productive, I think because I don't fully understand the terminology being used in this area.
> 

I think you should be able to re-use most of the texturing code in r600g
for OpenCL.  However, I have very limited knowledge of this code, so I
may be wrong.

I actually had basic image support working about 6 months ago.  I had to
hard code a bunch of values into the compiler and also libclc, but I was
able to pass a simple test.  Below you can find some links to the code.
You might get lucky and it will still work after you rebase it, but I
doubt it.  However, it may help you get an idea of what to do by looking
through the code:

http://cgit.freedesktop.org/~tstellar/mesa/log/?h=r600g-image-support
http://cgit.freedesktop.org/~tstellar/libclc/log/?h=image
http://cgit.freedesktop.org/~tstellar/llvm/log/?h=image-support


> Thanks!
> 
> Al Dorrington
> Software Engineer Sr
> Lockheed Martin, Mission Systems and Training
> 

> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list