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

Fabian Mora llvmlistbot at llvm.org
Wed Jul 23 17:41:15 PDT 2025


fabianmcg wrote:

> But... Attributes are just as much C++ construct though

True, and to get good attribute support we currently have to add custom classes https://github.com/llvm/llvm-project/blob/main/mlir/lib/Bindings/Python/DialectGPU.cpp#L47 .

However, even in the absence of those custom bindings it's possible to create attributes in python or C by parsing a string. Something, that's not possible with properties as they there's no generic parsePropertyFromString.

> what's special about properties?

To answer more explicitly, in my view props are a C++ storage detail of the IR element Operation, whereas an attribute is an IR element itself. As such, prop storage doesn't have a well defined meaning outside C++, unlike an Attr, Op or Type that do have a meaning. We could change that, but I don't see a large benefit, and see many potential challenges.


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


More information about the Mlir-commits mailing list