cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Raistmer
Adept II

Mapping/copy/unmapping - some sync needed?

I do host buffer (pinned memory) unmapping, copy values from GPU memory to buffer, then map buffer again and use it in host code. This happens in loop.
Question is - should I use wait on events, clFinish() between commands or some other form of synching or these commands (clEnqueueUnmapMemObject,clEnqueueCopyBuffer,clEnqueueMapBuffer) or they will be executed in order and will wait each other completion just because they placed in appropriate order in queue (as one kernel call will wait before earlier kernel finishes) ?
0 Likes
1 Reply
genaganna
Journeyman III

Originally posted by: Raistmer I do host buffer (pinned memory) unmapping, copy values from GPU memory to buffer, then map buffer again and use it in host code. This happens in loop. Question is - should I use wait on events, clFinish() between commands or some other form of synching or these commands (clEnqueueUnmapMemObject,clEnqueueCopyBuffer,clEnqueueMapBuffer) or they will be executed in order and will wait each other completion just because they placed in appropriate order in queue (as one kernel call will wait before earlier kernel finishes) ?


Before using mapped pointer, you should wait to complete Map command. you can use clFinish or events returned by clEnqueueMapBuffer or use blocking call of clEnqueueMapBuffer.

All commands will be executed in order as FIFO if command properties is not CL_QUEUE_OUT_OF_ORDER_EXEC_
MODE_ENABLE.

 

0 Likes