[Mlir-commits] [mlir] 120cd5a - [MLIR] Register all extensions in CAPI's RegisterEverything

Ashay Rane llvmlistbot at llvm.org
Fri Jun 16 19:31:56 PDT 2023


Author: Ashay Rane
Date: 2023-06-16T21:31:42-05:00
New Revision: 120cd5aafca2ccc8b04d208598e817ffc6d0b869

URL: https://github.com/llvm/llvm-project/commit/120cd5aafca2ccc8b04d208598e817ffc6d0b869
DIFF: https://github.com/llvm/llvm-project/commit/120cd5aafca2ccc8b04d208598e817ffc6d0b869.diff

LOG: [MLIR] Register all extensions in CAPI's RegisterEverything

The patch for promised interfaces (a5ef51d7) doesn't register all
extensions in the CAPI's `mlirRegisterAllDialects()` function.  This is
used by the MLIR Python bindings, causing downstream users of the Python
bindings to terminate abruptly.  This patch adds the call to register
all extensions.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D153174

Added: 
    

Modified: 
    mlir/lib/CAPI/RegisterEverything/CMakeLists.txt
    mlir/lib/CAPI/RegisterEverything/RegisterEverything.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/CAPI/RegisterEverything/CMakeLists.txt b/mlir/lib/CAPI/RegisterEverything/CMakeLists.txt
index 55fe49bcef7b0..8b9a39558a03f 100644
--- a/mlir/lib/CAPI/RegisterEverything/CMakeLists.txt
+++ b/mlir/lib/CAPI/RegisterEverything/CMakeLists.txt
@@ -2,6 +2,7 @@
 get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS)
 get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
+get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
 add_mlir_upstream_c_api_library(MLIRCAPIRegisterEverything
   RegisterEverything.cpp
 
@@ -9,6 +10,7 @@ add_mlir_upstream_c_api_library(MLIRCAPIRegisterEverything
   ${dialect_libs}
   ${translation_libs}
   ${conversion_libs}
+  ${extension_libs}
 
   MLIRBuiltinToLLVMIRTranslation
   MLIRCAPIIR

diff  --git a/mlir/lib/CAPI/RegisterEverything/RegisterEverything.cpp b/mlir/lib/CAPI/RegisterEverything/RegisterEverything.cpp
index e4a7516437cb8..b63899bd53a73 100644
--- a/mlir/lib/CAPI/RegisterEverything/RegisterEverything.cpp
+++ b/mlir/lib/CAPI/RegisterEverything/RegisterEverything.cpp
@@ -10,12 +10,14 @@
 
 #include "mlir/CAPI/IR.h"
 #include "mlir/InitAllDialects.h"
+#include "mlir/InitAllExtensions.h"
 #include "mlir/InitAllPasses.h"
 #include "mlir/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.h"
 #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"
 
 void mlirRegisterAllDialects(MlirDialectRegistry registry) {
   mlir::registerAllDialects(*unwrap(registry));
+  mlir::registerAllExtensions(*unwrap(registry));
 }
 
 void mlirRegisterAllLLVMTranslations(MlirContext context) {


        


More information about the Mlir-commits mailing list