[Mlir-commits] [mlir] [mlir] add MlirOptMain config callback for context configuration (PR #68228)

Mehdi Amini llvmlistbot at llvm.org
Wed Oct 4 16:52:32 PDT 2023


================
@@ -176,6 +189,10 @@ class MlirOptMainConfig {
   /// general.
   bool allowUnregisteredDialectsFlag = false;
 
+  /// The callback for additional configuration of the MLIR context after it has
+  /// been created and populated from the registry.
+  std::function<LogicalResult(MLIRContext &)> contextConfigurationCallback;
+
----------------
joker-eph wrote:

It's perfectly fine to fork a restrictive API if it you have exotic use-cases that don't fit the abstraction.

The OptMain API has evolved based on the service intended to be provided by `*-opt` tools, and the experience from setting up many of them. Ultimately we consolidate behind some formal API with a config abstraction that was enough to support all the known cases (while providing a "safe" abstraction to set up consistent tool).

This restrictive API is wrapping lower level APIs, which all remain available to any tool that isn't fitting the `mlir-opt` contract (back to forking?)


https://github.com/llvm/llvm-project/pull/68228


More information about the Mlir-commits mailing list