Skip to content

[Refactor] Move the qnn/ context library into the nntrainer submodule #32

Description

@dlwlzzero

Background / Problem

The QNN backend's context library (libqnn_context.so) currently lives in Quick.AI's qnn/ directory. The QNN backend is fundamentally a generic component built on nntrainer's QNNContext
(per README), so for reuse and separation of responsibility it belongs in the nntrainer submodule. The QNN model implementations under src/models/qnn/ (e.g. gemma4_e2b_qnn) are
Quick.AI-specific and must stay.

▎ A detailed Korean task doc already exists at docs/tasks/02-move-qnn-context-to-nntrainer.md; this issue is its tracking summary.

Goal

  • Move qnn/ (context lib + QNN SDK wrapper sources + jni build wiring) into nntrainer.
  • Quick.AI consumes nntrainer's built qnn_context as a dependency.
  • src/models/qnn keeps working; --enable-qnn flow unchanged.

Current state (evidence)

  • qnn/meson.build builds libqnn_context.so from qnn_sdk_sources + qnn_context_sources (qnn_context.cpp, jni/qnn_rpc_manager.cpp); depends only on nntrainer_dep, log_dep; exports
    qnn_context_dep.
  • Root wiring: meson.build:168 (subdir('qnn')), meson.build:29-32, meson.build:141.
  • src/models/qnn/meson.build adds model sources to quick_dot_ai_src and consumes symbols from qnn_context.
  • Dependency note: qnn/ depends only on nntrainer_dep/log_dep → no circular dependency after the move.

Proposed scope

nntrainer side: place QNN context under a path consistent with existing QNNContext; port sources/headers/SDK wrappers; add meson target; export a public qnn_context-equivalent dep; port
Android.mk if used.
Quick.AI side: remove subdir('qnn') (meson.build:168); consume nntrainer's dep when --enable-qnn; fix src/models/qnn include paths; delete qnn/; clean build.sh --target=qnn/--enable-qnn
references; update README.md, qnn/README.md, docs/Architecture.md.

Acceptance criteria

  • nntrainer builds qnn_context standalone.
  • ./build.sh --platform=android --enable-qnn succeeds; gemma4-e2b load/inference identical to before.
  • Non-QNN android build and x86 build unaffected.

Risks / notes

  • nntrainer is a submodule → land nntrainer change first, then bump the Quick.AI submodule pointer.
  • Many/long include dirs (~10) — watch for header-not-found.
  • Overlaps with the QNN-crash investigation (docs/tasks/01-qnn-crash-investigation.md); coordinate ordering so the fix isn't lost in the move.
  • Keep the boundary: do not move src/models/qnn.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions