llvm-project/mlir/lib
Diego Caballero 917d95fc8a [mlir][Vector] Improve default lowering of vector transpose operations
The default lowering of vector transpose operations generates a large sequence of
scalar extract/insert operations, one pair for each scalar element in the input tensor.
In other words, the vector transpose is scalarized. However, there are transpose
patterns where one or more adjacent high-order dimensions are not transposed (for
example, in the transpose pattern [1, 0, 2, 3], dimensions 2 and 3 are not transposed).
This patch improves the lowering of those cases by not scalarizing them and extracting/
inserting a full n-D vector, where 'n' is the number of adjacent high-order dimensions
not being transposed. By doing so, we prevent the scalarization of the code and generate a
more performant vector version.

Paradoxically, this patch shouldn't improve the performance of transpose operations if
we are using LLVM. The LLVM pipeline is able to optimize away some of the extract/insert
operations and the SLP vectorizer is converting the scalar operations back to its vector
form. However, scalarizing a vector version of the code in MLIR and relying on the SLP
vectorizer to reconstruct the vector code again is highly undesirable for several reasons.

Reviewed By: nicolasvasilache, ThomasRaoux

Differential Revision: https://reviews.llvm.org/D120601
2022-03-07 17:56:02 +00:00
..
Analysis [MLIR][Presburger][NFC] Fix PresburgerLocalSpace::print() output 2022-03-06 16:42:20 +05:30
Bindings/Python [mlir][python] Support more types in IntegerAttr.value 2022-02-24 10:26:31 +01:00
CAPI [mlir][NFC] Move Parser.h to Parser/ 2022-03-07 01:05:38 -08:00
Conversion [mlir][NFC] Move Translation.h to a Tools/mlir-translate directory 2022-03-07 01:05:38 -08:00
Dialect [mlir][Vector] Improve default lowering of vector transpose operations 2022-03-07 17:56:02 +00:00
ExecutionEngine Partially revert 03e6d10cac86: it broke the build 2022-03-07 11:18:20 +00:00
IR [mlir] Fix dumping invalid ops 2022-03-07 08:32:31 -08:00
Interfaces [mlir] Region/BranchOpInterface: Allow implicit type conversions along control-flow edges 2022-03-04 20:33:14 +00:00
Parser Apply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC) 2022-03-07 10:41:44 +00:00
Pass Apply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC) 2022-03-07 10:41:44 +00:00
Reducer Apply clang-tidy fixes for performance-move-const-arg in ReductionNode.cpp (NFC) 2022-01-10 01:05:14 +00:00
Rewrite [MLIR][PDL] Fix C++20 build. concept is a new keyword. NFC. 2022-02-21 18:37:19 +01:00
Support [mlir][NFC] Move MlirOptMain to the Tools/ directory 2022-03-07 01:05:38 -08:00
TableGen [PDLL] Add support for tablegen includes and importing ODS information 2022-03-03 16:14:03 -08:00
Target [mlir][NFC] Move Translation.h to a Tools/mlir-translate directory 2022-03-07 01:05:38 -08:00
Tools Apply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC) 2022-03-07 10:41:44 +00:00
Transforms Apply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC) 2022-03-07 10:41:44 +00:00
CMakeLists.txt [mlir][NFC] Move Translation.h to a Tools/mlir-translate directory 2022-03-07 01:05:38 -08:00