From c6876b4e2165ac07831c1158c2ac9fb71167f98b Mon Sep 17 00:00:00 2001 From: Jerry-Ge Date: Thu, 26 Sep 2024 13:33:05 -0700 Subject: [PATCH] Update input names from input to input1 for Table, Reverse, Slice (#109807) - For input naming consistency, updated the inputs to input1 for Table, Reverse and Slice operator Signed-off-by: Jerry Ge --- mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td | 8 ++++---- mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp | 4 ++-- mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp | 4 ++-- mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp | 14 +++++++------- mlir/lib/Dialect/Tosa/IR/TosaOps.cpp | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td index 539b7cd0b7426..07402c8695b38 100644 --- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td +++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td @@ -881,7 +881,7 @@ def Tosa_TableOp : Tosa_InferShapedTypeOp<"table"> { }]; let arguments = (ins - Tosa_Tensor: $input, + Tosa_Tensor: $input1, Tosa_Tensor1D: $table ); @@ -890,7 +890,7 @@ def Tosa_TableOp : Tosa_InferShapedTypeOp<"table"> { ); let assemblyFormat = [{ - $input `,` $table attr-dict `:` `(` type($input) `,` type($table) `)` `->` type($output) + $input1 `,` $table attr-dict `:` `(` type($input1) `,` type($table) `)` `->` type($output) }]; let hasVerifier = 1; @@ -1640,7 +1640,7 @@ def Tosa_ReverseOp: Tosa_Op<"reverse", [ }]; let arguments = (ins - Tosa_Tensor:$input, + Tosa_Tensor:$input1, I32Attr:$axis ); @@ -1667,7 +1667,7 @@ def Tosa_SliceOp : Tosa_InferShapedTypeOp<"slice"> { }]; let arguments = (ins - Tosa_Tensor:$input, + Tosa_Tensor:$input1, DenseI64ArrayAttr:$start, DenseI64ArrayAttr:$size ); diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp index 93e284af05188..01fdd57260797 100644 --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp @@ -1830,7 +1830,7 @@ class ReverseConverter : public OpRewritePattern { LogicalResult matchAndRewrite(tosa::ReverseOp op, PatternRewriter &rewriter) const final { auto loc = op.getLoc(); - Value input = op.getInput(); + Value input = op.getInput1(); auto inputTy = cast(input.getType()); auto resultTy = cast(op.getType()); auto axis = op.getAxis(); @@ -2161,7 +2161,7 @@ class TableConverter : public OpRewritePattern { LogicalResult matchAndRewrite(tosa::TableOp op, PatternRewriter &rewriter) const final { auto loc = op.getLoc(); - Value input = op.getInput(); + Value input = op.getInput1(); Value table = op.getTable(); auto inputTy = cast(input.getType()); auto tableTy = cast(table.getType()); diff --git a/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp b/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp index c0c015ab34aab..3f104ed1e3f7f 100644 --- a/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp +++ b/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp @@ -144,7 +144,7 @@ TensorType inferReshapeCollapsedType(TensorType lhsType, TensorType rhsType) { for (; currRhsDim < rhsShape.size(); currRhsDim++) { assert(rhsShape[currRhsDim] == 1); } - + return lhsType.clone(intermediateShape); } @@ -264,7 +264,7 @@ class SliceConverter : public OpConversionPattern { matchAndRewrite(tosa::SliceOp sliceOp, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const final { Location loc = sliceOp.getLoc(); - Value input = adaptor.getInput(); + Value input = adaptor.getInput1(); ShapedType resultType = cast(sliceOp.getType()); if (llvm::isa(resultType)) return failure(); diff --git a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp index c62942e1be78e..dbd573f96a79f 100644 --- a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp +++ b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp @@ -380,7 +380,7 @@ struct ConcatSliceOptimization : public OpRewritePattern { LogicalResult matchAndRewrite(tosa::SliceOp sliceOp, PatternRewriter &rewriter) const override { - Value sliceInput = sliceOp.getInput(); + Value sliceInput = sliceOp.getInput1(); auto concatOp = sliceInput.getDefiningOp(); if (!concatOp) return rewriter.notifyMatchFailure( @@ -919,11 +919,11 @@ OpFoldResult ResizeOp::fold(FoldAdaptor adaptor) { } OpFoldResult ReverseOp::fold(FoldAdaptor adaptor) { - auto operand = getInput(); + auto operand = getInput1(); auto operandTy = llvm::cast(operand.getType()); auto axis = getAxis(); auto operandAttr = - llvm::dyn_cast_if_present(adaptor.getInput()); + llvm::dyn_cast_if_present(adaptor.getInput1()); if (operandAttr) return operandAttr; @@ -936,16 +936,16 @@ OpFoldResult ReverseOp::fold(FoldAdaptor adaptor) { } OpFoldResult SliceOp::fold(FoldAdaptor adaptor) { - auto inputTy = llvm::dyn_cast(getInput().getType()); + auto inputTy = llvm::dyn_cast(getInput1().getType()); auto outputTy = llvm::dyn_cast(getType()); if (!inputTy || !outputTy) return {}; if (inputTy == outputTy && inputTy.hasStaticShape()) - return getInput(); + return getInput1(); - if (!adaptor.getInput()) + if (!adaptor.getInput1()) return {}; // Cannot create an ElementsAttr from non-int/float/index types @@ -953,7 +953,7 @@ OpFoldResult SliceOp::fold(FoldAdaptor adaptor) { !outputTy.getElementType().isIntOrIndexOrFloat()) return {}; - auto operand = llvm::cast(adaptor.getInput()); + auto operand = llvm::cast(adaptor.getInput1()); if (operand.isSplat() && outputTy.hasStaticShape()) { return SplatElementsAttr::get(outputTy, operand.getSplatValue()); } diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp index 7f740be4efb4f..1f3e19fe90c6d 100644 --- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp +++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp @@ -850,7 +850,7 @@ LogicalResult tosa::SliceOp::inferReturnTypeComponents( } LogicalResult tosa::SliceOp::verify() { - auto inputType = llvm::dyn_cast(getInput().getType()); + auto inputType = llvm::dyn_cast(getInput1().getType()); if (!inputType) return success(); @@ -869,7 +869,7 @@ LogicalResult tosa::TableOp::inferReturnTypeComponents( MLIRContext *context, ::std::optional location, TableOp::Adaptor adaptor, SmallVectorImpl &inferredReturnShapes) { - ShapeAdaptor inputShape(adaptor.getInput().getType()); + ShapeAdaptor inputShape(adaptor.getInput1().getType()); if (!inputShape.hasRank()) { inferredReturnShapes.push_back(ShapedTypeComponents()); @@ -882,7 +882,7 @@ LogicalResult tosa::TableOp::inferReturnTypeComponents( } LogicalResult tosa::TableOp::verify() { - TensorType inputType = getInput().getType(); + TensorType inputType = getInput1().getType(); TensorType outputType = getOutput().getType(); if (inputType.hasRank() && outputType.hasRank() && @@ -1973,7 +1973,7 @@ void IfOp::print(OpAsmPrinter &p) { } LogicalResult ReverseOp::verify() { - TensorType inputType = getInput().getType(); + TensorType inputType = getInput1().getType(); TensorType outputType = getOutput().getType(); int32_t reverseAxis = getAxis();