[mlir][tosa] Cleanup of tosa.rescale lowering to linalg

Comment was poorly written. Changed to bail on contradictory information in
the double round.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D102651
This commit is contained in:
Rob Suderman 2021-05-17 17:25:34 -07:00
parent 1b4d5b3bf3
commit a91fb4328f
2 changed files with 7 additions and 1 deletions

View File

@ -1259,6 +1259,11 @@ public:
auto outputTy = op.output().getType().cast<ShapedType>();
unsigned rank = inputTy.getRank();
// This is an illegal configuration. terminate and log an error
if (op.double_round() && !op.scale32())
return rewriter.notifyMatchFailure(
op, "tosa.rescale requires scale32 for double_round to be true");
if (!outputTy.hasStaticShape())
return rewriter.notifyMatchFailure(
op, "tosa to linalg conversion expects statically shaped tensors");

View File

@ -103,7 +103,8 @@ public:
Value shiftThirty64 = rewriter.create<mlir::SignExtendIOp>(
loc, rewriter.getI64Type(), shiftThirty32);
// Round value needs to with be added or sbustracted depending on
// Round value needs to with be added or subtracted depending on the sign
// of the input value.
Value roundAdd64 =
rewriter.create<mlir::AddIOp>(loc, round64, shiftThirty64);
Value roundSub64 =