Migrate the quantizer to use aten ops directly (#4195)
Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/4195 This major change allows a lot more flexibility in the quantizer, and reduces the dependency on the decompositions/graph tracing tools. The motivation is that some of those do not preserve or propagate `source_fn_stack` information, resulting in quantization misses. SDPA is an example, where the underlying `bmm` ops cannot be quantized with `source_fn_stack` information alone, or MHA, which can hide its SDPA component and sometimes even `linear` ops depending on the model (see ViT for an example). Also note than in most cases, we match single nodes anyway, with a 1-1 mapping between the op (either nn.Module or nn.functional) and the aten op, so using the aten op directly is simply easier. Summary of the changes: - change the quantizer to match aten ops directly, through `node.target` - propagate required changes to the `QuantFusion` pass - update/remove existing patterns Reviewed By: dulinriley Differential Revision: D59552606 fbshipit-source-id: 0bc39679df9d4abfcca0f0091ec96fb94e5177b8
M
Matthias Cremon committed
a22e80950895d7801efd34c27352b7df3d2ba835
Parent: a7ac3d5
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 7/16/2024, 1:27:59 AM