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

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 08:56: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};
----------------
RossBrunton wrote:

@shiltian @kevinsala @jhuber6 Going to resolve this thread.

There is now a helper function `GetOrInit` which locks the Async Info's mutex before allocating a new stream (preventing multiple simultaneous creates). Hopefully that addresses your concerns, and if not feel free to reopen.

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


More information about the llvm-commits mailing list