[PATCH] D80734: [mlior][Vector] Fix vector.transfer alignment calculation

Nicolas Vasilache via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 09:15:56 PDT 2020


nicolasvasilache created this revision.
nicolasvasilache added reviewers: ftynse, whchung, aartbik.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80734

Files:
  mlir/include/mlir/Dialect/Vector/VectorOps.h
  mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
  mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80734.266904.patch
Type: text/x-patch
Size: 5466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200528/1129086b/attachment.bin>


More information about the llvm-commits mailing list