[PATCH] D78580: [MLIR] Add extra locking during cubin generation.

Stephan Herhut via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 00:30:08 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc22876b550f5: [MLIR] Add extra locking during cubin generation. (authored by herhut).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78580/new/

https://reviews.llvm.org/D78580

Files:
  mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp


Index: mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
===================================================================
--- mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
+++ mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
@@ -31,6 +31,7 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/Mutex.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
@@ -57,6 +58,12 @@
   void runOnOperation() override {
     gpu::GPUModuleOp module = getOperation();
 
+    // Lock access to the llvm context.
+    llvm::sys::SmartScopedLock<true> scopedLock(
+        module.getContext()
+            ->getRegisteredDialect<LLVM::LLVMDialect>()
+            ->getLLVMContextMutex());
+
     // Make sure the NVPTX target is initialized.
     LLVMInitializeNVPTXTarget();
     LLVMInitializeNVPTXTargetInfo();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78580.259183.patch
Type: text/x-patch
Size: 980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200422/2a7b11a2/attachment.bin>


More information about the llvm-commits mailing list