Remove MLIR C-API explicit registration of standard ops.
authorStella Laurenzo <stellaraccident@gmail.com>
Wed, 23 Sep 2020 15:13:30 +0000 (08:13 -0700)
committerStella Laurenzo <stellaraccident@gmail.com>
Wed, 23 Sep 2020 16:23:11 +0000 (09:23 -0700)
* Added mlirRegisterAllDialects() to the python API until a more complete registration design emerges for it.

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

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

index 3fad701..99b00b9 100644 (file)
@@ -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);
 }
 
index 3f5c7cf..3b99f8a 100644 (file)
@@ -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);
 }