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) {
27722772 return type.clone (converted);
27732773 });
27742774 converter.addSourceMaterialization ([&](OpBuilder &builder, Type resultType,
2775- ValueRange inputs,
2776- Location loc) -> std::optional<Value> {
2775+ ValueRange inputs,
2776+ Location loc) -> std::optional<Value> {
27772777 if (inputs.size () != 1 )
27782778 return std::nullopt ;
27792779
27802780 return builder.create <UnrealizedConversionCastOp>(loc, resultType, inputs)
27812781 .getResult (0 );
27822782 });
27832783 converter.addTargetMaterialization ([&](OpBuilder &builder, Type resultType,
2784- ValueRange inputs,
2785- Location loc) -> std::optional<Value> {
2784+ ValueRange inputs,
2785+ Location loc) -> std::optional<Value> {
27862786 if (inputs.size () != 1 )
27872787 return std::nullopt ;
27882788
Original file line number Diff line number Diff line change @@ -794,7 +794,7 @@ class MaxPool2dConverter : public OpConversionPattern<tosa::MaxPool2dOp> {
794794
795795 else if (isUnsigned)
796796 initialAttr = rewriter.getIntegerAttr (
797- resultETy, APInt::getMinValue (resultETy.getIntOrFloatBitWidth ()));
797+ resultETy, APInt::getZero (resultETy.getIntOrFloatBitWidth ()));
798798 else if (isa<IntegerType>(resultETy))
799799 initialAttr = rewriter.getIntegerAttr (
800800 resultETy,
@@ -1106,7 +1106,8 @@ class TransposeConverter : public OpRewritePattern<tosa::TransposeOp> {
11061106} // namespace
11071107
11081108void mlir::tosa::populateTosaToLinalgNamedConversionPatterns (
1109- TypeConverter &converter, RewritePatternSet *patterns, const TosaToLinalgNamedOptions &options) {
1109+ TypeConverter &converter, RewritePatternSet *patterns,
1110+ const TosaToLinalgNamedOptions &options) {
11101111 if (options.preferConv2DKernelLayoutHWCF ) {
11111112 patterns->add <ConvConverter<tosa::Conv2DOp, linalg::Conv2DNhwcHwcfOp,
11121113 linalg::Conv2DNhwcHwcfQOp>>(
@@ -1125,7 +1126,6 @@ void mlir::tosa::populateTosaToLinalgNamedConversionPatterns(
11251126 TransposeConverter
11261127 >(patterns->getContext ());
11271128 patterns->add <
1128- // clang-format off
11291129 MaxPool2dConverter
11301130 >(converter, patterns->getContext ());
11311131 patterns->add <
Original file line number Diff line number Diff line change @@ -71,7 +71,8 @@ struct TosaToLinalgNamed
7171 TosaToLinalgNamedOptions options;
7272 options.preferConv2DKernelLayoutHWCF = preferConv2DKernelLayoutHWCF;
7373 options.useMatmulForSingleBatch = useMatmulForSingleBatch;
74- tosa::populateTosaToLinalgNamedConversionPatterns (converter, &patterns, options);
74+ tosa::populateTosaToLinalgNamedConversionPatterns (converter, &patterns,
75+ options);
7576 if (failed (applyFullConversion (func, target, std::move (patterns))))
7677 signalPassFailure ();
7778 }
You can’t perform that action at this time.
0 commit comments