[Mosaic TPU] Fix operands order in try canonicalize add of matmul.

PiperOrigin-RevId: 671437100
This commit is contained in:
Jevin Jiang 2024-09-05 11:05:54 -07:00 committed by jax authors
parent 97db78ba24
commit dba674153e

View File

@ -493,8 +493,9 @@ class CanonicalizeAddOfMatmul : public OpRewritePattern<AddOp> {
}
return failure();
};
return success(succeeded(try_canonicalize(op.getLhs(), op.getRhs())) ||
succeeded(try_canonicalize(op.getLhs(), op.getRhs())));
// We tried try_canonicalize(op.getRhs(), op.getLhs()) and it caused
// worrying numerical differences in some of kernels.
return try_canonicalize(op.getLhs(), op.getRhs());
}
};