Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Build] QNN EP on windows #16595

Closed
mwangistan opened this issue Jul 5, 2023 · 5 comments
Closed

[Build] QNN EP on windows #16595

mwangistan opened this issue Jul 5, 2023 · 5 comments
Labels
build build issues; typically submitted using template ep:QNN issues related to QNN exeution provider platform:windows issues related to the Windows platform

Comments

@mwangistan
Copy link

Describe the issue

Can't build onnx using QNN EP on windows

Urgency

No response

Target platform

Windows

Build script

build.bat --config RelWithDebInfo --use_qnn --qnn_home="qualcomm_ai_engine_direct.2.12.1.230626.Windows-AnyCPU.exe" --build_wheel --cmake_generator "Visual Studio 17 2022" --skip_submodule_sync --config Release --build_dir \build\Windows

Error / output

'QnnInterface.h': No such file or directory

Visual Studio Version

Visual studio 17 2022

GCC / Compiler Version

No response

@mwangistan mwangistan added the build build issues; typically submitted using template label Jul 5, 2023
@github-actions github-actions bot added the platform:windows issues related to the Windows platform label Jul 5, 2023
@mwangistan mwangistan changed the title [Build] QNN on windows [Build] QNN EP on windows Jul 5, 2023
@baijumeswani baijumeswani added the ep:QNN issues related to QNN exeution provider label Jul 6, 2023
@jywu-msft
Copy link
Member

qnn_home should point to your QNN SDK install location (which should have include and target subdirectories)
the build error is complaining it can't find QNN header files.
can you confirm the contents of your QNN SDK directory?

@mwangistan
Copy link
Author

mwangistan commented Jul 12, 2023

Thanks for the response @jywu-msft . I was not using the correct path

I'm now running
build.bat --config RelWithDebInfo --use_qnn --qnn_home="C:\Qualcomm\AIStack\QNN\2.10.40.4" --build_wheel --cmake_generator "Visual Studio 17 2022" --skip_submodule_sync --config Release --build_dir \build\Windows

The build completes successfully but I notice some error related to QNN SetupBackend. Am I missing something else?
2023-07-12 13:03:04.0845847 [E:onnxruntime:, qnn_execution_provider.cc:287 onnxruntime::QNNExecutionProvider::GetCapability] QNN SetupBackend failed qnn_backend_manager.cc:40 onnxruntime::qnn::QnnBackendManager::GetQnnInterfaceProviders Unable to load backend, error: filename is null or empty

Screenshot 2023-07-12 131359

@jywu-msft
Copy link
Member

jywu-msft commented Jul 17, 2023

can you confirm a few things for us?

  1. are you using Visual Studios 2022 ARM 64bit (not x64) ?
  2. are you using ARM64 version of python3 ? e.g. https://www.python.org/ftp/python/3.12.0/python-3.12.0b3-embed-arm64.zip
  3. is the QNN SDK lib dir in your PATH env variable? (e.g. C:\Qualcomm\AIStack\QNN\2.12.1.230626\lib\aarch64-windows-msvc)

@jywu-msft
Copy link
Member

re: #3, there's a bit more detail to add.

in addition to adding the lib location (I updated comment above to provide example of lib location),
you also need to make sure the skel file (e.g. libQnnHtpV68Skel.so) is in the PATH as well. one can copy that file to the QNN SDK lib directory (e.g. C:\Qualcomm\AIStack\QNN\2.12.1.230626\lib\aarch64-windows-msvc).

I tested latest build from main and it seems to work okay.

import onnxruntime as ort
sess = ort.InferenceSession('mobilenet_quant.onnx', providers=['QNNExecutionProvider'], provider_options=[{'backend_path':'QnnHtp.dll'}])

@mwangistan
Copy link
Author

I hadn't done step 3. It works now. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template ep:QNN issues related to QNN exeution provider platform:windows issues related to the Windows platform
Projects
None yet
Development

No branches or pull requests

3 participants