[all-commits] [llvm/llvm-project] b91ce7: [Tosa] : Fix integer overflow for computing intmax...

Sayan Saha via All-commits all-commits at lists.llvm.org
Fri Oct 25 02:51:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b91ce7bc0eda8ec91c7ba724fbe78607843e0e06
      https://github.com/llvm/llvm-project/commit/b91ce7bc0eda8ec91c7ba724fbe78607843e0e06
  Author: Sayan Saha <sayans at mathworks.com>
  Date:   2024-10-25 (Fri, 25 Oct 2024)

  Changed paths:
    M mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
    M mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir

  Log Message:
  -----------
  [Tosa] : Fix integer overflow for computing intmax+1 in tosa.cast to linalg. (#112455)

This PR fixes an issue related to integer overflow when computing
`(intmax+1)` for `i64` during `tosa-to-linalg` pass for `tosa.cast`.

Found this issue while debugging a numerical mismatch for `deeplabv3`
model from `torchvision` represented in `tosa` dialect using the
`TorchToTosa` pipeline in `torch-mlir` repository. `torch.aten.to.dtype`
is converted to `tosa.cast` that casts `f32` to `i64` type. Technically
by the specification, `tosa.cast` doesn't handle casting `f32` to `i64`.
So it's possible to add a verifier to error out for such tosa ops
instead of producing incorrect code. However, I chose to fix the
overflow issue to still be able to represent the `deeplabv3` model with
`tosa` ops in the above-mentioned pipeline. Open to suggestions if
adding the verifier is more appropriate instead.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list