[all-commits] [llvm/llvm-project] fa720e: [mlir][tosa] Optimize non-narrowing float casts (#...

Ian Tayler Lessa via All-commits all-commits at lists.llvm.org
Tue Apr 14 01:56:02 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa720e7d5e5483b93b6098cf4d13dcebaf01ca92
      https://github.com/llvm/llvm-project/commit/fa720e7d5e5483b93b6098cf4d13dcebaf01ca92
  Author: Ian Tayler Lessa <ian.taylerlessa at arm.com>
  Date:   2026-04-14 (Tue, 14 Apr 2026)

  Changed paths:
    M mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
    M mlir/test/Dialect/Tosa/canonicalize.mlir

  Log Message:
  -----------
  [mlir][tosa] Optimize non-narrowing float casts (#191439)

Extend the existing NonNarrowingCastsOptimization to also cover casts
between floating point types f32, f16, bf16, f8E4M3FN and F8E5M2. Avoid
introducing direct casts between f8 types since those are not allowed in
TOSA.

Also expand the set of cases that are considering non-narrowing by only
checking if the cast we're trying to remove is non-narrowing. Example
i16 -> i32 -> i8 would have been rejected before, but it is now safely
converted to a single i16 -> i8 tosa.cast, since the behaviour should
identical for the entire input space.

Finally disallow the optimization in the case when the cast that we
would remove involves integer types of different signedness.

Signed-off-by: Ian Tayler Lessa <ian.taylerlessa at arm.com>



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