linalg.generic/indexed_generic operations on tensors whose body is
just yielding the (non-induction variable) arguments of the operation
can be canonicalized by replacing uses of the result with the
corresponding arguments.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp | ||
|---|---|---|
| 2127 | nit: would call this RemoveIdentityLinalgOps. | |
| 2133 | Why restrict to only GenericOp/IndexedGenericOp? The justification in DeduplicateInputs::matchAndRewrite doesn't seem to apply. | |
| 2163 | should this more properly be genericOp->getInput(argumentNumber - numIndexArgs)? | |
Address comments
| mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp | ||
|---|---|---|
| 2133 | If a named op is a no-op, then we shouldnt be defining such named ops to begin with right? The Generic/IndexedGeneric ops are free form and after fusion, canonicalization, etc can become a no-op.... | |
| 2163 | There is an interesting corner case where you are returning one of the outs operands without any modification. That is still valid to do I think. So just using operand covers both these cases. | |
nit: would call this RemoveIdentityLinalgOps.