iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.

Home Page:http://iree.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Drop `EncodingRole` enum, replace by operand index

bjacob opened this issue · comments

Currently, one of the fields in the encoding attribute on a tensor is role,

AttrParameter<"EncodingRoleAttr", "role of this tensor as an operand">:$role,

Which is an enum defined in the same file,

def EncodingRole : IREEEncoding_I32EnumAttr<"EncodingRole",
"Describes the role of the tensor as an operand or a result of an operation.", [
LHS,
RHS,
RESULT,
]>;

These values LHS, RHS, etc, don't scale very well to other ops we want to support data-tiling for, such as convolutions, for which we rather talk of input and filter and would then want to add new enumeration values for that.

Instead, this role attribute should just be replaced by the operand index, just an integer (index) attribute. It could be renamed operand_index.

For a matmul: LHS = operand index 0, RHS = operand index 1, RESULT (by which we really meant the accumulator) = operand index 2.

Question - do we want to separate the inputs (ins) from the Inits (outs)? I don't think that's necessary. Just we will have to get used to the result value being encoded as the corresponding init-value (outs[0] => operand index 2 since the outs come after the ins).

implemented in #17708