#include <optional>
#include <utility>
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/Utils/Utils.h"
#include "mlir/IR/PatternMatch.h"
usingnamespacemlir;
usingnamespacemlir::linalg;
FailureOr<SplitReductionResult> mlir::linalg::splitReduction(
RewriterBase &b, LinalgOp op,
const ControlSplitReductionFn &controlSplitReductionFn, bool useAlloc) { … }
static AffineMap scaleReductionDim(LinalgOp op, OpOperand &opOperand,
unsigned reductionDimPos,
int64_t reductionRatio) { … }
static AffineMap insertParallelDim(LinalgOp op, OpOperand &opOperand,
unsigned reductionDimPos, int64_t size) { … }
FailureOr<SplitReductionResult> mlir::linalg::splitReductionByScaling(
RewriterBase &b, LinalgOp op,
const ControlSplitReductionFn &controlSplitReductionFn, bool useAlloc) { … }
namespace {
struct LinalgSplitReduction : public OpInterfaceRewritePattern<LinalgOp> { … };
}
void linalg::populateSplitReductionPattern(
RewritePatternSet &patterns,
const ControlSplitReductionFn &controlSplitReductionFn, bool useAlloc) { … }