Skip to content

ort-qnn: Build onnxruntime QNN Execution Provider plugin v2.4.0 - #2837

Open
pratikpachange97 wants to merge 1 commit into
qualcomm-linux:masterfrom
pratikpachange97:ort-qnn
Open

ort-qnn: Build onnxruntime QNN Execution Provider plugin v2.4.0#2837
pratikpachange97 wants to merge 1 commit into
qualcomm-linux:masterfrom
pratikpachange97:ort-qnn

Conversation

@pratikpachange97

Copy link
Copy Markdown
Contributor

QNN EP is a standalone ABI-stable plugin execution provider that brings Qualcomm hardware acceleration to ONNX Runtime. Starting with v2.0.0, the QNN EP ships as a standalone shared library built on the Execution Provider ABI. The plugin is registered at runtime and only links against the standard ONNX Runtime shared library.
Added collection name "ai" and corresponding filename pattern and layer.conf for this recipe file as it depends on meta-ai layer.

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

Test run workflow

Test jobs for commit 076f089

nodistro
Pass: 10 | Fail: 0 | Total: 10
qcom-distro
Pass: 291 | Fail: 10 | Total: 342
qcom-distro_linux-qcom-6.18
Pass: 7 | Fail: 1 | Total: 8

@test-reporting-app

test-reporting-app Bot commented Jul 29, 2026

Copy link
Copy Markdown

Test Results

   79 files  + 11    409 suites  +90   7h 23m 21s ⏱️ + 2h 2m 43s
  161 tests + 10    145 ✅  -   2   2 💤 + 2  14 ❌ +10 
2 666 runs  +565  2 594 ✅ +527  41 💤 +11  31 ❌ +27 

For more details on these failures, see this check.

Results for commit 076f089. ± Comparison against base commit 9597e0b.

♻️ This comment has been updated with latest results.

@qcomlnxci

Copy link
Copy Markdown

Test Coral run workflow

Test jobs for commit d734912

  • qcomdistro: multimedia image
    Pass: 9 | Fail: 0 | Total: 9
  • qcomdistro: multimedia image-prop
    Pass: 48 | Fail: 0 | Total: 48

Comment thread dynamic-layers/ai/recipes-ml/onnxruntime-qnn/onnxruntime-qnn_2.4.0.bb Outdated
# Fix buildpaths QA issue: remap TMPDIR references in both debug info and
# string literals embedded in the compiled libraries.
CFLAGS:append = " -ffile-prefix-map=${WORKDIR}=. -ffile-prefix-map=${S}=. -ffile-prefix-map=${B}=."
CXXFLAGS:append = " -ffile-prefix-map=${WORKDIR}=. -ffile-prefix-map=${S}=. -ffile-prefix-map=${B}=."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are already set via DEBUG_PREFIX_MAP. Are OECMAKE flags being overridden by the project?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEBUG_PREFIX_MAP is set as follows

DEBUG_PREFIX_MAP="-fcanon-prefix-map -ffile-prefix-map=/local/mnt/workspace/mainline/build/tmp/work/cortexa53-qcom-linux/onnxruntime-qnn/2.4.0/sources/onnxruntime-qnn-2.4.0=/usr/src/debug/onnxruntime-qnn/2.4.0 -ffile-prefix-map=/local/mnt/workspace/mainline/build/tmp/work/cortexa53-qcom-linux/onnxruntime-qnn/2.4.0/build=/usr/src/debug/onnxruntime-qnn/2.4.0 -ffile-prefix-map=/local/mnt/workspace/mainline/build/tmp/work/cortexa53-qcom-linux/onnxruntime-qnn/2.4.0/recipe-sysroot= -ffile-prefix-map=/local/mnt/workspace/mainline/build/tmp/work/cortexa53-qcom-linux/onnxruntime-qnn/2.4.0/recipe-sysroot-native= "

Here -ffile-prefix-map=${WORKDIR}=. is missing in the DEBUG_PREFIX_MAP

If I remove these flags I am getting following error
ERROR: onnxruntime-qnn-2.4.0-r0 do_package_qa: QA Issue: File /usr/lib/.debug/libonnxruntime_providers_qnn.so in package onnxruntime-qnn-dbg contains referenc
e to TMPDIR [buildpaths]

Following flags are required to resolve this error

CFLAGS:append   = " -ffile-prefix-map=${WORKDIR}=."
CXXFLAGS:append = " -ffile-prefix-map=${WORKDIR}=."

Should I update these flags as above ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is not being handled? Which paths are left uncovered by OE classes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-ffile-prefix-map=/local/mnt/workspace/mainline/build/tmp/work/cortexa53-qcom-linux/onnxruntime-qnn/2.4.0=.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the path embedded in binary? WORKDIR in this case is /local/mnt/workspace/mainline/build/tmp/work/cortexa53-qcom-linux/onnxruntime-qnn/2.4.0 so unless the path embedded is specifically only WORKDIR, which is unlikely, it should already be covered.

