cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

alazaro
Adept II

Question about Fine grain and Coarse grain in OpenCL 2.0

Hi everyone

I am newbie with OpenCL 2.0. I have a question about Shared Virtual Memory in OpenCL 2.0. My question is: is there any form to share information between CPU and discrete GPU?. I want to share information between both devices without to stop the computation of them (similar nvidia zero-copy). What is the best form? Fine Grain SVM or Coarse Grain SVM?. Sorry, if my question is not suitable for this forum.

Thank you so much.

0 Likes
1 Solution
dipak
Big Boss

Hi,

Welcome to this forum.

As you know, the host and the devices can share same virtual address space using Shared Virtual Memory (SVM) so, no longer need to copy buffers between host and devices. However, the key points are granularity at which SVM buffers are shared and visibility of any update to this shared buffer. Here coarse- and fine-grain (buffer and system) mechanisms come into the picture. Each mechanism defines the level of granularity and the set of synchronization points that guarantee the visibility of the update to the SVM. You can check OpenCL spec or AMD's  shared virtual memory blog for more information. However, it needs no keep in mind that granularity comes at the cost of performance. As granularity increases (say, fine grained buffer with atomic support), the performance decreases. Another point is fine-grained SVM is optional in OpenCL 2.0 so, this feature may not be supported by all the devices.

Now, coming to your question. The choice between the fine-grained or coarse-grained SVM really depends on the level of granularity and visibility required by the application. If coarse-grained buffer already serves the purpose, no need to go for fine-grained buffer, though same can be done by fine-grained buffer. You can achieve better performance using coarse-grained buffer than fine-grained. So, first analyze your application in depth and then go for that you really need.

Hope, above explanations/suggestions help you to make your choice.

Regards,

View solution in original post

0 Likes
1 Reply
dipak
Big Boss

Hi,

Welcome to this forum.

As you know, the host and the devices can share same virtual address space using Shared Virtual Memory (SVM) so, no longer need to copy buffers between host and devices. However, the key points are granularity at which SVM buffers are shared and visibility of any update to this shared buffer. Here coarse- and fine-grain (buffer and system) mechanisms come into the picture. Each mechanism defines the level of granularity and the set of synchronization points that guarantee the visibility of the update to the SVM. You can check OpenCL spec or AMD's  shared virtual memory blog for more information. However, it needs no keep in mind that granularity comes at the cost of performance. As granularity increases (say, fine grained buffer with atomic support), the performance decreases. Another point is fine-grained SVM is optional in OpenCL 2.0 so, this feature may not be supported by all the devices.

Now, coming to your question. The choice between the fine-grained or coarse-grained SVM really depends on the level of granularity and visibility required by the application. If coarse-grained buffer already serves the purpose, no need to go for fine-grained buffer, though same can be done by fine-grained buffer. You can achieve better performance using coarse-grained buffer than fine-grained. So, first analyze your application in depth and then go for that you really need.

Hope, above explanations/suggestions help you to make your choice.

Regards,

0 Likes