[Mlir-commits] [mlir] [mlir][IR] Add `getPropertyAsAttr` and `setPropertyFromAttr` methods. (PR #150060)

Mehdi Amini llvmlistbot at llvm.org
Tue Jul 29 05:23:22 PDT 2025


joker-eph wrote:

> IMO, the semantics and meaning of an attr are owned by the attr, while for a prop they are owned (let's say jointly) by the op.

You're not following up on everything I asked: I mentioned the example of the IntegerAttr to rebute this.
The meaning of an IntegerAttr does not seems different from the meaning of an `IntegerProp`!
And I argue the same for EnumAttr vs EnumProp.

An attribute is just like a property: it is only storing some data. All of these get semantics only in conjunction with an operation: the semantics is part of the op definition.

The distinction you're making is artificial and does not exist in my mental model.

> An attribute is a standalone unit, that can be parsed, printed

Sure, we've already covered this: it is **only** a matter of mnemnonic and registration though.

> stored generically

generically? I don't think so: every attribute comes with a custom storage mechanism, no different than properties. It even have the extra constraints that it needs to be "uniquable".
There is no generic introspection for attribute: their content is just as opaque as c++ property.

> and have interfaces. 

Yes, interfaces is basically the main blocker to avoid using an Attribute in some cases. But I don't quite see how that would help this PR.


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


More information about the Mlir-commits mailing list