From f3d04cd1be6844d415ef461e9ca62b518e177bc0 Mon Sep 17 00:00:00 2001 From: Adrian Lizarraga Date: Fri, 21 Apr 2023 09:31:10 -0700 Subject: [PATCH] [QNN EP] Update Windows ARM64 pipeline to use Visual Studio 2022 (#15607) ### Description - Updates the QNN Windows ARM64 pipeline to use a new image with Visual Studio 2022 (updated from VS 2019) - Creates a new gtest fixture class that skips tests for the QNN CPU backend if we detect that the QNN CPU backend is not available/functional. The current windows arm64 vm does not support any QNN backend. ### Motivation and Context Visual Studio 2022 adds support for native arm64 compilation. This pipeline will help catch any build regressions on Windows ARM64 w/ VS 2022. --- .../optimizer/transpose_optimizer_test.cc | 12 +++ .../test/providers/qnn/average_pool_test.cc | 8 +- onnxruntime/test/providers/qnn/cast_test.cc | 6 +- .../test/providers/qnn/qnn_basic_test.cc | 8 +- .../test/providers/qnn/qnn_test_utils.cc | 87 ++++++++++++++++--- .../test/providers/qnn/qnn_test_utils.h | 24 +++-- .../test/providers/qnn/reduce_op_cpu_test.cc | 24 ++--- onnxruntime/test/providers/qnn/resize_test.cc | 24 ++--- .../win-qnn-arm64-ci-pipeline.yml | 27 ++---- 9 files changed, 146 insertions(+), 74 deletions(-) diff --git a/onnxruntime/test/optimizer/transpose_optimizer_test.cc b/onnxruntime/test/optimizer/transpose_optimizer_test.cc index c787ef6f0c..86499c7e82 100644 --- a/onnxruntime/test/optimizer/transpose_optimizer_test.cc +++ b/onnxruntime/test/optimizer/transpose_optimizer_test.cc @@ -2969,11 +2969,23 @@ TEST(TransposeOptimizerTests, TestBroadcastOpsDiv) { EXPECT_EQ(transpose_cost, 0); }; +#if defined(_M_ARM64) && _MSC_VER >= 1930 + // Slight difference in Windows ARM64 VS 2022: + // expected 19.3678 (419af143), got 19.3678 (419af144), diff: 1.90735e-06, tol=0 + TransformerTester(build_test_case_1, + check_optimized_graph_1, + TransformerLevel::Default, + TransformerLevel::Level1, + /*opset_version*/ {15, 18}, + /*per_sample_tolerance*/ 1e-07, + /*relative_per_sample_tolerance*/ 1e-06); +#else TransformerTester(build_test_case_1, check_optimized_graph_1, TransformerLevel::Default, TransformerLevel::Level1, /*opset_version*/ {15, 18}); +#endif // defined(_M_ARM64) && _MSC_VER >= 1930 } TEST(TransposeOptimizerTests, TestBroadcastOpsPRelu) { diff --git a/onnxruntime/test/providers/qnn/average_pool_test.cc b/onnxruntime/test/providers/qnn/average_pool_test.cc index b354e91d41..c3cb696507 100644 --- a/onnxruntime/test/providers/qnn/average_pool_test.cc +++ b/onnxruntime/test/providers/qnn/average_pool_test.cc @@ -163,7 +163,7 @@ static void RunQDQAveragePoolOpTest(const std::vector& shape, // // AveragePool with kernel size equal to the spatial dimension of input tensor. -TEST(QnnCPUBackendTests, TestAveragePool_Global) { +TEST_F(QnnCPUBackendTests, TestAveragePool_Global) { RunAveragePoolOpTest({1, 2, 3, 3}, // shape {3, 3}, // kernel_shape {3, 3}, // strides @@ -174,7 +174,7 @@ TEST(QnnCPUBackendTests, TestAveragePool_Global) { } // AveragePool that counts padding. -TEST(QnnCPUBackendTests, TestAveragePool_CountIncludePad) { +TEST_F(QnnCPUBackendTests, TestAveragePool_CountIncludePad) { RunAveragePoolOpTest({1, 2, 3, 3}, // shape {1, 1}, // kernel_shape {1, 1}, // strides @@ -185,7 +185,7 @@ TEST(QnnCPUBackendTests, TestAveragePool_CountIncludePad) { } // AveragePool that use auto_pad 'SAME_UPPER'. -TEST(QnnCPUBackendTests, TestAveragePool_AutopadSameUpper) { +TEST_F(QnnCPUBackendTests, TestAveragePool_AutopadSameUpper) { RunAveragePoolOpTest({1, 2, 3, 3}, // shape {1, 1}, // kernel_shape {1, 1}, // strides @@ -196,7 +196,7 @@ TEST(QnnCPUBackendTests, TestAveragePool_AutopadSameUpper) { } // AveragePool that use auto_pad 'SAME_LOWER'. -TEST(QnnCPUBackendTests, TestAveragePool_AutopadSameLower) { +TEST_F(QnnCPUBackendTests, TestAveragePool_AutopadSameLower) { RunAveragePoolOpTest({1, 2, 3, 3}, // shape {1, 1}, // kernel_shape {1, 1}, // strides diff --git a/onnxruntime/test/providers/qnn/cast_test.cc b/onnxruntime/test/providers/qnn/cast_test.cc index 5fdd323e57..aa566faf85 100644 --- a/onnxruntime/test/providers/qnn/cast_test.cc +++ b/onnxruntime/test/providers/qnn/cast_test.cc @@ -72,19 +72,19 @@ static void RunCastOpTest(const std::vector& shape, ONNX_NAMESPACE::Ten // // Cast int32_t to float on CPU -TEST(QnnCPUBackendTests, TestCastInt32ToFloat) { +TEST_F(QnnCPUBackendTests, TestCastInt32ToFloat) { RunCastOpTest({2, 3}, ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT, ExpectedEPNodeAssignment::All, "TestCastInt32ToFloat", false); } // Cast uint8_t to float on CPU -TEST(QnnCPUBackendTests, TestCastUInt8ToFloat) { +TEST_F(QnnCPUBackendTests, TestCastUInt8ToFloat) { RunCastOpTest({2, 3}, ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT, ExpectedEPNodeAssignment::All, "TestCastUInt8ToFloat", false); } // Cast float to int32_t on CPU -TEST(QnnCPUBackendTests, TestCastFloatToInt32) { +TEST_F(QnnCPUBackendTests, TestCastFloatToInt32) { RunCastOpTest({2, 3}, ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT32, ExpectedEPNodeAssignment::All, "TestCastInt32ToFloat", false); } diff --git a/onnxruntime/test/providers/qnn/qnn_basic_test.cc b/onnxruntime/test/providers/qnn/qnn_basic_test.cc index b6741221d2..b8fd8efce4 100644 --- a/onnxruntime/test/providers/qnn/qnn_basic_test.cc +++ b/onnxruntime/test/providers/qnn/qnn_basic_test.cc @@ -129,25 +129,25 @@ static void RunNHWCResizeModel(const ORTCHAR_T* ort_model_path, bool use_htp) { // Test shape inference of NHWC Resize operator (opset 11) that uses // the scales input. Use the QNN CPU backend. -TEST(QnnCPUBackendTests, TestNHWCResizeShapeInference_scales_opset11) { +TEST_F(QnnCPUBackendTests, TestNHWCResizeShapeInference_scales_opset11) { RunNHWCResizeModel(ORT_MODEL_FOLDER "nhwc_resize_scales_opset11.onnx", false); } // Test shape inference of NHWC Resize operator (opset 18) that uses // the scales input. Use the QNN CPU backend. -TEST(QnnCPUBackendTests, TestNHWCResizeShapeInference_scales_opset18) { +TEST_F(QnnCPUBackendTests, TestNHWCResizeShapeInference_scales_opset18) { RunNHWCResizeModel(ORT_MODEL_FOLDER "nhwc_resize_scales_opset18.onnx", false); } // Test shape inference of NHWC Resize operator (opset 11) that uses // the sizes input. Use the QNN CPU backend. -TEST(QnnCPUBackendTests, TestNHWCResizeShapeInference_sizes_opset11) { +TEST_F(QnnCPUBackendTests, TestNHWCResizeShapeInference_sizes_opset11) { RunNHWCResizeModel(ORT_MODEL_FOLDER "nhwc_resize_sizes_opset11.onnx", false); } // Test shape inference of NHWC Resize operator (opset 18) that uses // the sizes input. Use the QNN CPU backend. -TEST(QnnCPUBackendTests, TestNHWCResizeShapeInference_sizes_opset18) { +TEST_F(QnnCPUBackendTests, TestNHWCResizeShapeInference_sizes_opset18) { RunNHWCResizeModel(ORT_MODEL_FOLDER "nhwc_resize_sizes_opset18.onnx", false); } diff --git a/onnxruntime/test/providers/qnn/qnn_test_utils.cc b/onnxruntime/test/providers/qnn/qnn_test_utils.cc index fb232620d4..cc945a4971 100644 --- a/onnxruntime/test/providers/qnn/qnn_test_utils.cc +++ b/onnxruntime/test/providers/qnn/qnn_test_utils.cc @@ -58,7 +58,7 @@ class MockKernelLookup : public onnxruntime::IExecutionProvider::IKernelLookup { // Testing helper function that calls QNN EP's GetCapability() function with a mock graph to check // if the HTP backend is available. // TODO: Remove once HTP can be emulated on Windows ARM64. -static HTPSupport GetHTPSupport(const onnxruntime::logging::Logger& logger) { +static BackendSupport GetHTPSupport(const onnxruntime::logging::Logger& logger) { onnxruntime::Model model("Check if HTP is available", false, logger); Graph& graph = model.MainGraph(); ModelTestBuilder helper(graph); @@ -70,7 +70,7 @@ static HTPSupport GetHTPSupport(const onnxruntime::logging::Logger& logger) { auto status = model.MainGraph().Resolve(); if (!status.IsOK()) { - return HTPSupport::HTP_SUPPORT_ERROR; + return BackendSupport::SUPPORT_ERROR; } // Create QNN EP and call GetCapability(). @@ -82,35 +82,102 @@ static HTPSupport GetHTPSupport(const onnxruntime::logging::Logger& logger) { qnn_ep->SetLogger(&logger); auto result = qnn_ep->GetCapability(graph_viewer, kernel_lookup); - return result.empty() ? HTPSupport::HTP_UNSUPPORTED : HTPSupport::HTP_SUPPORTED; + return result.empty() ? BackendSupport::UNSUPPORTED : BackendSupport::SUPPORTED; } void QnnHTPBackendTests::SetUp() { - if (cached_htp_support_ == HTPSupport::HTP_SUPPORTED) { + if (cached_htp_support_ == BackendSupport::SUPPORTED) { return; } const auto& logger = DefaultLoggingManager().DefaultLogger(); // Determine if HTP backend is supported only if we done so haven't before. - if (cached_htp_support_ == HTPSupport::HTP_SUPPORT_UNKNOWN) { + if (cached_htp_support_ == BackendSupport::SUPPORT_UNKNOWN) { cached_htp_support_ = GetHTPSupport(logger); } - if (cached_htp_support_ == HTPSupport::HTP_UNSUPPORTED) { + if (cached_htp_support_ == BackendSupport::UNSUPPORTED) { LOGS(logger, WARNING) << "QNN HTP backend is not available! Skipping test."; GTEST_SKIP(); - } else if (cached_htp_support_ == HTPSupport::HTP_SUPPORT_ERROR) { + } else if (cached_htp_support_ == BackendSupport::SUPPORT_ERROR) { LOGS(logger, ERROR) << "Failed to check if QNN HTP backend is available."; FAIL(); } } +// Testing helper function that calls QNN EP's GetCapability() function with a mock graph to check +// if the QNN CPU backend is available. +// TODO: Remove once the QNN CPU backend works on Windows ARM64 pipeline VM. +static BackendSupport GetCPUSupport(const onnxruntime::logging::Logger& logger) { + onnxruntime::Model model("Check if CPU is available", false, logger); + Graph& graph = model.MainGraph(); + ModelTestBuilder helper(graph); + + auto get_test_model_func = [](const std::vector& input_shape) -> GetTestModelFn { + return [input_shape](ModelTestBuilder& builder) { + const int64_t num_channels = input_shape[1]; + + auto* scale = builder.MakeInitializer({num_channels}, 0.0f, 1.0f); + auto* bias = builder.MakeInitializer({num_channels}, 0.0f, 4.0f); + auto* input_arg = builder.MakeInput(input_shape, 0.0f, 10.0f); + auto* instance_norm_output = builder.MakeOutput(); + builder.AddNode("InstanceNormalization", {input_arg, scale, bias}, {instance_norm_output}); + }; + }; + + // Build simple graph with a InstanceNormalization op. + GetQDQTestCaseFn build_test_case = get_test_model_func({1, 2, 3, 3}); + build_test_case(helper); + helper.SetGraphOutputs(); + auto status = model.MainGraph().Resolve(); + + if (!status.IsOK()) { + return BackendSupport::SUPPORT_ERROR; + } + + // Create QNN EP and call GetCapability(). + MockKernelLookup kernel_lookup; + onnxruntime::GraphViewer graph_viewer(graph); + std::unique_ptr qnn_ep = QnnExecutionProviderWithOptions( + {{"backend_path", "QnnCpu.dll"}}); + + qnn_ep->SetLogger(&logger); + auto result = qnn_ep->GetCapability(graph_viewer, kernel_lookup); + + return result.empty() ? BackendSupport::UNSUPPORTED : BackendSupport::SUPPORTED; +} + +void QnnCPUBackendTests::SetUp() { + if (cached_cpu_support_ == BackendSupport::SUPPORTED) { + return; + } + + const auto& logger = DefaultLoggingManager().DefaultLogger(); + + // Determine if CPU backend is supported only if we done so haven't before. + if (cached_cpu_support_ == BackendSupport::SUPPORT_UNKNOWN) { + cached_cpu_support_ = GetCPUSupport(logger); + } + + if (cached_cpu_support_ == BackendSupport::UNSUPPORTED) { + LOGS(logger, WARNING) << "QNN CPU backend is not available! Skipping test."; + GTEST_SKIP(); + } else if (cached_cpu_support_ == BackendSupport::SUPPORT_ERROR) { + LOGS(logger, ERROR) << "Failed to check if QNN CPU backend is available."; + FAIL(); + } +} + #if defined(_WIN32) -// TODO: Remove or set to HTP_SUPPORTED once HTP emulation is supported on win arm64. -HTPSupport QnnHTPBackendTests::cached_htp_support_ = HTPSupport::HTP_SUPPORT_UNKNOWN; +// TODO: Remove or set to SUPPORTED once HTP emulation is supported on win arm64. +BackendSupport QnnHTPBackendTests::cached_htp_support_ = BackendSupport::SUPPORT_UNKNOWN; + +// TODO: Remove or set to SUPPORTED once CPU backend works on win arm64 (pipeline VM). +BackendSupport QnnCPUBackendTests::cached_cpu_support_ = BackendSupport::SUPPORT_UNKNOWN; #else -HTPSupport QnnHTPBackendTests::cached_htp_support_ = HTPSupport::HTP_SUPPORTED; +BackendSupport QnnHTPBackendTests::cached_htp_support_ = BackendSupport::SUPPORTED; +BackendSupport QnnCPUBackendTests::cached_cpu_support_ = BackendSupport::SUPPORTED; #endif // defined(_WIN32) bool ReduceOpHasAxesInput(const std::string& op_type, int opset_version) { diff --git a/onnxruntime/test/providers/qnn/qnn_test_utils.h b/onnxruntime/test/providers/qnn/qnn_test_utils.h index 624b6528b9..91d74b2c12 100644 --- a/onnxruntime/test/providers/qnn/qnn_test_utils.h +++ b/onnxruntime/test/providers/qnn/qnn_test_utils.h @@ -34,21 +34,31 @@ void RunQnnModelTest(const GetTestModelFn& build_test_case, const ProviderOption int opset_version, ExpectedEPNodeAssignment expected_ep_assignment, int num_nodes_in_ep, const char* test_description, float fp32_abs_err = 1e-5f); -enum HTPSupport { - HTP_SUPPORT_UNKNOWN = 0, - HTP_UNSUPPORTED, - HTP_SUPPORTED, - HTP_SUPPORT_ERROR, +enum class BackendSupport { + SUPPORT_UNKNOWN, + UNSUPPORTED, + SUPPORTED, + SUPPORT_ERROR, }; -// Testing fixture class for tests that require the HTP backend. Checks if HTP is available before the test begins. +// Testing fixture class for tests that require the QNN HTP backend. Checks if HTP is available before the test begins. // The test is skipped if HTP is unavailable (may occur on Windows ARM64). // TODO: Remove once HTP can be emulated on Windows ARM64. class QnnHTPBackendTests : public ::testing::Test { protected: void SetUp() override; - static HTPSupport cached_htp_support_; // Set by the first test using this fixture. + static BackendSupport cached_htp_support_; // Set by the first test using this fixture. +}; + +// Testing fixture class for tests that require the QNN CPU backend. Checks if QNN CPU is available before the test +// begins. The test is skipped if the CPU backend is unavailable (may occur on Windows ARM64 VM). +// TODO: Remove once QNN CPU backend works on Windows ARM64 pipeline VM. +class QnnCPUBackendTests : public ::testing::Test { + protected: + void SetUp() override; + + static BackendSupport cached_cpu_support_; // Set by the first test using this fixture. }; /** diff --git a/onnxruntime/test/providers/qnn/reduce_op_cpu_test.cc b/onnxruntime/test/providers/qnn/reduce_op_cpu_test.cc index b5b1c64947..3be7416f51 100644 --- a/onnxruntime/test/providers/qnn/reduce_op_cpu_test.cc +++ b/onnxruntime/test/providers/qnn/reduce_op_cpu_test.cc @@ -104,7 +104,7 @@ static void RunReduceOpCpuTest(const std::string& op_type, int opset, const char // // - The input and output data type is int32. // - Uses opset 13, which has "axes" as an input. -TEST(QnnCPUBackendTests, TestInt32ReduceSumOpset13) { +TEST_F(QnnCPUBackendTests, TestInt32ReduceSumOpset13) { RunReduceOpCpuTest("ReduceSum", 13, "TestInt32ReduceSumOpset13"); } @@ -113,7 +113,7 @@ TEST(QnnCPUBackendTests, TestInt32ReduceSumOpset13) { // // - The input and output data type is int32. // - Uses opset 11, which has "axes" as an attribute. -TEST(QnnCPUBackendTests, TestInt32ReduceSumOpset11) { +TEST_F(QnnCPUBackendTests, TestInt32ReduceSumOpset11) { RunReduceOpCpuTest("ReduceSum", 11, "TestInt32ReduceSumOpset11"); } @@ -122,7 +122,7 @@ TEST(QnnCPUBackendTests, TestInt32ReduceSumOpset11) { // // - The input and output data type is float. // - Uses opset 13, which has "axes" as an input. -TEST(QnnCPUBackendTests, TestFloatReduceSumOpset13) { +TEST_F(QnnCPUBackendTests, TestFloatReduceSumOpset13) { RunReduceOpCpuTest("ReduceSum", 13, "TestFloatReduceSumOpset13"); } @@ -131,7 +131,7 @@ TEST(QnnCPUBackendTests, TestFloatReduceSumOpset13) { // // - The input and output data type is float. // - Uses opset 11, which has "axes" as an attribute. -TEST(QnnCPUBackendTests, TestFloatReduceSumOpset11) { +TEST_F(QnnCPUBackendTests, TestFloatReduceSumOpset11) { RunReduceOpCpuTest("ReduceSum", 11, "TestFloatReduceSumOpset11"); } @@ -144,7 +144,7 @@ TEST(QnnCPUBackendTests, TestFloatReduceSumOpset11) { // // - The input and output data type is float. // - Uses opset 18, which has "axes" as an input. -TEST(QnnCPUBackendTests, TestReduceProdOpset18) { +TEST_F(QnnCPUBackendTests, TestReduceProdOpset18) { RunReduceOpCpuTest("ReduceProd", 18, "TestReduceProdOpset18"); } @@ -153,7 +153,7 @@ TEST(QnnCPUBackendTests, TestReduceProdOpset18) { // // - The input and output data type is float. // - Uses opset 13, which has "axes" as an attribute. -TEST(QnnCPUBackendTests, TestReduceProdOpset13) { +TEST_F(QnnCPUBackendTests, TestReduceProdOpset13) { RunReduceOpCpuTest("ReduceProd", 13, "TestReduceProdOpset13"); } @@ -166,7 +166,7 @@ TEST(QnnCPUBackendTests, TestReduceProdOpset13) { // // - The input and output data type is float. // - Uses opset 18, which has "axes" as an input. -TEST(QnnCPUBackendTests, TestReduceMaxOpset18) { +TEST_F(QnnCPUBackendTests, TestReduceMaxOpset18) { RunReduceOpCpuTest("ReduceMax", 18, "TestReduceMaxOpset18"); } @@ -175,7 +175,7 @@ TEST(QnnCPUBackendTests, TestReduceMaxOpset18) { // // - The input and output data type is float. // - Uses opset 13, which has "axes" as an attribute. -TEST(QnnCPUBackendTests, TestReduceMaxOpset13) { +TEST_F(QnnCPUBackendTests, TestReduceMaxOpset13) { RunReduceOpCpuTest("ReduceMax", 13, "TestReduceMaxOpset13"); } @@ -188,7 +188,7 @@ TEST(QnnCPUBackendTests, TestReduceMaxOpset13) { // // - The input and output data type is float. // - Uses opset 18, which has "axes" as an input. -TEST(QnnCPUBackendTests, TestReduceMinOpset18) { +TEST_F(QnnCPUBackendTests, TestReduceMinOpset18) { RunReduceOpCpuTest("ReduceMin", 18, "TestReduceMinOpset18"); } @@ -197,7 +197,7 @@ TEST(QnnCPUBackendTests, TestReduceMinOpset18) { // // - The input and output data type is float. // - Uses opset 13, which has "axes" as an attribute. -TEST(QnnCPUBackendTests, TestReduceMinOpset13) { +TEST_F(QnnCPUBackendTests, TestReduceMinOpset13) { RunReduceOpCpuTest("ReduceMin", 13, "TestReduceMinOpset18"); } @@ -210,7 +210,7 @@ TEST(QnnCPUBackendTests, TestReduceMinOpset13) { // // - The input and output data type is float. // - Uses opset 18, which has "axes" as an input. -TEST(QnnCPUBackendTests, TestReduceMeanOpset18) { +TEST_F(QnnCPUBackendTests, TestReduceMeanOpset18) { RunReduceOpCpuTest("ReduceMean", 18, "TestReduceMeanOpset18"); } @@ -219,7 +219,7 @@ TEST(QnnCPUBackendTests, TestReduceMeanOpset18) { // // - The input and output data type is float. // - Uses opset 13, which has "axes" as an attribute. -TEST(QnnCPUBackendTests, TestReduceMeanOpset13) { +TEST_F(QnnCPUBackendTests, TestReduceMeanOpset13) { RunReduceOpCpuTest("ReduceMean", 13, "TestReduceMeanOpset13"); } diff --git a/onnxruntime/test/providers/qnn/resize_test.cc b/onnxruntime/test/providers/qnn/resize_test.cc index 319c81a764..679256d628 100644 --- a/onnxruntime/test/providers/qnn/resize_test.cc +++ b/onnxruntime/test/providers/qnn/resize_test.cc @@ -163,56 +163,56 @@ static void RunQDQResizeOpTest(const std::vector& shape, const std::vec // Upsample that uses "round_prefer_floor" as the "nearest_mode". // coordinate_transformation_mode: "half_pixel" -TEST(QnnCPUBackendTests, DISABLED_TestResizeUpsampleNearestHalfPixel_rpf) { +TEST_F(QnnCPUBackendTests, DISABLED_TestResizeUpsampleNearestHalfPixel_rpf) { RunCPUResizeOpTest({1, 2, 7, 5}, {1, 2, 21, 10}, "nearest", "half_pixel", "round_prefer_floor", ExpectedEPNodeAssignment::All, "TestResizeUpsampleNearestHalfPixel_rpf"); } // Upsample that uses "round_prefer_ceil" as the "nearest_mode". // coordinate_transformation_mode: "half_pixel" -TEST(QnnCPUBackendTests, DISABLED_TestResizeUpsampleNearestHalfPixel_rpc) { +TEST_F(QnnCPUBackendTests, DISABLED_TestResizeUpsampleNearestHalfPixel_rpc) { RunCPUResizeOpTest({1, 1, 2, 4}, {1, 1, 7, 5}, "nearest", "half_pixel", "round_prefer_ceil", ExpectedEPNodeAssignment::All, "TestResizeUpsampleNearestHalfPixel_rpc"); } // Downsample that uses "round_prefer_ceil" as the "nearest_mode". // coordinate_transformation_mode: "half_pixel" -TEST(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestHalfPixel_rpc) { +TEST_F(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestHalfPixel_rpc) { RunCPUResizeOpTest({1, 1, 2, 4}, {1, 1, 1, 3}, "nearest", "half_pixel", "round_prefer_ceil", ExpectedEPNodeAssignment::All, "TestResizeDownsampleNearestHalfPixel_rpc"); } // Downsample that uses "round_prefer_floor" as the "nearest_mode". // coordinate_transformation_mode: "half_pixel" -TEST(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestHalfPixel_rpf) { +TEST_F(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestHalfPixel_rpf) { RunCPUResizeOpTest({1, 1, 2, 4}, {1, 1, 1, 2}, "nearest", "half_pixel", "round_prefer_ceil", ExpectedEPNodeAssignment::All, "TestResizeDownsampleNearestHalfPixel_rpf"); } // Upsample that uses "round_prefer_floor" as the "nearest_mode". // coordinate_transformation_mode: "align_corners" -TEST(QnnCPUBackendTests, DISABLED_TestResizeUpsampleNearestAlignCorners_rpf) { +TEST_F(QnnCPUBackendTests, DISABLED_TestResizeUpsampleNearestAlignCorners_rpf) { RunCPUResizeOpTest({1, 2, 7, 5}, {1, 2, 21, 10}, "nearest", "align_corners", "round_prefer_floor", ExpectedEPNodeAssignment::All, "TestResizeUpsampleNearestAlignCorners_rpf"); } // Upsample that uses "round_prefer_ceil" as the "nearest_mode". // coordinate_transformation_mode: "align_corners" -TEST(QnnCPUBackendTests, DISABLED_TestResizeUpsampleNearestAlignCorners_rpc) { +TEST_F(QnnCPUBackendTests, DISABLED_TestResizeUpsampleNearestAlignCorners_rpc) { RunCPUResizeOpTest({1, 1, 2, 4}, {1, 1, 7, 5}, "nearest", "align_corners", "round_prefer_ceil", ExpectedEPNodeAssignment::All, "TestResizeUpsampleNearestAlignCorners_rpc"); } // Downsample that uses "round_prefer_ceil" as the "nearest_mode". // coordinate_transformation_mode: "align_corners" -TEST(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestAlignCorners_rpc) { +TEST_F(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestAlignCorners_rpc) { RunCPUResizeOpTest({1, 1, 2, 4}, {1, 1, 1, 3}, "nearest", "align_corners", "round_prefer_ceil", ExpectedEPNodeAssignment::All, "TestResizeDownsampleNearestAlignCorners_rpc"); } // Downsample that uses "round_prefer_floor" as the "nearest_mode". // coordinate_transformation_mode: "align_corners" -TEST(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestAlignCorners_rpf) { +TEST_F(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestAlignCorners_rpf) { RunCPUResizeOpTest({1, 1, 2, 4}, {1, 1, 1, 2}, "nearest", "align_corners", "round_prefer_floor", ExpectedEPNodeAssignment::All, "TestResizeDownsampleNearestAlignCorners_rpf"); } @@ -221,22 +221,22 @@ TEST(QnnCPUBackendTests, DISABLED_TestResizeDownsampleNearestAlignCorners_rpf) { // Cpu tests that use the "linear" mode. // -TEST(QnnCPUBackendTests, TestResize2xLinearHalfPixel) { +TEST_F(QnnCPUBackendTests, TestResize2xLinearHalfPixel) { RunCPUResizeOpTest({1, 3, 4, 5}, {1, 3, 8, 10}, "linear", "half_pixel", "", ExpectedEPNodeAssignment::All, "TestResize2xLinearHalfPixel"); } -TEST(QnnCPUBackendTests, TestResize2xLinearHalfPixel_scales) { +TEST_F(QnnCPUBackendTests, TestResize2xLinearHalfPixel_scales) { RunCPUResizeOpTestWithScales({1, 3, 4, 5}, {1.0f, 1.0f, 2.0f, 2.0f}, "linear", "half_pixel", "", ExpectedEPNodeAssignment::All, "TestResize2xLinearHalfPixel_scales"); } -TEST(QnnCPUBackendTests, TestResize2xLinearAlignCorners) { +TEST_F(QnnCPUBackendTests, TestResize2xLinearAlignCorners) { RunCPUResizeOpTest({1, 3, 4, 5}, {1, 3, 8, 10}, "linear", "align_corners", "", ExpectedEPNodeAssignment::All, "TestResize2xLinearAlignCorners"); } -TEST(QnnCPUBackendTests, TestResize2xLinearAlignCorners_scales) { +TEST_F(QnnCPUBackendTests, TestResize2xLinearAlignCorners_scales) { RunCPUResizeOpTestWithScales({1, 3, 4, 5}, {1.0f, 1.0f, 2.0f, 2.0f}, "linear", "align_corners", "", ExpectedEPNodeAssignment::All, "TestResize2xLinearAlignCorners_scales"); } diff --git a/tools/ci_build/github/azure-pipelines/win-qnn-arm64-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-qnn-arm64-ci-pipeline.yml index 8bf1ed858d..ecf668fef2 100644 --- a/tools/ci_build/github/azure-pipelines/win-qnn-arm64-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-qnn-arm64-ci-pipeline.yml @@ -10,13 +10,10 @@ parameters: jobs: - job: 'build' - pool: 'Onnxruntime-QNNEP-Windows-2022-ARM64-CPU' + pool: 'onnxruntime-qnn-windows-vs-2022-arm64' variables: - MsbuildArguments: '-detailedsummary -maxcpucount -consoleloggerparameters:PerformanceSummary' - OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)' DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true buildArch: arm64 - setVcvars: true BuildConfig: 'RelWithDebInfo' ALLOW_RELEASED_ONNX_OPSET_ONLY: '1' QNN_SDK_ROOT: 'C:\data\qnnsdk\${{parameters.QnnSdk}}' @@ -49,30 +46,16 @@ jobs: versionSpec: 6.4.x - task: PythonScript@0 - displayName: 'Generate cmake config' - inputs: - scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--arm64 --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --update --cmake_generator "Visual Studio 16 2019" --use_qnn --qnn_home $(QNN_SDK_ROOT) --parallel' - workingDirectory: '$(Build.BinariesDirectory)' - - - task: VSBuild@1 displayName: 'Build' inputs: - solution: '$(Build.BinariesDirectory)\$(BuildConfig)\onnxruntime.sln' - platform: 'arm64' - configuration: $(BuildConfig) - msbuildArgs: $(MsbuildArguments) - msbuildArchitecture: $(buildArch) - maximumCpuCount: true - logProjectEvents: false - workingFolder: '$(Build.BinariesDirectory)\$(BuildConfig)' - createLogFile: true + scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' + arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_tests --cmake_generator "Visual Studio 17 2022" --use_qnn --qnn_home $(QNN_SDK_ROOT) --parallel' + workingDirectory: '$(Build.BinariesDirectory)' - powershell: | - python $(Build.SourcesDirectory)\tools\ci_build\build.py --arm64 --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --test --cmake_generator "Visual Studio 16 2019" --enable_onnx_tests + python $(Build.SourcesDirectory)\tools\ci_build\build.py --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --test --cmake_generator "Visual Studio 17 2022" --enable_onnx_tests workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)' displayName: 'Run unit tests' - enabled: false - script: | .\$(BuildConfig)\onnx_test_runner -j 1 -c 1 -v -e qnn -i "backend_path|$(QNN_SDK_ROOT)\target\aarch64-windows-msvc\lib\QnnCpu.dll" $(Build.SourcesDirectory)\cmake\external\onnx\onnx\backend\test\data\node