开发者

Does OpenCL allow concurrent writes to same memory address?

开发者 https://www.devze.com 2022-12-30 14:14 出处:网络
Is two (or more) different threads allowed to write to the same memory location in global space in OpenCL? The write is always changing a uchar from 0 to 1 so the outcome should be predictable, but I\

Is two (or more) different threads allowed to write to the same memory location in global space in OpenCL? The write is always changing a uchar from 0 to 1 so the outcome should be predictable, but I'm getting erratic results in my program, so I'm wondering if the reason can be that some of the writes fail.

Could it help to dec开发者_Python百科lare the buffer write-only and copy it to a read-only buffer afterwards?


Did you try to use the cl_khr_global_int32_base_atomics extension and atom_inc intrinsic function? I would first store the data on an int32 instead of an uchar as proof of concept, then optimize the memory footprint of data structures.

0

精彩评论

暂无评论...
验证码 换一张
取 消