Tags: pytorch/executorch
Tags
fbcode/executorch/backends/arm/debug/TARGETS Reviewed By: Ben0mega Differential Revision: D110028813
fbcode/executorch/backends/arm/_passes/TARGETS Reviewed By: Ben0mega Differential Revision: D110025723
Reland "Arm backend: Add real implementation for TOSA dialect ops (re… …-land)" v2 (#20674) Summary: Reverts #20670 and relands #20537 In a first commit, Arm backend: Add infra for real implementations of Tosa ops Tested by applying the infra to the avg_pool2d Tosa dialect op. The rewrite_avg_pool2d tests can now be ran to verify that the produced Tosa is correct. To make it completely correct, two additional passes need to be added to the test. Then, Arm backend: Add real impls to all TOSA dialect ops Additionally, Remove special case in ComputeOpsAOT pass for such ops, since they can now be executed. Start running the model in tests were this was previously impossible due to ops not having a real impl. Pull Request resolved: #20674 Differential Revision: D110362915 Pulled By: rascani
Fix int16 TOSA.TABLE LUT zeroed when output range uses <16 bits (#20668) Summary: `InsertTableOpsPass.generate_16_bit_table_values` builds the int16 `TOSA.TABLE` lookup for unary ops (sigmoid, tanh, ...). It computes `rshift = ceil(log2(max_table_value)) + 1 - 16` to fit the table into 16 signed bits, then does `lut_values >> rshift`, assuming the table fills ~16 bits (its own comment notes "for int16, rshift == 0"). When the op's output range uses fewer than 16 bits this breaks. A sigmoid output is in `[0, 1]`; quantized with a small scale (e.g. `1/4096`), the largest table value is `4096` (13 bits), so `rshift = 13 - 16 = -3`. `lut_values >> -3` is an undefined negative right-shift; on the host the shift count is masked and the entire table is zeroed, so the activation returns 0 for every input. This makes any int16 `TABLE` op with a small output range (e.g. a sigmoid in a Squeeze-and-Excitation block) degenerate. Fix: clamp `rshift` to >= 0. When it would be negative the values already fit in int16, so no shift is needed; this restores the documented `rshift == 0` / `rescale_lshift == -7` case. The fix is general -- it covers any int16 `TABLE` op whose output range is small. Differential Revision: D107331163
fbcode/executorch/backends/arm/TARGETS Reviewed By: Ben0mega Differential Revision: D109822520
fbcode/executorch/backends/arm/quantizer/TARGETS Reviewed By: Ben0mega Differential Revision: D110159255
fbcode/executorch/backends/arm/operators/TARGETS Reviewed By: Ben0mega Differential Revision: D110158280
fbcode/executorch/backends/arm/tosa/dialect/BUCK Reviewed By: Ben0mega Differential Revision: D110162000
PreviousNext