Skip to content

fix(qualcomm): harden compile_npu.py with CLI options and container format pre-flight checks (Fixes #121) - #314

Open
jhaabhijeet864 wants to merge 1 commit into
google-ai-edge:mainfrom
jhaabhijeet864:fix/issue-121-qualcomm-npu-compiler
Open

jhaabhijeet864 wants to merge 1 commit into
google-ai-edge:mainfrom
jhaabhijeet864:fix/issue-121-qualcomm-npu-compiler

Conversation

@jhaabhijeet864

Copy link
Copy Markdown

Summary

Resolves #121 by replacing hardcoded machine paths in compile_npu.py with standard CLI arguments, environment variable detection, and adding container format pre-flight inspection.

Key Changes

  1. CLI & Environment Hardening:
    • Replaced hardcoded author paths with dynamic argparse flags (--model_path, --output_dir, --soc_model, --qairt_root) and fallback to $QAIRT_ROOT.
    • Added support for multiple Snapdragon SoC targets (SM8750 / Snapdragon 8 Elite, SM8650 / 8 Gen 3, SM8550 / 8 Gen 2, etc.).
  2. Container Format Pre-Flight Diagnostics:
    • Added magic-byte inspection (check_model_magic_bytes): informs users when a .litertlm container (RTLM) is passed into aot_compile (which requires flat .tflite TFL3 graphs) with actionable guidance, preventing low-level C++ FlatBuffer crashes.
  3. Documentation Cleanup:
    • Cleaned up NPU_COMPILATION_GUIDE.md across llm_chatbot_npu and gemma3/npu to document the new CLI parameters.

Verification

  • Tested compile_npu.py --help CLI parameter parsing.
  • Tested magic-byte pre-flight checks against dummy RTLM and TFL3 models.

Fixes #121

This branch has not been deployed

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

Labels

None yet

1 participant