[Mlir-commits] [mlir] [mlir-python] Fix duplicate EnumAttr builder registration across dialects. (PR #187191)
Jacques Pienaar
llvmlistbot at llvm.org
Wed Mar 18 22:57:47 PDT 2026
================
@@ -94,7 +99,11 @@ static bool emitAttributeBuilder(const EnumInfo &enumInfo, raw_ostream &os) {
return false;
int64_t bitwidth = enumInfo.getBitwidth();
- os << formatv("@register_attribute_builder(\"{0}\")\n",
+ // These builders may be emitted by multiple dialect enum_gen files when
+ // dialects share enum definitions via .td includes. Use allow_existing=True
+ // so that the first loaded dialect registers the builder and subsequent
+ // loads silently skip (first-registration wins).
----------------
jpienaar wrote:
This as a default is a bit surprising for me, seems to be most permissive. What options did you consider and why is this preferred?
https://github.com/llvm/llvm-project/pull/187191
More information about the Mlir-commits
mailing list