[Mlir-commits] [mlir] [MLIR][SCF] Fix LoopPeelOp documentation (NFC) (PR #113179)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Oct 28 03:29:13 PDT 2024
================
@@ -156,18 +156,19 @@ def LoopPeelOp : Op<Transform_Dialect, "loop.peel",
#### Return modes
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.
-
- When `peelFront` is not true, this operation returns two scf::ForOp Ops, with the first
- scf::ForOp satisfying: "the loop trip count is divisible by the step".
- The second loop Op contains the remaining iteration. Note that even though the
- Payload IR modification may be performed in-place, this operation consumes
- the operand handle and produces a new one.
+ The op returns two loops, the peeled loop whose tripcount is divisible by
+ the step and the remainder loop.
+
+ When `peelFront` is true, the first scf::ForOp (the remainder loop)
+ executes all iterations of the target loop but the first one. 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, the first result (peeled loop) is "the loop
+ with the highest upper bound that is divisible by the step". The second
+ loopOp (remainder loop) contains the remaining iterations. Note that even
+ though the Payload IR modification may be performed in-place, this
+ operation consumes the operand handle and produces a new one.
----------------
banach-space wrote:
This is a massive improvement, thanks! This is already so much clearer đ€©
I have a few small suggestions.
* "first scf:ForOp" vs "first result" -> let's stick to one style
* "Note that even though the Payload IR modification may be performed in-place ..." -> IIUC, this applies to both paragraphs (i.e. when `peelFront` is true and `false`?) So it should probably be a separate paragraph.
* punctuation.
```suggestion
The op returns two loops: the peeled loop, which has trip count divisible by
the step, and the remainder loop.
When `peelFront` is true, the first result (remainder loop)
executes all but the first iteration of the target loop. The second
result (peeled loop) corresponds to the first iteration of the target loop, which can
later be canonicalized away in the following optimizations.
When `peelFront` is false, the first result (peeled loop) is the portion of the target
loop with the highest upper bound that is divisible by the step. The second
result (remainder loop) contains the remaining iterations.
Note that although the Payload IR modification may be done
in-place, this operation consumes the operand handle and produces
a new one.
```
https://github.com/llvm/llvm-project/pull/113179
More information about the Mlir-commits
mailing list