[Mlir-commits] [mlir] [mlir][tosa] Switch zero point of negate to input variable type (PR #129758)
Tai Ly
llvmlistbot at llvm.org
Wed Mar 5 09:34:19 PST 2025
================
@@ -193,18 +193,29 @@ static Value createLinalgBodyCalculationForElementwiseOp(
// tosa::NegateOp
if (isa<tosa::NegateOp>(op)) {
- if (isa<FloatType>(elementTy))
- return rewriter.create<arith::NegFOp>(loc, resultTypes, args);
+ auto negate = cast<tosa::NegateOp>(op);
- if (isa<IntegerType>(elementTy)) {
- auto inputZpAttr = cast<tosa::NegateOp>(op).getInput1ZpAttr();
- auto outputZpAttr = cast<tosa::NegateOp>(op).getOutputZpAttr();
+ FailureOr<int64_t> maybeInZp = negate.getInput1ZeroPoint();
+ if (failed(maybeInZp)) {
+ (void)rewriter.notifyMatchFailure(
+ op, "input1 zero point cannot be statically determined");
+ return nullptr;
----------------
Tai78641 wrote:
think so. the rest of this function returns nullptr when something went wrong
https://github.com/llvm/llvm-project/pull/129758
More information about the Mlir-commits
mailing list