[Mlir-commits] [mlir] [mlir] load dialects for non-namespaced attrs (PR #96242)

Jeremy Kun llvmlistbot at llvm.org
Thu Jun 20 15:28:19 PDT 2024


================
@@ -411,9 +412,28 @@ void DefFormat::genVariableParser(ParameterElement *el, FmtContext &ctx,
   auto customParser = param.getParser();
   auto parser =
       customParser ? *customParser : StringRef(defaultParameterParser);
+
+  // If the variable points to a dialect specific entity (type of attribute),
+  // we force load the dialect now before trying to parse it.
+  std::string dialectLoading;
+  if (auto *defInit = dyn_cast<llvm::DefInit>(param.getDef())) {
+    auto *dialectValue = defInit->getDef()->getValue("dialect");
----------------
j2kun wrote:

This line was the key. I didn't know how to get from the attribute argument's def to the def for the underlying attribute itself.

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


More information about the Mlir-commits mailing list