Hi,
Is there a way to tell from a given linalg.GenericOp that it actually implements a tosa.ReduceSum
(of other tosa reduce) operation for a single axis of the input tensor?
I guess I can do it by analyzing the affine maps, and determining that all is identity, except for one axis which is missing on the reduced output tensor, but maybe there is a simple way?
(I’m writing a pass which runs right after tosa-to-linalg)
I would also highly encourage you to create passes an abstraction that have the required information readily available instead of attempting to recover it after it was destroyed. For example, Linalg has an explicit reduction operation – 'linalg' Dialect - MLIR – that could be lowered to instead of using the generic.
No worries, the explanation is pretty straightforward. The linalg.reduce op did not exist when tosa-to-linalg was written . Happy to review a patch to port over to linalg.reduce.