[Mlir-commits] [mlir] [mlir][scf]: Avoid inserting affine.min when tiling dynamic operation sizes if possible (PR #113819)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 28 17:15:48 PDT 2024


================
@@ -186,11 +186,35 @@ static void checkSafeToTileToForall(TilingInterface op,
   }
 }
 
+/// Returns true if `size` is dynamic multiplication of `stride`.
----------------
MaheshRavishankar wrote:

Ok, I see what you are trying. I am not a fan of this kind of piecemeal approaches. I tried something. I changed your input to use affine maps. Still didnt work. I get something like this
```
%1 = affine.apply affine_map<()[s0] -> ((s0 floordiv 80) * 80)>()[%dim]
%3 = scf.for %arg2 = %c0 to %1 step %c80 iter_args(%arg3 = %extracted_slice_1) -> (tensor<?xi16>) {
      %5 = affine.min affine_map<(d0)[s0] -> (-d0 + (s0 floordiv 80) * 80, 80)>(%arg2)[%dim]
```

IIRC adding `--scf-for-loop-canonicalization` should have fixed the problem, but it didnt

cc @matthias-springer  I thought this was fixed at some time.

Anyway, I am OK with this patch overall given where things are, but this needs to account for the lower bound of the loop as well.

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


More information about the Mlir-commits mailing list