Skip to content

Commit 518d09e

Browse files
kuanyul-quickuanyul-qti
authored andcommitted
[QNN EP] Re-enable several disabled QNN-EP UTs
### Description 1. Re-enable UTs which passed 2.30 2. Fix conv and resize UTs - Make conv's weight as initializer to let graph.NumberOfNodes() match ep_nodes, which should be 1. - Update resize UT because "round_prefer_floor" is no longer supported in QNN SDK since 2.21. ### Motivation and Context 1. Make the UT of QNN EP pass as much as possible to improve the test coverage.
1 parent e46c0d8 commit 518d09e

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

onnxruntime/test/providers/qnn/conv_test.cc

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,9 +1519,10 @@ TEST_F(QnnHTPBackendTests, Conv3D_U16S8S32_PerChannel2) {
15191519
// Expected val: 87.354057312011719
15201520
// QNN QDQ val: 0 (err 87.354057312011719)
15211521
// CPU QDQ val: 87.3583984375 (err 0.00434112548828125)
1522-
TEST_F(QnnHTPBackendTests, DISABLED_ConvU16S16S32_DynamicBias) {
1522+
// Issue fixed in 2.30
1523+
TEST_F(QnnHTPBackendTests, ConvU16S16S32_DynamicBias) {
15231524
TestInputDef<float> input_def({1, 2, 5, 5}, false, GetFloatDataInRange(-10.0f, 10.0f, 50));
1524-
TestInputDef<float> weight_def({1, 2, 3, 3}, false, GetFloatDataInRange(-1.0f, 5.0f, 18));
1525+
TestInputDef<float> weight_def({1, 2, 3, 3}, true, GetFloatDataInRange(-1.0f, 5.0f, 18));
15251526
RunHTPConvOpTest<uint16_t, int16_t>("Conv",
15261527
input_def, // Input
15271528
weight_def.OverrideValueRange(-5.0f, 5.0f), // Weights (symmetric quant range)
@@ -1537,9 +1538,10 @@ TEST_F(QnnHTPBackendTests, DISABLED_ConvU16S16S32_DynamicBias) {
15371538

15381539
// Tests 16-bit QDQ Conv with dynamic weights and bias (uses QNN's DepthwiseConv2d)
15391540
// TODO(adrianlizarraga): FAIL: Failed to finalize QNN graph. Error code 1002
1540-
TEST_F(QnnHTPBackendTests, DISABLED_DepthwiseConvU16S16S32_DynamicBias) {
1541+
// Issue fixed in 2.30
1542+
TEST_F(QnnHTPBackendTests, DepthwiseConvU16S16S32_DynamicBias) {
15411543
TestInputDef<float> input_def({1, 1, 5, 5}, false, GetFloatDataInRange(-10.0f, 10.0f, 25));
1542-
TestInputDef<float> weight_def({1, 1, 3, 3}, false, GetFloatDataInRange(-1.0f, 5.0f, 9));
1544+
TestInputDef<float> weight_def({1, 1, 3, 3}, true, GetFloatDataInRange(-1.0f, 5.0f, 9));
15431545
RunHTPConvOpTest<uint16_t, int16_t>("Conv",
15441546
input_def, // Input
15451547
weight_def.OverrideValueRange(-5.0f, 5.0f), // Weights (symmetric quant range)
@@ -1559,9 +1561,10 @@ TEST_F(QnnHTPBackendTests, DISABLED_DepthwiseConvU16S16S32_DynamicBias) {
15591561
// Expected val: 85.354057312011719
15601562
// QNN QDQ val: 0 (err 85.354057312011719)
15611563
// CPU QDQ val: 85.358139038085938 (err 0.00408172607421875)
1562-
TEST_F(QnnHTPBackendTests, DISABLED_ConvU16S16S32_NoBias) {
1564+
// Issue fixed in 2.30
1565+
TEST_F(QnnHTPBackendTests, ConvU16S16S32_NoBias) {
15631566
TestInputDef<float> input_def({1, 2, 5, 5}, false, GetFloatDataInRange(-10.0f, 10.0f, 50));
1564-
TestInputDef<float> weight_def({1, 2, 3, 3}, false, GetFloatDataInRange(-1.0f, 5.0f, 18));
1567+
TestInputDef<float> weight_def({1, 2, 3, 3}, true, GetFloatDataInRange(-1.0f, 5.0f, 18));
15651568
RunHTPConvOpTest<uint16_t, int16_t>("Conv",
15661569
input_def, // Input
15671570
weight_def.OverrideValueRange(-5.0f, 5.0f), // Weights (symmetric quant range)
@@ -1577,12 +1580,13 @@ TEST_F(QnnHTPBackendTests, DISABLED_ConvU16S16S32_NoBias) {
15771580

15781581
// Tests 16-bit QDQ Conv with dynamic weights and no bias (uses QNN's DepthWiseConv2d)
15791582
// TODO(adrianlizarraga): FAIL: Failed to finalize QNN graph. Error code 1002
1580-
TEST_F(QnnHTPBackendTests, DISABLED_DepthwiseConvU16S16S32_NoBias) {
1583+
// Issue fixed in 2.30
1584+
TEST_F(QnnHTPBackendTests, DepthwiseConvU16S16S32_NoBias) {
15811585
std::vector<float> input_data = GetFloatDataInRange(-10.0f, 10.0f, 25);
15821586
std::vector<float> weight_data = GetFloatDataInRange(-10.0f, 10.0f, 9);
15831587
RunHTPConvOpTest<uint16_t, int16_t>("Conv",
15841588
TestInputDef<float>({1, 1, 5, 5}, false, input_data), // Input
1585-
TestInputDef<float>({1, 1, 3, 3}, false, weight_data), // Weights
1589+
TestInputDef<float>({1, 1, 3, 3}, true, weight_data), // Weights
15861590
TestInputDef<float>(), // Bias
15871591
{1, 1}, // Strides
15881592
{0, 0, 0, 0}, // Pads

onnxruntime/test/providers/qnn/resize_test.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,12 @@ TEST_F(QnnHTPBackendTests, ResizeU8_2xNearestAsymmetricRoundPreferFloor_Unsuppor
456456
// ORT CPU EP (f32 model) outputs: -10.0000000 -10.0000000 -3.33333349 -3.33333349 -3.33333349 -3.33333349 -10.00 ...
457457
// ORT CPU EP (qdq model) outputs: -9.96078491 -9.96078491 -3.29411769 -3.29411769 -3.29411769 -3.29411769 -9.961 ...
458458
// ORT QNN EP (qdq model) outputs: -9.96078491 -9.96078491 -9.96078491 -3.37254906 -3.37254906 -3.37254906 -9.961 ...
459-
TEST_F(QnnHTPBackendTests, DISABLED_ResizeU8_3xNearestAsymmetricRoundPreferFloor) {
459+
// UPDATE: "round_prefer_floor" no longer supported in QNN SDK 2.21 (supported in QNN SDK 2.19)
460+
TEST_F(QnnHTPBackendTests, ResizeU8_3xNearestAsymmetricRoundPreferFloor_Unsupported) {
460461
std::vector<float> input_data = GetFloatDataInRange(-10.0f, 10.0f, 4);
461462
RunQDQResizeOpTest<uint8_t>(TestInputDef<float>({1, 1, 2, 2}, false, input_data),
462463
{1, 1, 6, 6}, "nearest", "asymmetric", "round_prefer_floor",
463-
ExpectedEPNodeAssignment::All);
464+
ExpectedEPNodeAssignment::None); // No longer supported as of QNN SDK 2.21
464465
}
465466

466467
// Test 0.5x QDQ Resize mode: "nearest", coordinate_transformation_mode: "asymmetric", nearest_mode: "floor"

onnxruntime/test/providers/qnn/simple_op_htp_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ TEST_F(QnnHTPBackendTests, UnaryOp_Elu) {
297297
// Expected val: -0.99751651287078857
298298
// QNN QDQ val: 6.2726154327392578 (err 7.2701320648193359)
299299
// CPU QDQ val: -0.99753034114837646 (err 1.3828277587890625e-05)
300-
TEST_F(QnnHTPBackendTests, DISABLE_UnaryOp_Elu_U16) {
300+
// Issue fixed in 2.30
301+
TEST_F(QnnHTPBackendTests, UnaryOp_Elu_U16) {
301302
RunQDQOpTest<uint16_t>("Elu",
302303
{TestInputDef<float>({1, 2, 3}, false, GetFloatDataInRange(-10.0f, 10.0f, 6))},
303304
{},

0 commit comments

Comments
 (0)