[Libclc-dev] [PATCH 1/3] Implement wait_group_events builtin

Jeroen Ketema j.ketema at imperial.ac.uk
Sat Aug 9 13:59:07 PDT 2014


On 08 Aug 2014, at 23:47, Matt Arsenault <Matthew.Arsenault at amd.com> wrote:

> On 08/08/2014 02:40 PM, Tom Stellard wrote:
>> +_CLC_DEF void wait_group_events(int num_events, event_t *event_list) {
>> +  barrier(CLK_LOCAL_MEM_FENCE);
>> +  barrier(CLK_GLOBAL_MEM_FENCE);
>> +}
> Why not barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE)?

Technically, I think that using a barrier here is too strong, as the function just has to guarantee that the copying has finished. It does not have to guarantee that all memory operations induced by the copying have finished:

http://www.khronos.org/message_boards/showthread.php/5875-Profiling-Code/page2

However, I guess that with a pure OpenCL implementation using a barrier is the only option.

> The spec says "This function does not perform any implicit synchronization of source data such as using a barrier before performing the copy" although this doesn't sound like a really enforceable restriction

I think this applies to async_work_group_copy, not to wait_groups_events. Also, it doesn’t seem something that needs to be enforced, it’s something the user can expect. Her or she better insert fences/barriers before starting a copy.

Jeroen





More information about the Libclc-dev mailing list