Forum Discussion
Altera_Forum
Honored Contributor
10 years agoPrior to OpenCL 2.0, the relaxed-consistency memory model only guarantees that global and local memory is consistent among work-items in the same work-group at barriers, and work-items in different work-groups upon kernel completions. Furthermore, consistency between the host and device is only guaranteed upon read/write buffer completions for buffers not being written to by the host or kernels.
Since a CPU device is also the host, and therefore has unified host memory, you may by good fortune observe the behavior you desire with what you've done. However, it is highly vendor dependent (especially for discrete devices) and thus not portable in OpenCL 1.0 -- 1.2 specifications. What you're looking for is Shared Virtual Memory (SVM) in the OpenCL 2.0 specification.