cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

corry
Adept III

Pinned memory transfer completion

So, after having some issues with kernels constantly transfering data, I switched over to pinned buffers...I thought I read they were automatically synchronized...and sure enough, eventually they are, but if you have something like

run kernel

do some CPU stuff

wait for kernel completion

map ram (which just returns the host pointer you provided)

the results from the previous kernel invocation aren't there yet.  Break in the debugger, and they're there.  Heck, sometimes by the time my CPU code to work with the results runs, the data is there, but sometimes not...I thought maybe it was a caching issue?  But the cached flag wasn't on for the buffer, and I even declared the buffer volatile with no go.

I tried looking on here for information, but didn't find much.  I even tried specifically copying the memory back, but ended up with all 0's!  Can someone tell me how to determine the transfer is complete/caches updated/whatever else might be taking time has completed?

0 Likes
1 Reply
nou
Exemplar

do you wait for maping to finish? memory buffers which are created with CL_MEM_ALLOC_HOST_PTR or CL_MEM_USE_HOST_PTR can be cached in device memory. to ensure that memory pointer contain latest data you need map them.

0 Likes