[Mlir-commits] [mlir] [MLIR][SCF] Fix LoopPeelOp documentation (NFC) (PR #113179)

Andrzej Warzyński llvmlistbot at llvm.org
Thu Oct 24 08:21:48 PDT 2024


================
@@ -158,12 +158,12 @@ def LoopPeelOp : Op<Transform_Dialect, "loop.peel",
      This operation ignores non-scf::ForOp ops and drops them in the return.
 
      When `peelFront` is true, this operation returns two scf::ForOp Ops, the
-     first scf::ForOp corresponds to the first iteration of the loop which can
-     be canonicalized away in the following optimization. The second loop Op
-     contains the remaining iteration, and the new lower bound is the original
-     lower bound plus the number of steps.
+     first scf::ForOp corresponds to the target loop, whose lower bound has
+     been updated to the original lower bound plus the step. The second result
+     is the first iteration of the loop which can be canonicalized away in the
+     following optimization.
----------------
banach-space wrote:

> The transform op returns 2 forops like :
%iteration1_to_n, %iteration_0= transform.loop.peel %1 {peel_front = true} : (!transform.op<"scf.for">) -> (!transform.op<"scf.for">, !transform.op<"scf.for">)
Whereas the original description suggested %iteration0, %iteration_1_to_n

Yeah, that's clearly not correct, thanks for the example!

> When peelFront is true, this operation returns two scf::ForOp Ops

The op returns two loops regardless of `peelFront`. How about something like this (two avoid repeating that there are two results):

> The op returns two loops, the peeled loop and the remainder loop. 
> 
> When `peelFront` is true, the first scf::ForOp executes all iterations of the target loop but the first one (i.e. the remainder loop). The second scf::ForOp corresponds to the first iteration of the loop which can
be canonicalized away in the following optimizations (the peeled loop). 
> 
> When `peelFront` is false, ...

So basically what you are saying, but a bit shorter and trying to clearly identify the peeled and the remainder loop. Hope I got my terminology right 😅 

Also, apologies for the delay. I am travelling for LLVM Dev this week and trying to prioritise F2F interactions over GitHub. I really appreciate you improving this!

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


More information about the Mlir-commits mailing list