OSDN Git Service

[mlir][Vector] Fix vector.transfer alignment calculation
authorNicolas Vasilache <ntv@google.com>
Thu, 28 May 2020 21:55:21 +0000 (17:55 -0400)
committerNicolas Vasilache <ntv@google.com>
Thu, 28 May 2020 21:58:51 +0000 (17:58 -0400)
commit5f9e0466f273602ba3ec5aa886b1bba8dfde66f4
tree8f07b49916b13f43f7351a4f2c26319c8fbf5b4c
parent10bb03c1c1901de225352814e0e51096b3d4c656
[mlir][Vector] Fix vector.transfer alignment calculation

https://reviews.llvm.org/D79246 introduces alignment propagation for vector transfer operations. Unfortunately, the alignment calculation is incorrect and can result in crashes.

This revision fixes the calculation by using the natural alignment of the memref elemental type, instead of the resulting vector type.

If more alignment is desired, it can be done in 2 ways:
1. use a proper vector.type_cast to transform a memref<axbxcxdxf32> into a memref<axbxvector<cxdxf32>> giving a natural alignment of vector<cxdxf32>
2. add an alignment attribute to vector transfer operations and propagate it.

With this change the alignment in the relevant tests goes down from 128 to 4.

Lastly, a few minor cleanups are performed and the custom `isMinorIdentityMap` is deprecated.

Differential Revision: https://reviews.llvm.org/D80734
mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
mlir/include/mlir/Dialect/Vector/VectorOps.h
mlir/include/mlir/InitAllPasses.h
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
mlir/test/lib/Transforms/CMakeLists.txt
mlir/test/lib/Transforms/TestVectorToSCFConversion.cpp [deleted file]
mlir/tools/mlir-opt/mlir-opt.cpp