Skip to content

Commit 55d0adf

Browse files
adrianlizarragaankitm3k
authored andcommitted
[QNN EP] QNN SDK 2.28.2 (microsoft#22844)
### Description - Updates pipelines to use QNN SDK 2.28.2.241116. - Re-enable LayerNormalization unit tests that failed with accuracy errors with the previous QNN SDK (2.28.0). - Update QNN EP to no longer provide a dummy bias for LayerNorm if the QNN SDK version is >= 2.28.0. ### Motivation and Context Use the latest QNN SDK. This version improves inference latency for certain customer models.
1 parent ad21ea6 commit 55d0adf

21 files changed

+39
-38
lines changed

Diff for: onnxruntime/core/providers/qnn/builder/opbuilder/layer_norm_op_builder.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ Status LayerNormOpBuilder::ProcessInputs(QnnModelWrapper& qnn_model_wrapper,
8787
ORT_RETURN_IF_ERROR(ProcessInput(qnn_model_wrapper, inputs[BIAS_IDX], logger, input_names));
8888
}
8989

90-
#if QNN_API_VERSION_MAJOR == 2 && (QNN_API_VERSION_MINOR >= 17)
90+
#if QNN_API_VERSION_MAJOR == 2 && QNN_API_VERSION_MINOR >= 17 && QNN_API_VERSION_MINOR <= 20
9191
if (!has_bias_input && IsNpuBackend(qnn_model_wrapper.GetQnnBackendType())) {
92-
// Bias is implicit. QNN SDK 2.24+ (QNN API version 2.17+) has a validation bug for implicit bias inputs,
93-
// so provide an explicit bias of all 0 (quantized int32).
92+
// Bias is implicit. QNN SDK 2.24 to 2.27 (QNN API version 2.17 to 2.20) has a validation bug for
93+
// implicit bias inputs, so provide an explicit bias of all 0 (quantized int32).
9494
TensorInfo x_input_info = {};
9595
ORT_RETURN_IF_ERROR(qnn_model_wrapper.GetTensorInfo(inputs[X_IDX], x_input_info));
9696

Diff for: onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "DSP/QnnDspCommon.h"
1515
#include "HTP/QnnHtpCommon.h"
1616
#include "HTP/QnnHtpContext.h"
17+
#include "Saver/QnnSaver.h"
1718
#include <gsl/gsl>
1819
#include "core/framework/endian_utils.h"
1920
#include "core/common/logging/capture.h"
@@ -1040,7 +1041,14 @@ Status QnnBackendManager::ExtractBackendProfilingInfo() {
10401041
const QnnProfile_EventId_t* profile_events{nullptr};
10411042
uint32_t num_events{0};
10421043
Qnn_ErrorHandle_t result = qnn_interface_.profileGetEvents(profile_backend_handle_, &profile_events, &num_events);
1043-
ORT_RETURN_IF(QNN_PROFILE_NO_ERROR != result, "Failed to get profile events. Error: ", QnnErrorHandleToString(result));
1044+
if (!qnn_saver_path_.empty()) { // Using QNN Saver backend
1045+
// QNN SDK 2.28.2 returns QNN_SAVER_ERROR_DUMMY_RETVALUE, but previous QNN versions return QNN_PROFILE_NO_ERROR.
1046+
// We accept both values.
1047+
ORT_RETURN_IF(QNN_PROFILE_NO_ERROR != result && QNN_SAVER_ERROR_DUMMY_RETVALUE != result,
1048+
"Failed to get profile events. Error: ", QnnErrorHandleToString(result));
1049+
} else {
1050+
ORT_RETURN_IF(QNN_PROFILE_NO_ERROR != result, "Failed to get profile events. Error: ", QnnErrorHandleToString(result));
1051+
}
10441052

10451053
if (num_events > 0) {
10461054
LOGS(*logger_, VERBOSE) << "profile_events: " << profile_events << " num_events: " << num_events;

Diff for: onnxruntime/test/providers/qnn/gather_op_htp_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ TEST_F(QnnHTPBackendTests, GatherOp_IndicesDynamicInt32_Axis0) {
132132
}
133133

134134
// disabled for QNN 2.28.0.241029 failed for accuracy validation
135+
// Also fails on QNN 2.28.2.
135136
// qdq@QNN_EP val: 3.6094117164611816 (err: 1.3094117641448975, err/output_range: 22.19342041015625%)
136137
// qdq@CPU_EP val: 2.2905881404876709 (err: 0.0094118118286132812, err/output_range: 0.15952222049236298%)
137138
// abs(qdq@QNN_EP - qdq@CPU_EP) / output_range = 22.033897399902344%

Diff for: onnxruntime/test/providers/qnn/layer_norm_test.cc

+9-18
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,11 @@ TEST_F(QnnHTPBackendTests, LayerNorm1D_LastAxis_StaticScale_StaticBias_AU8_WU8_B
188188
ExpectedEPNodeAssignment::All);
189189
}
190190

191-
// QNN 2.27 accuracy issue
192-
// Inaccuracy detected for output 'output_0', element 0
193-
// output_range=1.2245157957077026, tolerance=0.40000000596046448%.
194-
// Expected val (f32@CPU_EP): -0
195-
// qdq@QNN_EP val: 0.19133351743221283 (err: 0.19133351743221283, err/output_range: 15.625238418579102%)
196-
// qdq@CPU_EP val: 0 (err: 0, err/output_range: 0%)
197-
TEST_F(QnnHTPBackendTests, DISABLED_LayerNorm1D_QNN2_24_ImplicitBias_ValidationBug) {
198-
// QNN 2.24 LayerNorm fails validation (intermittent) if the bias input is not provided. QNN EP will provide an
199-
// explicit bias of all zeros to get around this bug.
191+
TEST_F(QnnHTPBackendTests, LayerNorm1D_QNN2_24_ImplicitBias_ValidationBug) {
192+
// QNN 2.24 to 2.27: LayerNorm fails validation (intermittent) if the bias input is not provided. QNN EP will provide
193+
// an explicit bias of all zeros to get around this bug.
194+
// QNN 2.28.0: Validation bug is fixed, but get accuracy errors.
195+
// QNN 2.28.2: All fixed.
200196
for (size_t i = 0; i < 15; i++) { // Run it multiple times since this is an intermittent bug.
201197
RunLayerNormQDQTest<uint16_t, uint8_t>(TestInputDef<float>({1, 2, 3}, false, GetFloatDataInRange(0.0f, 1.0f, 6)),
202198
TestInputDef<float>({3}, true, GetFloatDataInRange(0.0f, 1.0f, 3)),
@@ -207,14 +203,9 @@ TEST_F(QnnHTPBackendTests, DISABLED_LayerNorm1D_QNN2_24_ImplicitBias_ValidationB
207203
}
208204
}
209205

210-
// Test accuracy of 16-bit QDQ LayerNorm with a static scale input.
211-
// QNN 2.27 accuracy issue
212-
// Inaccuracy detected for output 'output_0', element 0
213-
// output_range=1.224743127822876, tolerance=0.40000000596046448%.
214-
// Expected val (f32@CPU_EP): -0
215-
// qdq@QNN_EP val: 0.19136904180049896 (err: 0.19136904180049896, err/output_range: 15.625238418579102%)
216-
// qdq@CPU_EP val: 0 (err: 0, err/output_range: 0%)
217-
TEST_F(QnnHTPBackendTests, DISABLED_LayerNorm1D_LastAxis_StaticScale_AU16_WU8) {
206+
TEST_F(QnnHTPBackendTests, LayerNorm1D_LastAxis_StaticScale_AU16_WU8) {
207+
// QNN 2.28.0: Get accuracy errors.
208+
// QNN 2.28.2: All fixed.
218209
RunLayerNormQDQTest<uint16_t, uint8_t>(TestInputDef<float>({1, 2, 3}, false, GetFloatDataInRange(0.0f, 10.0f, 6)),
219210
TestInputDef<float>({3}, true, GetFloatDataInRange(0.0f, 1.0f, 3)), // Static
220211
TestInputDef<float>(),
@@ -225,7 +216,7 @@ TEST_F(QnnHTPBackendTests, DISABLED_LayerNorm1D_LastAxis_StaticScale_AU16_WU8) {
225216

226217
// Test accuracy of 8-bit QDQ LayerNorm with a dynamic scale input.
227218
//
228-
// TODO(adrianlizarraga): Fails to finalize with QNN SDK 2.22.
219+
// TODO(adrianlizarraga): Fails to finalize with QNN SDK 2.22. Still fails on QNN SDK 2.28.2.
229220
// Verbose logs:
230221
// Starting stage: Graph Transformations and Optimizations
231222
// C:\...\QNN\HTP\HTP\src\hexagon\prepare\graph_prepare.cc:203:ERROR:could not create op: q::flat_to_vtcm

Diff for: onnxruntime/test/providers/qnn/matmul_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ TEST_F(QnnHTPBackendTests, MatMulOp_PerChannel_A16_WeightUInt4) {
273273
}
274274

275275
// Test QDQ per-channel MatMul with int8 act, int4 weights (static)
276-
// QNN 2.27 regression
276+
// QNN 2.27 regression. Also fails on QNN 2.28.2.
277277
// Failed to finalize QNN graph. Error code: 1002
278278
TEST_F(QnnHTPBackendTests, DISABLED_MatMulOp_PerChannel_AS8_WeightInt4) {
279279
std::vector<float> input0_data = GetFloatDataInRange(-5.0f, 5.0f, 6);

Diff for: onnxruntime/test/providers/qnn/simple_op_htp_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ TEST_F(QnnHTPBackendTests, UnaryOp_Tanh) {
230230
}
231231

232232
// disabled for QNN 2.28.0.241029 backendValidateOpConfig failed
233+
// still fails on QNN 2.28.2.
233234
// QnnDsp <E> [4294967295] has incorrect Value -32768, expected equal to 0.
234235
// QnnDsp <V> validateNativeOps node_token_6:qti.aisw:Tanh htp op validator failed 3110
235236
// QnnDsp <V> registered validator failed => 3110

Diff for: tools/ci_build/github/azure-pipelines/android-arm64-v8a-QNN-crosscompile-ci-pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ parameters:
3232
- name: QnnSdk
3333
displayName: QNN SDK version
3434
type: string
35-
default: 2.28.0.241029
35+
default: 2.28.2.241116
3636

3737
jobs:
3838
- job: Build_QNN_EP

Diff for: tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ parameters:
6262
- name: QnnSdk
6363
displayName: QNN SDK Version
6464
type: string
65-
default: 2.28.0.241029
65+
default: 2.28.2.241116
6666

6767
resources:
6868
repositories:

Diff for: tools/ci_build/github/azure-pipelines/linux-qnn-ci-pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ parameters:
3333
- name: QnnSdk
3434
displayName: QNN SDK version
3535
type: string
36-
default: 2.28.0.241029
36+
default: 2.28.2.241116
3737

3838
jobs:
3939
- job: Build_QNN_EP

Diff for: tools/ci_build/github/azure-pipelines/py-packaging-pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ parameters:
5959
- name: qnn_sdk_version
6060
type: string
6161
displayName: 'QNN SDK version. Only for QNN packages.'
62-
default: 2.28.0.241029
62+
default: 2.28.2.241116
6363

6464
trigger: none
6565

Diff for: tools/ci_build/github/azure-pipelines/qnn-ep-nuget-packaging-pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ parameters:
22
- name: QnnSdk
33
displayName: QNN SDK Version
44
type: string
5-
default: 2.28.0.241029
5+
default: 2.28.2.241116
66

77
- name: build_config
88
displayName: Build Configuration

Diff for: tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ parameters:
5959
- name: qnn_sdk_version
6060
type: string
6161
displayName: 'QNN SDK version. Only for QNN packages.'
62-
default: 2.28.0.241029
62+
default: 2.28.2.241116
6363

6464
stages:
6565
- ${{ if eq(parameters.enable_windows_cpu, true) }}:

Diff for: tools/ci_build/github/azure-pipelines/templates/jobs/download_linux_qnn_sdk.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
- name: QnnSDKVersion
33
type: string
4-
default: '2.28.0.241029'
4+
default: '2.28.2.241116'
55

66
steps:
77
- script: |

Diff for: tools/ci_build/github/azure-pipelines/templates/jobs/download_win_qnn_sdk.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
- name: QnnSDKVersion
33
type: string
4-
default: '2.28.0.241029'
4+
default: '2.28.2.241116'
55

66
steps:
77
- powershell: |

Diff for: tools/ci_build/github/azure-pipelines/templates/py-linux-qnn.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ parameters:
2626
- name: QnnSdk
2727
displayName: QNN SDK version
2828
type: string
29-
default: 2.28.0.241029
29+
default: 2.28.2.241116
3030

3131
jobs:
3232
- job: Linux_py_qnn_Wheels_x64

Diff for: tools/ci_build/github/azure-pipelines/templates/py-win-arm64-qnn.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
- name: QNN_SDK
88
displayName: QNN SDK Version
99
type: string
10-
default: 2.28.0.241029
10+
default: 2.28.2.241116
1111

1212
- name: ENV_SETUP_SCRIPT
1313
type: string

Diff for: tools/ci_build/github/azure-pipelines/templates/py-win-arm64ec-qnn.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
- name: QNN_SDK
88
displayName: QNN SDK Version
99
type: string
10-
default: 2.28.0.241029
10+
default: 2.28.2.241116
1111

1212
- name: ENV_SETUP_SCRIPT
1313
type: string

Diff for: tools/ci_build/github/azure-pipelines/templates/py-win-x64-qnn.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
- name: QNN_SDK
88
displayName: QNN SDK Version
99
type: string
10-
default: 2.28.0.241029
10+
default: 2.28.2.241116
1111

1212
- name: ENV_SETUP_SCRIPT
1313
type: string

Diff for: tools/ci_build/github/azure-pipelines/templates/qnn-ep-win.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
QnnSdk: '2.28.0.241029'
2+
QnnSdk: '2.28.2.241116'
33
build_config: 'RelWithDebInfo'
44
IsReleaseBuild: false
55
DoEsrp: false

Diff for: tools/ci_build/github/azure-pipelines/win-qnn-arm64-ci-pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ parameters:
3333
- name: QnnSdk
3434
displayName: QNN SDK version
3535
type: string
36-
default: 2.28.0.241029
36+
default: 2.28.2.241116
3737

3838
jobs:
3939
- job: 'build'

Diff for: tools/ci_build/github/azure-pipelines/win-qnn-ci-pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ parameters:
3333
- name: QnnSdk
3434
displayName: QNN SDK version
3535
type: string
36-
default: 2.28.0.241029
36+
default: 2.28.2.241116
3737

3838
jobs:
3939
- job: 'build'

0 commit comments

Comments
 (0)