Skip to content

Conversation

@Erik-Lundell
Copy link
Collaborator

(This change was merged but had to be reverted due to type checking errors, see #6452)

Generalizes the search for quantization parameters. The idea is to make a graph like this (part of) a valid quantized graph:

dq -> view -> transpose -> some_op
dq ------> expand -----------/^

For a subset of operations 'passable_op' that don't modify the values of the tensors it is is allowed to "pass through" the op when searching for qparams. If multiple qparams are encounterd in one search, they are asserted to be equal.

The reason for this is to unify what a quantized graph looks like, removing the need for some ad hoc exceptions (for example checking if a view is before an addmm etc.) that were in place before and in general cleaning up the handling of quantization in the ArmBackend. In particular, some decompositions in the to_edge step seem to not insert q/ dq ops which breaks the pattern of dq -> op -> q.

With this change, Arm internal passes can also in some cases skip inserting quantize ops, simplifying the passes.

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 6, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/6690

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 9ea1837 with merge base 793f17e (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 6, 2024
@Erik-Lundell Erik-Lundell added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk and removed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Nov 6, 2024
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 6, 2024
@Erik-Lundell Erik-Lundell marked this pull request as draft November 7, 2024 15:51
@Erik-Lundell Erik-Lundell marked this pull request as ready for review November 8, 2024 15:59
@freddan80
Copy link
Collaborator

Rebase pls

Generalizes the search for quantization parameters.
The idea is to make a graph like this a valid quantized graph:

dq -> view -> transpose -> some_op
			   ^
                          /
dq ------> expand -------/

For a subset of operations 'passable_op' it is is allowed to "pass
through" the op when searching for qparams. If multiple qparams
are encounterd in one search, they are asserted to be equal.

Signed-off-by: Erik Lundell <erik.lundell@arm.com>
Change-Id: I6dbb82fb39164c246ea74b9642d907dba22ab2c3
Signed-off-by: Erik Lundell <erik.lundell@arm.com>
Change-Id: I4feb4b5c6d269d7c0ff4312c17fec52da413fa5a
Signed-off-by: Erik Lundell <erik.lundell@arm.com>
Change-Id: If415a5ee3185c3401069652906a0633491bca1b0
@freddan80 freddan80 merged commit 7fcd0af into pytorch:main Nov 11, 2024
101 checks passed
@Erik-Lundell Erik-Lundell deleted the search-graph branch July 31, 2025 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants