[Mlir-commits] [mlir] [mlir][tosa] Add NaN Propagation Mode Support (PR #121951)

Luke Hutton llvmlistbot at llvm.org
Fri Jan 10 09:51:39 PST 2025


================
@@ -361,7 +361,7 @@ struct ClampClampOptimization : public OpRewritePattern<tosa::ClampOp> {
           op, op.getType(), clampOp.getInput(),
           rewriter.getI64IntegerAttr(minInt),
           rewriter.getI64IntegerAttr(maxInt), rewriter.getF32FloatAttr(minFp),
-          rewriter.getF32FloatAttr(maxFp));
+          rewriter.getF32FloatAttr(maxFp), rewriter.getStringAttr("IGNORE"));
----------------
lhutton1 wrote:

I believe we need to be more careful with how we handle the NaN mode here. 

I'll need to spend some more time checking, but so far the following seems to be giving the correct results:
```
- op = PROPAGATE, clampOp = PROPAGATE -> resultingOp = PROPAGATE
- op = IGNORE, clampOp = IGNORE -> resultingOp = IGNORE
- op = PROPAGATE, clampOp = IGNORE -> don't perform optimization
- op = IGNORE, clampOp = PROPAGATE -> resultingOp = IGNORE
```

https://github.com/llvm/llvm-project/pull/121951


More information about the Mlir-commits mailing list