[Mlir-commits] [mlir] [mlir] Allow dialect registry updates in a single-threaded context (PR #101119)
Nikhil Kalra
llvmlistbot at llvm.org
Mon Jul 29 20:57:02 PDT 2024
https://github.com/nikalra created https://github.com/llvm/llvm-project/pull/101119
The current `assert` in `MLIRContext::appendDialectRegistry` effectively prevents passes that leverage complex dialects (i.e. dialects with extensions) from being used in a dynamic pass pipeline. More specifically, `registry.isSubsetOf` automatically returns `false` for any dialect registry that has dialect extensions registered, even if the dialects and extensions have already been loaded into the current context.
This change relaxes the assert such that the context dialect registry can be updated inside of a dynamic pass pipeline when in single-threaded mode.
>From 6b7065293e0f811219de2344efd317cb372bb3e9 Mon Sep 17 00:00:00 2001
From: Nikhil Kalra <nkalra at apple.com>
Date: Mon, 29 Jul 2024 20:52:56 -0700
Subject: [PATCH] allow dialect registry updates for single-threaded
---
mlir/lib/IR/MLIRContext.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp
index 12336701c9ca0..14316874e4743 100644
--- a/mlir/lib/IR/MLIRContext.cpp
+++ b/mlir/lib/IR/MLIRContext.cpp
@@ -410,9 +410,10 @@ void MLIRContext::appendDialectRegistry(const DialectRegistry ®istry) {
if (registry.isSubsetOf(impl->dialectsRegistry))
return;
- assert(impl->multiThreadedExecutionContext == 0 &&
- "appending to the MLIRContext dialect registry while in a "
- "multi-threaded execution context");
+ assert(!impl->threadingIsEnabled ||
+ impl->multiThreadedExecutionContext == 0 &&
+ "appending to the MLIRContext dialect registry while in a "
+ "multi-threaded execution context");
registry.appendTo(impl->dialectsRegistry);
// For the already loaded dialects, apply any possible extensions immediately.
More information about the Mlir-commits
mailing list