[Mlir-commits] [mlir] [mlir][tosa][tosa-to-linalg] tosa.cast: fix answer mismatch to cast f64/f32 max value to i64/i32 (PR #130116)
Alaa Ali
llvmlistbot at llvm.org
Fri Mar 7 14:12:13 PST 2025
alaa-ali wrote:
> > Result overflows must be saturated.
>
> It would be nice if TOSA cast operation matches the behavior of PyTorch and Tensorflow since they are the most popular deep learning frameworks. It would make the lowering between them smoother, less complex, and reduce the risk of bugs.
>
> Maybe a solution to make all front ends happy could be to add an attribute to the TOSA cast operation to determine if saturation is done on overflow or not. This would facilitate the integration with any front end.
--------------
Adding a new attribute to select the TOSA cast operation (Default: the saturation behavior from the TOSA spec) seems a reasonable idea to resolve this and provide a solution for multiple use cases.
https://github.com/llvm/llvm-project/pull/130116
More information about the Mlir-commits
mailing list