aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/CAPI
diff options
context:
space:
mode:
authorMehdi Amini <joker.eph@gmail.com>2020-08-14 08:27:22 +0000
committerMehdi Amini <joker.eph@gmail.com>2020-08-14 09:40:27 +0000
commitebf521e78483693e5cc9ba4ad3298f0397923624 (patch)
tree76d50bb2ffc61fd346640f6532457a2730e3fe70 /mlir/test/CAPI
parentde9e85026fcb7c3e992f12a86594fd50bb101ad3 (diff)
downloadllvm-ebf521e78483693e5cc9ba4ad3298f0397923624.zip
llvm-ebf521e78483693e5cc9ba4ad3298f0397923624.tar.gz
llvm-ebf521e78483693e5cc9ba4ad3298f0397923624.tar.bz2
Separate the Registration from Loading dialects in the Context
This changes the behavior of constructing MLIRContext to no longer load globally registered dialects on construction. Instead Dialects are only loaded explicitly on demand: - the Parser is lazily loading Dialects in the context as it encounters them during parsing. This is the only purpose for registering dialects and not load them in the context. - Passes are expected to declare the dialects they will create entity from (Operations, Attributes, or Types), and the PassManager is loading Dialects into the Context when starting a pipeline. This changes simplifies the configuration of the registration: a compiler only need to load the dialect for the IR it will emit, and the optimizer is self-contained and load the required Dialects. For example in the Toy tutorial, the compiler only needs to load the Toy dialect in the Context, all the others (linalg, affine, std, LLVM, ...) are automatically loaded depending on the optimization pipeline enabled.
Diffstat (limited to 'mlir/test/CAPI')
-rw-r--r--mlir/test/CAPI/ir.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c
index d6ab351..df2d32f 100644
--- a/mlir/test/CAPI/ir.c
+++ b/mlir/test/CAPI/ir.c
@@ -243,6 +243,7 @@ static void printFirstOfEach(MlirOperation operation) {
int main() {
mlirRegisterAllDialects();
MlirContext ctx = mlirContextCreate();
+ mlirContextLoadAllDialects(ctx);
MlirLocation location = mlirLocationUnknownGet(ctx);
MlirModule moduleOp = makeAdd(ctx, location);