[QNN EP] Lower Gemm with 2d bias to FC + ElementwiseAdd when targeting HTP.#25605
Merged
HectorSVC merged 2 commits intomicrosoft:mainfrom Aug 1, 2025
Merged
Conversation
Signed-off-by: Mu-Chein Hsu <quic_muchhsu@quicinc.com>
Contributor
Author
Contributor
Author
|
@microsoft-github-policy-service agree company=Qualcomm |
Signed-off-by: Mu-Chein Hsu <quic_muchhsu@quicinc.com>
Contributor
|
/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline |
|
Azure Pipelines successfully started running 5 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR modifies the QNN execution provider to support Gemm operations with 2D bias matrices when targeting HTP (Hardware Transform Pipeline). Previously, these operations would fall back to CPU execution.
- Updates Gemm operator support to handle 2D bias matrices by decomposing them into FullyConnected + ElementwiseAdd operations
- Modifies validation logic to allow 2D bias with shape [N, M] for non-quantized inputs
- Updates test cases to verify that Gemm with 2D bias is now assigned to QNN EP instead of falling back to CPU
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| gemm_op_test.cc | Updates test cases to verify 2D bias support and changes expected EP assignment from None to All |
| gemm_op_builder.cc | Implements logic to decompose Gemm with 2D bias into FullyConnected + ElementwiseAdd operations |
HectorSVC
approved these changes
Aug 1, 2025
sanketkaleoss
pushed a commit
to sanketkaleoss/onnxruntime
that referenced
this pull request
Aug 11, 2025
…g HTP. (microsoft#25605) ### Description Lower Gemm with 2d bias to FC + ElementwiseAdd when targeting HTP. ### Motivation and Context This change will allow Gemm with 2d bias stays on HTP and not falling back to CPU. --------- Signed-off-by: Mu-Chein Hsu <quic_muchhsu@quicinc.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Lower Gemm with 2d bias to FC + ElementwiseAdd when targeting HTP.
Motivation and Context
This change will allow Gemm with 2d bias stays on HTP and not falling back to CPU.