[Mlir-commits] [mlir] [mlir][tosa] Optimize block scaled cast sequences (PR #188018)

Ian Tayler Lessa llvmlistbot at llvm.org
Mon Mar 23 05:36:35 PDT 2026


IanTaylerLessa-arm wrote:

Hi @hockyy, that one's probably not legal in terms of numerical behaviour. If you `CAST_TO_BLOCK_SCALED -> CAST_FROM_BLOCK_SCALED` you will end up with different values (i.e. the values will be approximated to be exactly representable in the target block scaled type), so if we just remove those two ops. we change the behaviour. It's possible (although unlikely) that someone could add the sequence to get exactly that behaviour.

The difference with the existing pattern is that here you already start with block-scale-representable values, so it's legal to remove the transformation to a higher precision type and back, since that sequence _can_ legally be implemented as lossless.

https://github.com/llvm/llvm-project/pull/188018


More information about the Mlir-commits mailing list