This doesn't add any canonicalizations, but executes the same
simplification on bufferSemantic linalg.generic ops by using
linalg::ReshapeOp instead of linalg::TensorReshapeOp.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Interesting that this makes it work for memref types. A quick glance at it, it looks mostly OK. One of the things though is that I am not sure how valid this will be when we have memref with strides. Maybe to be conservative, only do this when the operands dont have memrefs with affine maps?
Have a comment above (clicked enter early there). Will review more, but if we are going down this path, do we just replicate all the tests here for tensors with memrefs as well?
If it's agreed upon as an acceptable idea, I can create a clone of all relevant tests (with an additional mixed mode that would be supported in the latest patch). Primarily I don't want to do the additional work while there is risk of it being discarded.
Good catch. This is added. To add the additional check no longer creates the simple templating, so I needed to setup 2 classes with mostly shared functionality or to have one class do everything. I went with a single class because this also supports linalg.generics with mixed types.
Also, please feel free to add any other reviewers if they are appropriate. I wasn't sure who was appropriate as refactors have created many authors of this file.
LGTM-ing this. But needs to rebased on ToT before landing.
mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp | ||
---|---|---|
370 | Nit: please use { } when the body spans multiple lines (even though its one statement) | |
371 | This might not work on ToT now since reshape and tensor_reshape are split into collapse_* and expand_* variants. Suggest moving the reshape generation logic (to compute the reshapedValue ) into a separate method. |
Nit: please use { } when the body spans multiple lines (even though its one statement)