@@ -1649,6 +1649,7 @@ static void DumpModelWithSharedCtx(ProviderOptions provider_options,
16491649 Ort::Session session2 (*ort_env, ToPathString (onnx_model_path2).c_str (), so);
16501650}
16511651
1652+ #if defined(__aarch64__) || defined(_M_ARM64)
16521653static void GetModelInputNames (const std::string& model_path,
16531654 std::vector<std::string>& input_names,
16541655 std::vector<std::string>& output_names,
@@ -1668,6 +1669,7 @@ static void GetModelInputNames(const std::string& model_path,
16681669 output_names.push_back (output->Name ());
16691670 }
16701671}
1672+ #endif
16711673
16721674// 1. Create 2 QDQ models
16731675// 2. Initialize 2 Ort sessions which share the same QNN EP from these 2 QDQ models
@@ -1996,73 +1998,6 @@ TEST_F(QnnHTPBackendTests, LoadFromArrayWithQnnEpContextGenPathValidation) {
19961998 });
19971999 }
19982000}
1999-
2000- TEST_F (QnnHTPBackendTests, QnnEpDynamicOptions) {
2001- ProviderOptions provider_options;
2002- provider_options[" backend_type" ] = " htp" ;
2003- provider_options[" offload_graph_io_quantization" ] = " 0" ;
2004-
2005- Ort::SessionOptions so;
2006- so.AppendExecutionProvider (" QNN" , provider_options);
2007- so.SetLogSeverityLevel (ORT_LOGGING_LEVEL_VERBOSE);
2008-
2009- Ort::Session session (*ort_env, ORT_TSTR (" testdata/qnn_ctx/qnn_multi_ctx_embed.onnx" ), so);
2010-
2011- std::vector<std::string> input_names;
2012- std::vector<std::string> output_names;
2013- GetModelInputNames (" testdata/qnn_ctx/qnn_multi_ctx_embed.onnx" , input_names, output_names,
2014- DefaultLoggingManager ().DefaultLogger ());
2015-
2016- // Run sessions
2017- // prepare input
2018- std::vector<int64_t > input_dim{3 , 4 };
2019- std::vector<float > input_value (3 * 4 , 0 .0f );
2020- Ort::MemoryInfo info (" Cpu" , OrtDeviceAllocator, 0 , OrtMemTypeDefault);
2021- std::vector<Ort::Value> ort_inputs;
2022- std::vector<const char *> input_names_c;
2023- for (size_t i = 0 ; i < input_names.size (); ++i) {
2024- auto input_tensor = Ort::Value::CreateTensor (info, input_value.data (), input_value.size (),
2025- input_dim.data (), input_dim.size ());
2026- ort_inputs.push_back (std::move (input_tensor));
2027- input_names_c.push_back (input_names[i].c_str ());
2028- }
2029- std::vector<const char *> output_names_c;
2030- for (size_t i = 0 ; i < output_names.size (); ++i) {
2031- output_names_c.push_back (output_names[i].c_str ());
2032- }
2033-
2034- auto ort_output = session.Run (Ort::RunOptions{}, input_names_c.data (), ort_inputs.data (), ort_inputs.size (),
2035- output_names_c.data (), 1 );
2036-
2037- const char * const workload_type[] = {" ep.dynamic.workload_type" };
2038- const char * const efficient_type[] = {" Efficient" };
2039- const char * const default_type[] = {" Default" };
2040-
2041- // Test Efficent & Default options
2042- session.SetEpDynamicOptions (workload_type, efficient_type, 1 );
2043- ort_output = session.Run (Ort::RunOptions{}, input_names_c.data (), ort_inputs.data (), ort_inputs.size (),
2044- output_names_c.data (), 1 );
2045-
2046- session.SetEpDynamicOptions (workload_type, default_type, 1 );
2047- ort_output = session.Run (Ort::RunOptions{}, input_names_c.data (), ort_inputs.data (), ort_inputs.size (),
2048- output_names_c.data (), 1 );
2049-
2050- // Test invalid EP dynamic option and invalid workload type
2051- const char * const dne[] = {" DNE" };
2052- try {
2053- session.SetEpDynamicOptions (workload_type, dne, 1 );
2054- FAIL () << " Expected exception to be thrown for workload type DNE but was set successfully" ;
2055- } catch (const std::exception& e) {
2056- EXPECT_STREQ (" Invalid EP Workload Type." , e.what ());
2057- }
2058-
2059- try {
2060- session.SetEpDynamicOptions (dne, efficient_type, 1 );
2061- FAIL () << " Expected exception to be thrown for dynamic option DNE but was set successfully" ;
2062- } catch (const std::exception& e) {
2063- EXPECT_STREQ (" Unsupported EP Dynamic Option" , e.what ());
2064- }
2065- }
20662001#endif // defined(__aarch64__) || defined(_M_ARM64) || defined(__linux__)
20672002
20682003} // namespace test
0 commit comments