Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend QDQPropagation transformer to handle multiple consumers #21313

Merged
merged 21 commits into from
Jul 24, 2024

Conversation

adrianlizarraga
Copy link
Contributor

@adrianlizarraga adrianlizarraga commented Jul 11, 2024

Description

  • Extends the QDQPropagationTransformer to propagate DQs (forward) across operators with multiple consumers (previously only supported 1 consumer).
  • Adds Slice to the list of operators that the QDQPropagationTransformer can propagate DQ/Q ops across.
  • Supports QDQ propagation for opset 21.
  • Correctly copies Q or DQ attributes when creating new nodes.

Motivation and Context

The QDQPropagationTransformer fixes up QDQ node units for certain "data movement" ops (e.g., Transpose) by inserting Q -> DQ sequences where necessary. For example, the sequence DQ -> Transpose -> Sigmoid is transformed to DQ -> Transpose -> Q -> DQ -> Sigmoid.

However, this fix-up does not currently support data movement ops with multiple consumers, as in:

DQ -> Transpose --+--> Sigmoid ->
                  |
                  +--> Relu ->
                  |
                  +-> graph_output

With the updates in this PR, the above model can be transformed to:

DQ -> Transpose -> Q --+--> DQ -> Sigmoid ->
                       |
                       +--> DQ -> Relu ->
                       |
                       +--> DQ -> graph_output

This update allows QNN EP to support quantized models created with tools that do not wrap data movement ops in Q/DQ ops.

@adrianlizarraga adrianlizarraga added ep:QNN issues related to QNN exeution provider quantization issues related to quantization labels Jul 11, 2024
@adrianlizarraga adrianlizarraga marked this pull request as ready for review July 11, 2024 09:40
edgchen1
edgchen1 previously approved these changes Jul 23, 2024
@adrianlizarraga adrianlizarraga requested a review from edgchen1 July 24, 2024 06:22
edgchen1
edgchen1 previously approved these changes Jul 24, 2024
@adrianlizarraga adrianlizarraga merged commit f4edf9b into main Jul 24, 2024
99 checks passed
@adrianlizarraga adrianlizarraga deleted the adrianl/slice-qdq-fixup branch July 24, 2024 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:QNN issues related to QNN exeution provider quantization issues related to quantization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants