enable pybind for qnn ep (#14897)

enable python bindings for QNN EP.
tested on Windows Dev Kit 2023 (ARM64) with python 3.11 (ARM64) from 
https://www.python.org/ftp/python/3.11.1/python-3.11.1-arm64.exe
This commit is contained in:
George Wu 2023-03-03 07:26:53 -08:00 committed by GitHub
parent f6c81d8aca
commit 289f7dbcdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 0 deletions

View file

@ -212,6 +212,7 @@ target_link_libraries(onnxruntime_pybind11_state PRIVATE
${PROVIDERS_ARMNN}
${PROVIDERS_XNNPACK}
${PROVIDERS_AZURE}
${PROVIDERS_QNN}
onnxruntime_optimizer
onnxruntime_providers
onnxruntime_util

View file

@ -82,6 +82,14 @@ constexpr ProviderInfo kProvidersInPriorityOrder[] =
true,
#else
false,
#endif
},
{
kQnnExecutionProvider,
#ifdef USE_QNN
true,
#else
false,
#endif
},
{

View file

@ -758,6 +758,12 @@ std::unique_ptr<IExecutionProvider> CreateExecutionProviderInstance(
} else if (type == kAzureExecutionProvider) {
#ifdef USE_AZURE
return onnxruntime::AzureProviderFactoryCreator::Create({})->CreateProvider();
#endif
} else if (type == kQnnExecutionProvider) {
#ifdef USE_QNN
auto cit = provider_options_map.find(type);
return onnxruntime::QNNProviderFactoryCreator::Create(
cit == provider_options_map.end() ? ProviderOptions{} : cit->second)->CreateProvider();
#endif
} else {
// check whether it is a dynamic load EP:

View file

@ -82,6 +82,8 @@ elif parse_arg_remove_boolean(sys.argv, "--use_cann"):
package_name = "onnxruntime-cann"
elif parse_arg_remove_boolean(sys.argv, "--use_azure"):
package_name = "onnxruntime-azure"
elif parse_arg_remove_boolean(sys.argv, "--use_qnn"):
package_name = "onnxruntime-qnn"
# PEP 513 defined manylinux1_x86_64 and manylinux1_i686
# PEP 571 defined manylinux2010_x86_64 and manylinux2010_i686

View file

@ -1950,6 +1950,7 @@ def build_python_wheel(
use_dml,
use_cann,
use_azure,
use_qnn,
wheel_name_suffix,
enable_training,
nightly_build=False,
@ -2010,6 +2011,8 @@ def build_python_wheel(
args.append("--use_cann")
elif use_azure:
args.append("--use_azure")
elif use_qnn:
args.append("--use_qnn")
run_subprocess(args, cwd=cwd)
@ -2705,6 +2708,7 @@ def main():
args.use_dml,
args.use_cann,
args.use_azure,
args.use_qnn,
args.wheel_name_suffix,
args.enable_training,
nightly_build=nightly_build,