Arm: Add pass for replacing dq-q patterns with rescale (#8513)
When an int8 op meets an int32 op, the int8 is first dequantized to a float which is then quantized to the desired int8 dtype. This produces a (int8 dq -> q int32) pattern that we can replace with a TOSA.RESCALE since they are approximately mathematically equivalent, differing only in how the rounding is done. This requires a few changes: - Introduce custom rescale op - Create pass to replace the dq-q pattern with the rescale op - Implement node_visitor for rescale op The change makes it possible to mix int8 and int32 quantization, as showcased in the new test_add_i32_tosa_BI test. Signed-off-by: Erik Lundell <erik.lundell@arm.com>
E
Erik Lundell committed
ed82561465c19ddbf0f186750a0fc547454cbb0f
Parent: a70c6a3
Committed by GitHub <noreply@github.com>
on 2/17/2025, 12:00:31 PM