Newbie question: adding a named attribute to an AffineForOp


I think this is quite a newbie question, but I would appreciate help on it, because the answer is not obvious to me - I most certainly look at the wrong place, but then the project is large.

I want to add named attributes with integer value to AffineForOp objects (like “M_C=64” in Uday’s tutorial).

The most convenient solution would be to modify the AffineForOp in place, adding one more attribute to it. I can’t find how to do it. I’m not even sure it’s possible.

The other solution I thought of was to add annotations upon creation of the AffineForOp, but then there is no “build” function in include/mlir/Dialect/AffineOps/ that takes a list of NamedAttribute objects.

Thanks in advance for your help,

Every operations has a setAttr(Identifier name, Attribute value) method.

1 Like