[all-commits] [llvm/llvm-project] 5f9e04: [mlir][Vector] Fix vector.transfer alignment calcu...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Thu May 28 15:04:28 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f9e0466f273602ba3ec5aa886b1bba8dfde66f4
      https://github.com/llvm/llvm-project/commit/5f9e0466f273602ba3ec5aa886b1bba8dfde66f4
  Author: Nicolas Vasilache <ntv at google.com>
  Date:   2020-05-28 (Thu, 28 May 2020)

  Changed paths:
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
    M mlir/include/mlir/Dialect/Vector/VectorOps.h
    M mlir/include/mlir/InitAllPasses.h
    M mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
    M mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
    M mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
    M mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
    M mlir/test/lib/Transforms/CMakeLists.txt
    R mlir/test/lib/Transforms/TestVectorToSCFConversion.cpp
    M mlir/tools/mlir-opt/mlir-opt.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list