Usually, it's a problem when the project is overriding these flags passed by OE. In this case, it might be overriding CMAKE_C*_FLAGS.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project is not overriding the flags
It seems the issue is due the git://github.com/dcleblanc/SafeInt.git source fetched to ${WORKDIR}/sources/safeint

The libonnxruntime_providers_qnn.so extracted from onnxruntime-qnn-dbg-2.4.0-r0.cortexa53.rpm has DWARF directory-table entry ./sources/safeint

OE's built-in DEBUG_PREFIX_MAP only remaps ${S} and ${B}
DEBUG_PREFIX_MAP="-fcanon-prefix-map -ffile-prefix-map=/local/mnt/workspace/mainline/build/tmp/work/cortexa53-qcom-linux/onnxruntime-qnn/2.4.0/sources/onnxruntime-qnn-2.4.0=/usr/src/debug/onnxruntime-qnn/2.4.0 -ffile-prefix-map=/local/mnt/workspace/mainline/build/tmp/work/cortexa53-qcom-linux/onnxruntime-qnn/2.4.0/build=/usr/src/debug/onnxruntime-qnn/2.4.0

It has no entry for ${WORKDIR}/sources/safeint.

So I guess adding

CFLAGS:append   = " -ffile-prefix-map=${WORKDIR}=."
CXXFLAGS:append = " -ffile-prefix-map=${WORKDIR}=."

is helping to fix this QA failure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for checking. In that case, I think adding this would resolve this:

--- a/dynamic-layers/ai/recipes-ml/onnxruntime-qnn/onnxruntime-qnn_2.4.0.bb
+++ b/dynamic-layers/ai/recipes-ml/onnxruntime-qnn/onnxruntime-qnn_2.4.0.bb
@@ -16,7 +16,7 @@ DEPENDS = " \
 "

 SRC_URI = "git://github.com/onnxruntime/onnxruntime-qnn.git;protocol=https;nobranch=1;tag=v${PV};name=ort-qnn \
-    git://github.com/dcleblanc/SafeInt.git;protocol=https;nobranch=1;name=safeint;tag=3.0.28;destsuffix=safeint \
+    git://github.com/dcleblanc/SafeInt.git;protocol=https;nobranch=1;name=safeint;tag=3.0.28;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/safeint \
     file://0001-cmake-Rename-pkg-config-output-to-libonnxruntime_pr.patch \
 "

@@ -49,7 +49,7 @@ EXTRA_OECMAKE = " \
     -DCMAKE_BUILD_TYPE=RelWithDebInfo \
     -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_TARGET} \
     -DFETCHCONTENT_FULLY_DISCONNECTED=ON \
-    -DFETCHCONTENT_SOURCE_DIR_SAFEINT=${UNPACKDIR}/safeint \
+    -DFETCHCONTENT_SOURCE_DIR_SAFEINT=${S}/safeint \
     -DONNX_CUSTOM_PROTOC_EXECUTABLE=${STAGING_BINDIR_NATIVE}/protoc \
     -Donnxruntime_BUILD_SHARED_LIB=ON \
     -Donnxruntime_BUILD_UNIT_TESTS=OFF \


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this in my local build as well and it works for me.

Comment thread dynamic-layers/ai/recipes-ml/onnxruntime-qnn/onnxruntime-qnn_2.4.0.bb Outdated
Comment thread dynamic-layers/ai/recipes-ml/onnxruntime-qnn/onnxruntime-qnn_2.4.0.bb Outdated
Comment thread dynamic-layers/ai/recipes-ml/onnxruntime-qnn/onnxruntime-qnn_2.4.0.bb Outdated

@koenkooi Koen Kooi (koenkooi) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very close to the onnxruntime recipe in meta-ai and it seems to need the same fixes. Looks good enough to me.

Comment thread conf/layer.conf Outdated
@qcomlnxci

Copy link
Copy Markdown

Test Coral run workflow

Test jobs for commit cd679a5

  • qcomdistro: multimedia image-prop
    Pass: 48 | Fail: 0 | Total: 48
  • qcomdistro: multimedia image
    Pass: 9 | Fail: 0 | Total: 9

QNN EP is a standalone ABI-stable plugin execution provider that
brings Qualcomm hardware acceleration to ONNX Runtime.
Starting with v2.0.0, the QNN EP ships as a standalone shared
library built on the Execution Provider ABI. The plugin is registered
at runtime and only links against the standard ONNX Runtime shared
library.

Signed-off-by: Pratik Pachange <ppachang@qti.qualcomm.com>

@anujm1 Anuj Mittal (anujm1) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even without the change, looks good to me.

@qcomlnxci

Copy link
Copy Markdown

Test Coral run workflow

Test jobs for commit 076f089

  • qcomdistro: multimedia image
    Pass: 9 | Fail: 0 | Total: 9
  • qcomdistro: multimedia image-prop
    Pass: 46 | Fail: 0 | Others: 2 | Total: 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants