[llvm] [Offload] Make olLaunchKernel test thread safe (PR #149497)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 08:05:09 PDT 2025


================
@@ -2227,6 +2227,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
   /// Get the stream of the asynchronous info structure or get a new one.
   Error getStream(AsyncInfoWrapperTy &AsyncInfoWrapper,
                   AMDGPUStreamTy *&Stream) {
+    std::lock_guard<std::mutex> StreamLock{StreamMutex};
----------------
shiltian wrote:

I'm not sure about this function scope lock. Sure, `getStream` can be called by multiple threads but I don't think it should be the responsibility of `getStream` for thread safety. I suppose `AMDGPUStreamManager.getResource` needs to be the one to do it.

https://github.com/llvm/llvm-project/pull/149497


More information about the llvm-commits mailing list