Skip to content

Commit

Permalink
Partially revert "Fixed type conversion for tosa.abs when lowering to…
Browse files Browse the repository at this point in the history
… linalg".
  • Loading branch information
lmendesp-amd committed Dec 9, 2024
1 parent 1e53fb5 commit c9b35c8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ createConstFromIntAttribute(Operation *op, const std::string &attrName,
}

static Value createLinalgBodyCalculationForElementwiseOp(
Operation *op, const TypeConverter &converter, ValueRange args,
ArrayRef<Type> resultTypes, ConversionPatternRewriter &rewriter) {
Operation *op, ValueRange args, ArrayRef<Type> resultTypes,
ConversionPatternRewriter &rewriter) {
Location loc = op->getLoc();
auto elementTy =
cast<ShapedType>(op->getOperand(0).getType()).getElementType();
Expand All @@ -61,7 +61,7 @@ static Value createLinalgBodyCalculationForElementwiseOp(

if (isa<tosa::AbsOp>(op) && isa<IntegerType>(elementTy)) {
auto zero = rewriter.create<arith::ConstantOp>(
loc, rewriter.getZeroAttr(converter.convertType(elementTy)));
loc, rewriter.getZeroAttr(elementTy));
auto neg = rewriter.create<arith::SubIOp>(loc, zero, args[0]);
return rewriter.create<arith::MaxSIOp>(loc, args[0], neg);
}
Expand Down Expand Up @@ -948,8 +948,7 @@ emitElementwiseComputation(ConversionPatternRewriter &rewriter, Location loc,
getNParallelLoopsAttrs(rank),
[&](OpBuilder &opBuilder, Location loc, ValueRange blockArgs) {
Value opResult = createLinalgBodyCalculationForElementwiseOp(
operation, converter,
blockArgs.take_front(operation->getNumOperands()),
operation, blockArgs.take_front(operation->getNumOperands()),
{resultType.getElementType()}, rewriter);
if (!opResult) {
encounteredError = true;
Expand Down

0 comments on commit c9b35c8

Please # to comment.