[all-commits] [llvm/llvm-project] 7a078b: [mlir][linalg] Refine how contiguous loads are ide...

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Wed Mar 8 00:24:06 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a078b65fb880eb97bb47a26e938cdbd23531688
      https://github.com/llvm/llvm-project/commit/7a078b65fb880eb97bb47a26e938cdbd23531688
  Author: Andrzej Warzynski <andrzej.warzynski at gmail.com>
  Date:   2023-03-08 (Wed, 08 Mar 2023)

  Changed paths:
    M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
    M mlir/test/Dialect/Linalg/vectorization.mlir

  Log Message:
  -----------
  [mlir][linalg] Refine how contiguous loads are identified

Vectorization of `tensor.extract` using contiguous loads
(`vector.transfer_read`) was introduced in [1]. This patch updates and
refines the existing logic (so that more cases of contiguous can be
identified), as well as adds more tests.

Specifically, contiguous load operations are identified by making sure
that:
  1. non-trailing indices for `tensor.extract` are loop invariant (so,
     e.g., there are no "jumps" from one row to the other between
     iterations),
  2. the trailing index for `tensor.extract` increments by 1 with every
     loop iteration (so that it's always adjacent elements that are
     loaded).
This patch introduces:
  * `isLoopInvariantIdx` for step 1., and
  * `isContiguousLoadIdx` for step 2.
These new methods replace:
  * `isContiguousLoadIdx`, and `isBasedOnIndexOp`.

Both approaches lead to similar end-result (none of the existing tests
required updating). However, with the updated approach, it's much easier
to treat the trailing and non-trailing indices separately and to add
more cases for which contiguous loads can be used.

[1] https://reviews.llvm.org/D141998

Differential Revision: https://reviews.llvm.org/D145385




More information about the All-commits mailing list