//===- Split.cpp - Structured op splitting --------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Linalg/Transforms/Transforms.h" #include "mlir/Dialect/Utils/StaticValueUtils.h" #include "mlir/IR/AffineExpr.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/OpDefinition.h" #include "mlir/Interfaces/TilingInterface.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" usingnamespacemlir; usingnamespacemlir::linalg; /// Creates a part of the given `op` split along the iteration space `dimension` /// with the given `size` and an optional `offset` (default 0). Makes slices /// of operands, using the input operands of the original op and the output /// operands provided as `resultOperands`. Expects `offsets` and `sizes` to /// define the shape of the iteration space of the original op. Returns the /// split-out op as well as the output operand values updated with the partial /// results produced by this op through `results`. static TilingInterface createSplitPart(RewriterBase &b, Location loc, TilingInterface op, ArrayRef<OpFoldResult> offsets, ArrayRef<OpFoldResult> sizes, ValueRange resultOperands, unsigned dimension, OpFoldResult size, OpFoldResult offset, SmallVectorImpl<Value> &results) { … } std::pair<TilingInterface, TilingInterface> linalg::splitOp(RewriterBase &rewriter, TilingInterface op, unsigned dimension, OpFoldResult splitPoint) { … }