[Mlir-commits] [mlir] b522f09 - Remove MLIR C-API explicit registration of standard ops.

Stella Laurenzo llvmlistbot at llvm.org
Wed Sep 23 09:24:12 PDT 2020


Author: Stella Laurenzo
Date: 2020-09-23T09:23:11-07:00
New Revision: b522f09d963b50895f8c18d33e6a5aceccc1fadc

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

LOG: Remove MLIR C-API explicit registration of standard ops.

* Added mlirRegisterAllDialects() to the python API until a more complete registration design emerges for it.

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

Added: 
    

Modified: 
    mlir/lib/Bindings/Python/IRModules.cpp
    mlir/lib/CAPI/IR/IR.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bindings/Python/IRModules.cpp b/mlir/lib/Bindings/Python/IRModules.cpp
index 3fad701d1641..99b00b96b974 100644
--- a/mlir/lib/Bindings/Python/IRModules.cpp
+++ b/mlir/lib/Bindings/Python/IRModules.cpp
@@ -9,6 +9,7 @@
 #include "IRModules.h"
 #include "PybindUtils.h"
 
+#include "mlir-c/Registration.h"
 #include "mlir-c/StandardAttributes.h"
 #include "mlir-c/StandardTypes.h"
 #include "llvm/ADT/SmallVector.h"
@@ -454,6 +455,7 @@ PyMlirContext::~PyMlirContext() {
 
 PyMlirContext *PyMlirContext::createNewContextForInit() {
   MlirContext context = mlirContextCreate();
+  mlirRegisterAllDialects(context);
   return new PyMlirContext(context);
 }
 

diff  --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp
index 3f5c7cf8986c..3b99f8ac4748 100644
--- a/mlir/lib/CAPI/IR/IR.cpp
+++ b/mlir/lib/CAPI/IR/IR.cpp
@@ -10,7 +10,6 @@
 
 #include "mlir/CAPI/IR.h"
 #include "mlir/CAPI/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
 #include "mlir/IR/Attributes.h"
 #include "mlir/IR/Dialect.h"
 #include "mlir/IR/Module.h"
@@ -26,10 +25,6 @@ using namespace mlir;
 
 MlirContext mlirContextCreate() {
   auto *context = new MLIRContext(/*loadAllDialects=*/false);
-  // TODO: Come up with a story for which dialects to load into the context
-  // and do not expand this beyond StandardOps until done so. This is loaded
-  // by default here because it is hard to make progress otherwise.
-  context->loadDialect<StandardOpsDialect>();
   return wrap(context);
 }
 


        


More information about the Mlir-commits mailing list