Fix libc++.so.1 missing for qnn-context-binary-utility (#19622)#19622
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19622
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit d55f8b6 with merge base a8cfe2b ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@psiddh has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105378870. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
This PR fixes Qualcomm QNN test failures caused by QNN SDK prebuilt tools (notably qnn-context-binary-utility in QNN SDK 2.37) being unable to locate their bundled libc++.so.1 inside the test sandbox. It does so by explicitly prepending the QNN SDK’s lib/<target>/ directory to LD_LIBRARY_PATH for subprocess invocations, and improves failure diagnostics for missing ctx.json.
Changes:
- Add
_qnn_subprocess_env()helper to construct an env dict withLD_LIBRARY_PATHincluding$QNN_SDK_ROOT/lib/<target>. - Wire the helper into subprocess calls for context binary generation/validation.
- Improve the
validate_context_binaryassertion message to include stdout/stderr whenctx.jsonis not produced.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary:
The QNN SDK 2.37 prebuilt 'qnn-context-binary-utility' is dynamically
linked against libc++.so.1, which is shipped at $QNN_SDK_ROOT/lib/<target>/
but not visible on the default LD_LIBRARY_PATH inside the fbcode test
sandbox. As a result, every invocation of validate_context_binary failed
with:
qnn-context-binary-utility: error while loading shared libraries:
libc++.so.1: cannot open shared object file: No such file or directory
…and the test asserted on a missing ctx.json with a useless
'AssertionError: None' (because print() returns None).
This change adds a small _qnn_subprocess_env() helper that prepends the
QNN SDK's bundled lib dir to LD_LIBRARY_PATH and wires it into both
validate_context_binary and generate_context_binary subprocess calls.
Also replaces print(result.stderr) inside the assert with a proper
diagnostic message including stdout and stderr.
Affected tests (previously 0% pass rate, now passing):
- test_qnn_backend_dump_context_from_pte (Float + Quant variants)
- test_qnn_backend_context_extraction (Float + Quant variants)
Differential Revision: D105378870
Summary:
The QNN SDK 2.37 prebuilt 'qnn-context-binary-utility' is dynamically
linked against libc++.so.1, which is shipped at $QNN_SDK_ROOT/lib/<target>/
but not visible on the default LD_LIBRARY_PATH inside the fbcode test
sandbox. As a result, every invocation of validate_context_binary failed
with:
qnn-context-binary-utility: error while loading shared libraries:
libc++.so.1: cannot open shared object file: No such file or directory
…and the test asserted on a missing ctx.json with a useless
'AssertionError: None' (because print() returns None).
This change adds a small _qnn_subprocess_env() helper that prepends the
QNN SDK's bundled lib dir to LD_LIBRARY_PATH and wires it into both
validate_context_binary and generate_context_binary subprocess calls.
Also replaces print(result.stderr) inside the assert with a proper
diagnostic message including stdout and stderr.
Affected tests (previously 0% pass rate, now passing):
- test_qnn_backend_dump_context_from_pte (Float + Quant variants)
- test_qnn_backend_context_extraction (Float + Quant variants)
Differential Revision: D105378870
Summary:
The QNN SDK 2.37 prebuilt 'qnn-context-binary-utility' is dynamically
linked against libc++.so.1, which is shipped at $QNN_SDK_ROOT/lib//
but not visible on the default LD_LIBRARY_PATH inside the fbcode test
sandbox. As a result, every invocation of validate_context_binary failed
with:
…and the test asserted on a missing ctx.json with a useless
'AssertionError: None' (because print() returns None).
This change adds a small _qnn_subprocess_env() helper that prepends the
QNN SDK's bundled lib dir to LD_LIBRARY_PATH and wires it into both
validate_context_binary and generate_context_binary subprocess calls.
Also replaces print(result.stderr) inside the assert with a proper
diagnostic message including stdout and stderr.
Affected tests (previously 0% pass rate, now passing):
Differential Revision: D105378870