OpenCL. Do coalesced writes have to be sequential?
By macleod at Mon, Mar 8 2010 11:09am |
Just pondering on this.
Let's say you have eight work items and each is writing two values.
The first work item writes a value to position zero and the second value to position eight. The second work item writes a value to position one and position nine. And so on.
Would OpenCL be smart enough to realise that the half warp as a whole is doing a coalesced write?
Or is it looking for sequential indices one after another?
Any advice appreciated. There is always of course a possibility that this is a really dumb question and my understanding is completely flawed!
Cheers,
Max




Re: OpenCL. Do coalesced writes have to be sequential?
Reads and writes have nothing to do with OpenCL. This is all controlled by the hardware. All work-items move in lock step within a half-warp. So if the writes as a whole are to sequential addresses (that is the block being pushed to memory is contiguous, regardless of which thread puts what where) then write to memory will be coalesced.
On newer hardware not all threads even have to participate in the write. On older hardware all threads need do however.
Hope that helps,
Dave
Very cool thanks
That's great thanks Dave.