[Mlir-commits] [mlir] [mlir][SCF] Allow using a custom operation to generate loops with `mlir::tileUsingSCF`. (PR #159660)
Quinn Dawkins
llvmlistbot at llvm.org
Fri Sep 19 13:31:03 PDT 2025
================
@@ -117,6 +121,98 @@ struct SCFTilingOptions {
reductionDims.insert(dims.begin(), dims.end());
return *this;
}
+
+ //-------------------------------------------------------------------------//
+ // Options related to tiling using custom loop.
+ //-------------------------------------------------------------------------//
+
+ // For generating the inter-tile loops using a custom loop, two callback
+ // functions are needed
+ // 1. That generates the "loop header", i.e. the loop that iterates over the
+ // different tiles.
+ // 2. That generates the loop terminator
+ //
+ // For `scf.forall` case the call back to generate loop header would generate
+ //
+ // ```mlir
+ // scf.forall (...) = ... {
+ // ..
+ // }
+ // ```
+ //
+ // and the call back to generate the loop terminator would generate the
+ // `scf.in_parallel` region
+ //
+ // ```mlir
+ // scf.forall (...) = ... {
+ // scf.in_parallel {
+ // tensor.parallel_insert_slice ...
+ // }
+ // }
+ // ```
+ //
+
+ // Information that is to be returned by the callback to generate the loop
+ // header needed for the rest of the tiled codegeneration.
+ // - `loops`: The generated loops
+ // - `tileOffset`: The values that represent the offset of the iteration space
+ // tile
+ // - `tileSizes` : The values that represent the size of the iteration space
+ // tile.
+ // - `destinationTensors` : The tensors to use as destinations during tiling.
+ struct CustomLoopHeaderInfo {
+ SmallVector<LoopLikeOpInterface> loops;
+ SmallVector<OpFoldResult> tileOffset;
+ SmallVector<OpFoldResult> tileSizes;
+ SmallVector<Value> destinationTensors;
+ };
+
+ // Type of the callback function that generates the loop headers.
+ // - `loopRanges` : Values that represent the full size of the iteration space
+ // being tiled.
+ // - `giveTileSizes` : The tile sizes that are to be used to tile the
+ // iteration
+ // space.
----------------
qedawkins wrote:
Looks like whitespace got messed up here.
```suggestion
// iteration space.
```
https://github.com/llvm/llvm-project/pull/159660
More information about the Mlir-commits
mailing list