This MR add vectorization support for linalg.conv_1D operation.
Details
Diff Detail
Event Timeline
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
2024 | Thanks for your contribution! Can we extract all these if/else into separate static helper functions with the right parameters and proper doc comment? |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
1876–1879 | Can we please not apply demorgan's law ourselves, and let the compiler optimize it if it wants - this condition is getting way too complicated to apply demorgan's law ourself. Instead write it as: if (!((lhsShapedType.getRank() == 3 && resShapedType.getRank() == 3) || (lhsShapedType.getRank() == 3 && resShapedType.getRank() == 3))) return; And that is exactly what the comment says. |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
1876–1879 | if (!((lhsShapedType.getRank() == 3 && resShapedType.getRank() == 3) || (lhsShapedType.getRank() == 1 && resShapedType.getRank() == 1))) return; (Fixed the expression) |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
2024 | Thank you! In this case, should the code look like the following after adding the helper functions? auto lhs = readConvSlice(loc, lhsType, lhsShaped, conv1DOpOrder, oper); auto rhs = readConvSlice(loc, rhsType, rhsType, conv1DOpOrder, oper); auto lhs = readConvSlice(loc, resType, resShaped, conv1DOpOrder, oper); |
Build fails due to "mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp" not formatted (clang-format) properly in the current upstream branch. Not sure if the formatting change should go with this MR.
- Fixed expression to match the comment (not applying demorgan's law ourselves) @vmurali
- Extracted conv_1d if/else into separate static helper functions with the right parameters and proper doc comment @nicolasvasilache
- Fixed a formatting error causing build error (clang format applied to the whole file and not just the diff).
Build fails due to "mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp" not formatted (clang-format) properly in the current upstream branch. Not sure if the formatting change should go with this MR.
Feel free to submit a separate patch with the formatting fixes.
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
2648 | Maybe rename this to generateNonChanneledConv? |
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp | ||
---|---|---|
2648 | Thanks. Renamed! |
I can help land the commit. Your git commit author information is not preserved after I apply the patch locally. Let me know what author information you'd like to put in the landing. E.g., mine is "Hanhan Wang <hanchung@google.com>".
You can either comment the information here or send a mail to hanchung@google.com. Both work for me.
Thank you very much @hanchung.
Author information: "Devajith Valaparambil Sreeramaswamy <devajith.sreeramaswamy@huawei.com>".
Same for the patch https://reviews.llvm.org/D145162.
Move loop invariant ArrayRefs to SmallVectors outside the loop?