File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
mlir/lib/Dialect/Tosa/Transforms Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -98,11 +98,17 @@ struct TosaFoldConstantReciprocal : public OpRewritePattern<ReciprocalOp> {
98
98
return success ();
99
99
}
100
100
101
+ if (!isa<ConstOp>(inputTensor.getDefiningOp ())) {
102
+ return rewriter.notifyMatchFailure (recip,
103
+ " The reciprocal can only be folded if "
104
+ " it operates on a TOSA constant" );
105
+ }
106
+ auto definingConstOp = cast<ConstOp>(inputTensor.getDefiningOp ());
107
+
101
108
// Our transformation replaces the input tensor with the transformed tensor.
102
109
// If the input has several users we need to keep the input. This can
103
110
// result in a significantly increased memory usage, such that we currently
104
111
// refrain from applying the transformation in that case.
105
- auto definingConstOp = cast<ConstOp>(inputTensor.getDefiningOp ());
106
112
if (!definingConstOp->hasOneUse ()) {
107
113
return rewriter.notifyMatchFailure (
108
114
recip, " Currently, reciprocals will only be folded if the input "
You can’t perform that action at this time.
0 commit comments