cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

foomanchoo
Adept I

exclusive write after read memory access

for a memory location that is accessed by a single thread, is it allowed to do:

old = load_buffer(global_addr);

store_buffer(new, global_addr); // will be executed before the memory load is finished

and expect old to contain the original value and the memory to contain the new value?

0 Likes
4 Replies
binying
Challenger

Is this code for the device?

0 Likes
cguenther
Adept II

I think you search the functionality of atomic_xchg:

http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/atomic_xchg.html

best,

CG

0 Likes
heman
Adept II

Hi,

Is this issue fixed.

If not can you give more details.

thanks

workitem7

0 Likes
developer
Adept II

Please look at memory consistency section in OpenCL Spec

Let me paste it from OpenCL 1.2 spec for your reference:

<<<<<   

Within a work-item memory has load / store consistency. Local memory is consistent across

work-items in a single work-group at a work-group barrier. Global memory is consistent across

work-items in a single work-group at a work-group barrier, but there are no guarantees of

memory consistency between different work-groups executing a kernel.

>>>>>

I hope this answers your question

0 Likes