Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
131 Views

Usage of "cl_cache" for multiple instance/thread

Hi team,

I'm using "cl_cache" method to reduce model loading time for GPU backend case, and wonder whether we can get benefit of using "cl_cache" for following case, too.

Case #1: Single thread operation and creating multiple instances: Can 2nd/3rd/.. instances use cl_cache created by 1st instances to reduce model loading time?

Case #2: Multiple thread operation: Can 2nd/3rd./.. thread use cl_cache created by 1st thread?

Thank you.

0 Kudos
2 Replies
Highlighted
131 Views

Dear team,

Can anyone help me here?

0 Kudos
Highlighted
Employee
131 Views

Hello,

Here is faq explaining current limitations:

https://github.com/intel/compute-runtime/blob/master/opencl/doc/FAQ.md

In general cl_cache is not thread safe.

If you synchronize your application properly , you may use cl_cache populated from thread #1 in other threads.

Generally cl_cache has thread safety issues while it is being populated, if you do one threaded run of your application that populates the whole cl_cache, then for subsequent runs you should be able to read it from multiple threads without locks.

 

0 Kudos