[Mlir-commits] [mlir] [mlir][LinAlg] Vectorize reverse-like ops using vector.gather ops. (PR #83205)

Diego Caballero llvmlistbot at llvm.org
Tue Feb 27 16:00:06 PST 2024


================
@@ -891,8 +891,7 @@ static bool isContiguousLoadIdx(LinalgOp &linalgOp, Value &val,
 
   // Conservatively reject Ops that could lead to indices with stride other
   // than 1.
-  if (!isa<arith::AddIOp, arith::SubIOp, arith::ConstantOp, linalg::IndexOp>(
-          ancestor))
+  if (!isa<arith::AddIOp, arith::ConstantOp, linalg::IndexOp>(ancestor))
----------------
dcaballe wrote:

Instead of removing the sub operation we may want to check that the sub is of the form `index - loop_invariant`. This should ensure that the index is monotonically increasing. 

Additionally, we may want this function to return not only true or false but also if the index is an increasing or decreasing  contiguous index. Then, the case sub `loop_invariant - index` should return a decreasing index and we can generate a gather for that case for now. That should leave the code ready to easily generate the proper transfer read.

https://github.com/llvm/llvm-project/pull/83205


More information about the Mlir-commits mailing list