qnn-debug
Skill by alibaba
Guides debugging, fixing and operator adaptation for the MNN backend on Qualcomm HTP (NPU) through QNN. It covers runtime error codes, accuracy problems, performance issues and adding new QNN operators. Aimed at developers working with MNN's QNN backend.
Install qnn-debug
Built from the published package, never by AI.
git clone --depth 1 https://github.com/alibaba/MNN /tmp/MNN && mkdir -p ~/.claude/skills && cp -r /tmp/MNN/skills/qnn-debug ~/.claude/skills/qnn-debugRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/alibaba/MNN /tmp/MNN && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/MNN/skills/qnn-debug ~/.gemini/antigravity-cli/skills/qnn-debugAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill is a debugging guide for the MNN QNN backend, which runs models on Qualcomm HTP (NPU) hardware. It covers runtime errors such as 1002, 6000, 1003 and 6004, model conversion and operator validation failures, wrong inference results, accuracy shortfalls and performance problems. It also explains how to add or adapt QNN operators.
The core method is to export all QNN intermediate tensors with MNN2QNNModel and the --dump_intermediate_outputs flag, then compare them tensor by tensor against a CPU fp32 baseline to find the first faulty operator. The skill also helps separate real bugs from quantization and HTP fp16 precision effects. It is written for developers who work on MNN's QNN backend or deploy models to Qualcomm NPUs.
Written from the project's SKILL.md and checked against it.
What it can do
- Runtime error diagnosisExplains QNN runtime errors 1002, 6000, 1003 and 6004 and how to triage them.
- Intermediate tensor dumpUses MNN2QNNModel with --dump_intermediate_outputs to export all QNN intermediate tensors in one run.
- Tensor-by-tensor comparisonCompares QNN outputs with a CPU fp32 baseline to locate the first faulty operator.
- Error pattern readingReads common error patterns such as constant channels or NaN values and checks them numerically.
- Bug versus precision triageSeparates real backend bugs from quantization and HTP fp16 precision effects.
- New operator adaptationChecks SDK operator documents such as MasterOpDef and HtpOpDefSupplement before implementing an operator.
- Performance profilingDescribes using a QNN profile to find excess quant/dequant steps, data copies and CPU fallback.
- QNN error loggingShows how to enable the QNN log callback when graphFinalize or graphExecute fails.
What you need
- adb and a connected Android device
- libMNN.so built with MNN_QNN=ON using the Android NDK for arm64
- Python with onnx, onnxruntime and numpy
- Qualcomm QNN SDK (QAIRT)
Try asking
- Why does my QNN model return different results from the CPU backend?
- Help me debug QNN error 6000 during graphExecute on Android
- Walk me through adding a new operator to the MNN QNN backend
Good to know
- Reference notes assume a connected Android device and a QNN-enabled build of libMNN.so.
- The older truncate-and-bisect method is kept only as a fallback.
- Online and offline LLM paths use different steps, so the path must be identified first.
- Fixed-shape models may need shapeMutable=false to avoid a known input issue.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/qnn-debug/SKILL.md, skills/qnn-debug/scripts/cmp_probe.sh, skills/qnn-debug/scripts/qnn_probe.sh. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md25 KB -
reference.md29 KB -
scripts/cmp_probe.sh2 KB -
scripts/qnn_probe.sh3 KB
Alternatives to qnn-debug
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
qnn-debug: common questions
Which QNN error codes does this skill cover?
It covers runtime errors 1002, 6000, 1003 and 6004, plus validateOpConfig failures during model conversion.
How does it find the operator that causes a wrong result?
It dumps all QNN intermediate tensors in one run and compares each one with a CPU fp32 baseline to find the first faulty operator.
Does it help with adding new QNN operators?
Yes. It says to check SDK operator documents such as MasterOpDef and HtpOpDefSupplement before implementing the operator.
How do I install qnn-debug?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is qnn-debug free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is qnn-debug safe to use?
It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to qnn-debug?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
