File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
mlir/lib/Conversion/TosaToLinalg Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -2772,17 +2772,17 @@ void mlir::tosa::populateTosaToLinalgTypeConversion(TypeConverter &converter) {
2772
2772
return type.clone (converted);
2773
2773
});
2774
2774
converter.addSourceMaterialization ([&](OpBuilder &builder, Type resultType,
2775
- ValueRange inputs,
2776
- Location loc) -> std::optional<Value> {
2775
+ ValueRange inputs,
2776
+ Location loc) -> std::optional<Value> {
2777
2777
if (inputs.size () != 1 )
2778
2778
return std::nullopt;
2779
2779
2780
2780
return builder.create <UnrealizedConversionCastOp>(loc, resultType, inputs)
2781
2781
.getResult (0 );
2782
2782
});
2783
2783
converter.addTargetMaterialization ([&](OpBuilder &builder, Type resultType,
2784
- ValueRange inputs,
2785
- Location loc) -> std::optional<Value> {
2784
+ ValueRange inputs,
2785
+ Location loc) -> std::optional<Value> {
2786
2786
if (inputs.size () != 1 )
2787
2787
return std::nullopt;
2788
2788
Original file line number Diff line number Diff line change @@ -794,7 +794,7 @@ class MaxPool2dConverter : public OpConversionPattern<tosa::MaxPool2dOp> {
794
794
795
795
else if (isUnsigned)
796
796
initialAttr = rewriter.getIntegerAttr (
797
- resultETy, APInt::getMinValue (resultETy.getIntOrFloatBitWidth ()));
797
+ resultETy, APInt::getZero (resultETy.getIntOrFloatBitWidth ()));
798
798
else if (isa<IntegerType>(resultETy))
799
799
initialAttr = rewriter.getIntegerAttr (
800
800
resultETy,
@@ -1106,7 +1106,8 @@ class TransposeConverter : public OpRewritePattern<tosa::TransposeOp> {
1106
1106
} // namespace
1107
1107
1108
1108
void mlir::tosa::populateTosaToLinalgNamedConversionPatterns (
1109
- TypeConverter &converter, RewritePatternSet *patterns, const TosaToLinalgNamedOptions &options) {
1109
+ TypeConverter &converter, RewritePatternSet *patterns,
1110
+ const TosaToLinalgNamedOptions &options) {
1110
1111
if (options.preferConv2DKernelLayoutHWCF ) {
1111
1112
patterns->add <ConvConverter<tosa::Conv2DOp, linalg::Conv2DNhwcHwcfOp,
1112
1113
linalg::Conv2DNhwcHwcfQOp>>(
@@ -1125,7 +1126,6 @@ void mlir::tosa::populateTosaToLinalgNamedConversionPatterns(
1125
1126
TransposeConverter
1126
1127
>(patterns->getContext ());
1127
1128
patterns->add <
1128
- // clang-format off
1129
1129
MaxPool2dConverter
1130
1130
>(converter, patterns->getContext ());
1131
1131
patterns->add <
Original file line number Diff line number Diff line change @@ -71,7 +71,8 @@ struct TosaToLinalgNamed
71
71
TosaToLinalgNamedOptions options;
72
72
options.preferConv2DKernelLayoutHWCF = preferConv2DKernelLayoutHWCF;
73
73
options.useMatmulForSingleBatch = useMatmulForSingleBatch;
74
- tosa::populateTosaToLinalgNamedConversionPatterns (converter, &patterns, options);
74
+ tosa::populateTosaToLinalgNamedConversionPatterns (converter, &patterns,
75
+ options);
75
76
if (failed (applyFullConversion (func, target, std::move (patterns))))
76
77
signalPassFailure ();
77
78
}
You can’t perform that action at this time.
0 commit comments