Skip to content

Add matmul+add+relu QDQ node group - #694

Merged
qti-shubham merged 5 commits into
mainfrom
dev/shubpate/matmul_add_relu_supergroup
Aug 14, 2026
Merged

Add matmul+add+relu QDQ node group#694
qti-shubham merged 5 commits into
mainfrom
dev/shubpate/matmul_add_relu_supergroup

Conversation

@qti-shubham

Copy link
Copy Markdown
Collaborator

Description

Pattern: DQ(input) + DQ(weight) -> MatMul -> Add(DQ(int32 bias)) -> Relu -> Q
Before: quantized_reshape → quantized_FC → float_reshape → float_Relu → quantized_Q
After: quantized_reshape → quantized_FC(with bias) → quantized_reshape -> Quant_Relu (if encoding min !=0)

@qti-shubham

Copy link
Copy Markdown
Collaborator Author

/code-reviewer

@qti-yuduo qti-yuduo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the absorbed-Reshape path and validated each concern empirically on Windows ARM64 / HTP V73 (QAIRT 2.46) by instrumenting GetOrtQDQSelection and running the new tests. The design is sound and mirrors the existing redundant_clip_node_ pattern; no correctness bug survived verification. Four inline notes follow, ordered by how much I'd want them addressed. The main one is test efficacy: none of the three new tests can currently fail if the feature were reverted.

Comment thread onnxruntime/test/providers/qnn/gemm_test.cc Outdated
Comment thread onnxruntime/core/providers/qnn/qnn_ep_utils.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/opbuilder/gemm_op_builder.cc
Comment thread onnxruntime/core/providers/qnn/qnn_ep_utils.cc Outdated
@qti-shubham
qti-shubham requested a review from qti-yuduo August 7, 2026 01:43
Comment thread onnxruntime/core/providers/qnn/builder/opbuilder/gemm_op_builder.cc
@qti-shubham
qti-shubham force-pushed the dev/shubpate/matmul_add_relu_supergroup branch from b4575ea to 453b560 Compare August 13, 2026 00:02
@qti-shubham
qti-shubham enabled auto-merge (squash) August 13, 2026 00:02
qti-shubham and others added 5 commits August 13, 2026 20:01
This reverts commit 88ec2b5.

The MatMul+Add+Relu supergroup selector targeted the raw
MatMul -> Add -> Relu -> Q shape, but under ORT_ENABLE_ALL (real
inference sessions), ORT's L1 optimizer MatMulAddFusion rewrites
this pattern into a single Gemm node with the Add already fused as
input C. The supergroup path never fired in production. The
companion tests hid the gap by forcing ORT_DISABLE_ALL.

Reverting so the Gemm supergroup follow-up can land as the single,
production-visible path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…unit

Absorbs the MatMulAddFusion-inserted output Reshape (and Relu when encoding-safe) so the QDQ group's terminal Q attaches to FC's output encoding.
@qti-shubham
qti-shubham force-pushed the dev/shubpate/matmul_add_relu_supergroup branch from 453b560 to 5d0a578 Compare August 14, 2026 03:01
@qti-shubham
qti-shubham merged commit dd5889d into main Aug 14, 2026
74 of 75 checks passed
@qti-shubham
qti-shubham deleted the dev/shubpate/matmul_add_relu_supergroup branch August 14, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants