Skip to content

Update input names from input to input1 for Table, Reverse, Slice #109807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2024
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
8 changes: 4 additions & 4 deletions mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def Tosa_TableOp : Tosa_InferShapedTypeOp<"table"> {
}];

let arguments = (ins
Tosa_Tensor: $input,
Tosa_Tensor: $input1,
Tosa_Tensor1D: $table
);

Expand All @@ -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;
Expand Down Expand Up @@ -1640,7 +1640,7 @@ def Tosa_ReverseOp: Tosa_Op<"reverse", [
}];

let arguments = (ins
Tosa_Tensor:$input,
Tosa_Tensor:$input1,
I32Attr:$axis
);

Expand All @@ -1667,7 +1667,7 @@ def Tosa_SliceOp : Tosa_InferShapedTypeOp<"slice"> {
}];

let arguments = (ins
Tosa_Tensor:$input,
Tosa_Tensor:$input1,
DenseI64ArrayAttr:$start,
DenseI64ArrayAttr:$size
);
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ class ReverseConverter : public OpRewritePattern<tosa::ReverseOp> {
LogicalResult matchAndRewrite(tosa::ReverseOp op,
PatternRewriter &rewriter) const final {
auto loc = op.getLoc();
Value input = op.getInput();
Value input = op.getInput1();
auto inputTy = cast<ShapedType>(input.getType());
auto resultTy = cast<ShapedType>(op.getType());
auto axis = op.getAxis();
Expand Down Expand Up @@ -2161,7 +2161,7 @@ class TableConverter : public OpRewritePattern<tosa::TableOp> {
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<ShapedType>(input.getType());
auto tableTy = cast<ShapedType>(table.getType());
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ TensorType inferReshapeCollapsedType(TensorType lhsType, TensorType rhsType) {
for (; currRhsDim < rhsShape.size(); currRhsDim++) {
assert(rhsShape[currRhsDim] == 1);
}

return lhsType.clone(intermediateShape);
}

Expand Down Expand Up @@ -264,7 +264,7 @@ class SliceConverter : public OpConversionPattern<tosa::SliceOp> {
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<ShapedType>(sliceOp.getType());
if (llvm::isa<UnrankedTensorType>(resultType))
return failure();
Expand Down
14 changes: 7 additions & 7 deletions mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ struct ConcatSliceOptimization : public OpRewritePattern<tosa::SliceOp> {

LogicalResult matchAndRewrite(tosa::SliceOp sliceOp,
PatternRewriter &rewriter) const override {
Value sliceInput = sliceOp.getInput();
Value sliceInput = sliceOp.getInput1();
auto concatOp = sliceInput.getDefiningOp<tosa::ConcatOp>();
if (!concatOp)
return rewriter.notifyMatchFailure(
Expand Down Expand Up @@ -919,11 +919,11 @@ OpFoldResult ResizeOp::fold(FoldAdaptor adaptor) {
}

OpFoldResult ReverseOp::fold(FoldAdaptor adaptor) {
auto operand = getInput();
auto operand = getInput1();
auto operandTy = llvm::cast<ShapedType>(operand.getType());
auto axis = getAxis();
auto operandAttr =
llvm::dyn_cast_if_present<SplatElementsAttr>(adaptor.getInput());
llvm::dyn_cast_if_present<SplatElementsAttr>(adaptor.getInput1());
if (operandAttr)
return operandAttr;

Expand All @@ -936,24 +936,24 @@ OpFoldResult ReverseOp::fold(FoldAdaptor adaptor) {
}

OpFoldResult SliceOp::fold(FoldAdaptor adaptor) {
auto inputTy = llvm::dyn_cast<RankedTensorType>(getInput().getType());
auto inputTy = llvm::dyn_cast<RankedTensorType>(getInput1().getType());
auto outputTy = llvm::dyn_cast<RankedTensorType>(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
if (!inputTy.getElementType().isIntOrIndexOrFloat() ||
!outputTy.getElementType().isIntOrIndexOrFloat())
return {};

auto operand = llvm::cast<ElementsAttr>(adaptor.getInput());
auto operand = llvm::cast<ElementsAttr>(adaptor.getInput1());
if (operand.isSplat() && outputTy.hasStaticShape()) {
return SplatElementsAttr::get(outputTy, operand.getSplatValue<Attribute>());
}
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ LogicalResult tosa::SliceOp::inferReturnTypeComponents(
}

LogicalResult tosa::SliceOp::verify() {
auto inputType = llvm::dyn_cast<RankedTensorType>(getInput().getType());
auto inputType = llvm::dyn_cast<RankedTensorType>(getInput1().getType());
if (!inputType)
return success();

Expand All @@ -869,7 +869,7 @@ LogicalResult tosa::TableOp::inferReturnTypeComponents(
MLIRContext *context, ::std::optional<Location> location,
TableOp::Adaptor adaptor,
SmallVectorImpl<ShapedTypeComponents> &inferredReturnShapes) {
ShapeAdaptor inputShape(adaptor.getInput().getType());
ShapeAdaptor inputShape(adaptor.getInput1().getType());

if (!inputShape.hasRank()) {
inferredReturnShapes.push_back(ShapedTypeComponents());
Expand All @@ -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() &&
Expand Down Expand Up @@ -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();

Expand Down
Loading