Fix the issue where not all events were being recycled by Level Zero event collector
Refactor CHIPEventLevel0::wait() to get rid of race conditions reported by valgrind. The API states that calls to zeEventHostSynchronize and zeEventQuery are thread safe but valgrind reports race conditions.
Implement a global shared mutex - ApiMtx which is to be locked by every HIP API call. This prevents multiple HIP commands from executing at the same time. Pretty coarse lock which we can relax over time since performance is affected only for multithreaded HIP applications of which I haven't seen any yet.
CHIPEventLevel0::wait()
to get rid of race conditions reported by valgrind. The API states that calls tozeEventHostSynchronize
andzeEventQuery
are thread safe but valgrind reports race conditions.ApiMtx
which is to be locked by every HIP API call. This prevents multiple HIP commands from executing at the same time. Pretty coarse lock which we can relax over time since performance is affected only for multithreaded HIP applications of which I haven't seen any yet.