Skip to content

[QNN-EP] Add negtive padding value support.#25928

Merged
HectorSVC merged 2 commits into
microsoft:mainfrom
CodeLinaro:dev/muchhsu/enable_negative_pad_op
Sep 4, 2025
Merged

[QNN-EP] Add negtive padding value support.#25928
HectorSVC merged 2 commits into
microsoft:mainfrom
CodeLinaro:dev/muchhsu/enable_negative_pad_op

Conversation

@quic-muchhsu

Copy link
Copy Markdown
Contributor

Description

Add negative padding value support for QNN EP by lower padding to pad + stride_slice(if negative padding value exists.)

Motivation and Context

ONNX and QNN complier in QAIRT both supports negative padding value by lowering to slice/resize_crop. Adding this change to align EP with QNN and ONNX

Signed-off-by: Mu-Chein Hsu <quic_muchhsu@quicinc.com>
@HectorSVC HectorSVC added the ep:QNN issues related to QNN exeution provider label Sep 3, 2025
@HectorSVC

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC HectorSVC requested a review from Copilot September 3, 2025 17:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for negative padding values in the QNN execution provider by implementing a two-step lowering approach: first applying positive padding operations, then using stride_slice operations to handle negative padding when present.

  • Implements negative padding support by decomposing into pad + stride_slice operations
  • Adds validation to reject reflect mode with negative padding values
  • Extends test coverage for negative and mixed padding scenarios across CPU and HTP backends

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
onnxruntime/core/providers/qnn/builder/opbuilder/pad_op_builder.cc Core implementation adding negative padding logic with pad+slice decomposition
onnxruntime/test/providers/qnn/pad_op_test.cpp Comprehensive test cases covering negative and mixed padding scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread onnxruntime/core/providers/qnn/builder/opbuilder/pad_op_builder.cc Outdated
Comment thread onnxruntime/core/providers/qnn/builder/opbuilder/pad_op_builder.cc
Comment thread onnxruntime/test/providers/qnn/pad_op_test.cpp Outdated
Comment thread onnxruntime/test/providers/qnn/pad_op_test.cpp Outdated
Signed-off-by: Mu-Chein Hsu <quic_muchhsu@quicinc.com>
@quic-muchhsu

Copy link
Copy Markdown
Contributor Author

@HectorSVC I have fixed this PR according to copilot review. Please start CI. Thanks!

@HectorSVC

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC HectorSVC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@HectorSVC HectorSVC merged commit 9d650a4 into microsoft:main Sep 4, 2025
86 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants