[llvm] [Offload] Make olLaunchKernel test thread safe (PR #149497)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 22 05:02:26 PDT 2025
================
@@ -1329,12 +1329,15 @@ Error PinnedAllocationMapTy::unlockUnmappedHostBuffer(void *HstPtr) {
return eraseEntry(*Entry);
}
-Error GenericDeviceTy::synchronize(__tgt_async_info *AsyncInfo) {
+Error GenericDeviceTy::synchronize(__tgt_async_info *AsyncInfo,
+ bool RemoveQueue) {
+ std::lock_guard<std::mutex> AllocationGuard{AsyncInfo->AllocationsMutex};
----------------
RossBrunton wrote:
The use case I was seeing in the tests was that multiple threads were calling `olWait()` concurrently on different threads. They would all go into `synchronize` at the same time and start double-freeing and clobbering the vector.
As far as I can tell, it should also solve the problem you've describe though.
https://github.com/llvm/llvm-project/pull/149497
More information about the llvm-commits
mailing list