Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2017,8 +2017,8 @@ def TileReductionUsingForallOp :
DefaultValuedAttr<DenseI64ArrayAttr, "{}">:$tile_sizes,
OptionalAttr<DeviceMappingArrayAttr>:$mapping);
let results = (outs Variadic<TransformHandleTypeInterface>:$fill_op,
TransformHandleTypeInterface:$split_linalg_op,
TransformHandleTypeInterface:$combining_linalg_op,
TransformHandleTypeInterface:$split_op,
TransformHandleTypeInterface:$combining_op,
TransformHandleTypeInterface:$forall_op);

let builders = [
Expand All @@ -2042,7 +2042,7 @@ def TileReductionUsingForallOp :
let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::transform::TransformRewriter &rewriter,
::mlir::linalg::LinalgOp target,
Operation *target,
::mlir::transform::ApplyToEachResultList &results,
::mlir::transform::TransformState &state);
}];
Expand Down
15 changes: 11 additions & 4 deletions mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3033,10 +3033,17 @@ void transform::TileReductionUsingForallOp::build(
}

DiagnosedSilenceableFailure transform::TileReductionUsingForallOp::applyToOne(
transform::TransformRewriter &rewriter, LinalgOp target,
transform::TransformRewriter &rewriter, Operation *target,
transform::ApplyToEachResultList &results,
transform::TransformState &state) {
rewriter.setInsertionPoint(target);

auto partialReductionOp = dyn_cast<PartialReductionOpInterface>(target);
if (!partialReductionOp) {
return emitSilenceableFailure(
target->getLoc(),
"Operation should implement PartialReductionOpInterface");
}
SmallVector<OpFoldResult> numThreads =
getAsOpFoldResult(rewriter.getI64ArrayAttr(getNumThreads()));
SmallVector<OpFoldResult> tileSizes =
Expand All @@ -3058,14 +3065,14 @@ DiagnosedSilenceableFailure transform::TileReductionUsingForallOp::applyToOne(
extractFromIntegerArrayAttr<unsigned>(getReductionDims());
if (reductionDims.empty()) {
for (auto [idx, iteratorType] :
llvm::enumerate(target.getIteratorTypesArray())) {
llvm::enumerate(partialReductionOp.getLoopIteratorTypes())) {
if (iteratorType == utils::IteratorType::reduction)
reductionDims.push_back(idx);
}
}
options.setReductionDims(reductionDims);
FailureOr<scf::SCFTilingResult> result = scf::tileUsingSCF(
rewriter, cast<TilingInterface>(target.getOperation()), options);
FailureOr<scf::SCFTilingResult> result =
scf::tileUsingSCF(rewriter, partialReductionOp, options);

if (failed(result)) {
auto diag = emitSilenceableError() << "could not tile reduction";
Expand Down