[Coverity] Review kernel program cache locks
- Dominant language
- LLVM
- Stars
- 1.5k
- Forks
- 854
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 137
Description
You can see Coverity issues at https://scan.coverity.com/projects/intel-llvm?tab=overview
This report is motivated by `512040` - from what I understand, Coverity's concern is that here we acquire multiple locks and it may lead to a deadlock if there is another place where the same set (or a subset bigger than 1 lock) is acquired as well, but in a different order.
I don't know if we have a precedent for this, but the comment around the function says that it should only be used in unit tests.
That makes me think that it may not be ready for a production usage in a multi-threaded environment.
https://github.com/intel/llvm/blob/98cd46434d99fe9bbca7bf7ca104e1164939b97f/sycl/source/detail/kernel_program_cache.hpp#L716-L722
However, it is used several times in the SYCL RT:
https://github.com/intel/llvm/blob/98cd46434d99fe9bbca7bf7ca104e1164939b97f/sycl/source/detail/kernel_program_cache.hpp#L811
https://github.com/intel/llvm/blob/98cd46434d99fe9bbca7bf7ca104e1164939b97f/sycl/source/detail/program_manager/program_manager.cpp#L1813
https://github.com/intel/llvm/blob/98cd46434d99fe9bbca7bf7ca104e1164939b97f/sycl/source/detail/program_manager/program_manager.cpp#L3008
I think that we should clarify the comment and double-check if a deadlock Coverity is talking about is indeed possible or not
Contributor guide
Assessment
This issue has not been assessed yet.