Arm backend: Give SiLU its own output quantization spec - #21437
Conversation
Issue: 1. SiLU's quantized output was forced to reuse its input's quantization scale, wasting resolution since SiLU's output range is always narrower than its input's. 2. The composable quantizer and `silu_.default` was separately misclassified in the legacy annotator since pytorch#17202. Fix: Give SiLU its own output qspec. Also fixes an unrelated latent bug that this change exposed. Signed-off-by: Youngsik Yang <vacu9708@gmail.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21437
Note: Links to docs will display an error until the docs builds have been completed.
|
This PR needs a
|
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
Summary
SiLU's quantized output is forced to reuse its input's quantization scale, which wastes resolution for no benefit.
This commit gives SiLU its own output quantization spec.
Where this happens:
silu.defaultsilu_.default_TOSAQuantizerV2, default since #19758)TOSAQuantizationConfig.<br>SHARED_OUTPUT_ACT_QSPEC_PATTERNS_TOSAQuantizerV1)quantization_annotator.pyop setsWhy quantization sharing is wrong for SiLU:
class TableOps) whose entries are precomputed at compile time, not runtime.Changes
quantizer/quantization_config.pysilu.default/silu_.defaultfromSHARED_OUTPUT_ACT_QSPEC_PATTERNSquantizer/quantization_annotator.pysilu_.defaultinto_one_to_one, next tosilu.defaultsilu.defaultin_one_to_one(own qspec) butsilu_.defaultin_one_to_one_shared_input_or_input_act_qspec(shared qspec).test/ops/test_silu.pySilu.forwardclones its inputcompare_rel_frobenius_and_cosine_similarity()) treat every value as noise and skip the check entirely, so the test kept passing without validating anything.cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani