Skip to content

[QNN EP] Add cross-device prepare/run/compare subcommands to encryption_test.py - #883

Open
tzuhsuanwei wants to merge 1 commit into
mainfrom
feature/encryption-test-cross-device
Open

tzuhsuanwei wants to merge 1 commit into
mainfrom
feature/encryption-test-cross-device

Conversation

@tzuhsuanwei

@tzuhsuanwei tzuhsuanwei commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • encryption_test.py's one-shot mode requires prepare_app and run_app on the same machine, which cannot work for the UC2 scenario (compile on an x86_64 host with no NPU, run on a separate ARM64 device with real HTP hardware) — the two executables never coexist on one box in that setup.
  • Adds prepare, run, and compare subcommands so each phase can run independently on its own machine, with intermediate files (enc_ctx.onnx, enc_cipher.bin, answer_prepare.raw, answer_run.raw) copied between machines manually (e.g. via scp).
  • The original one-shot behavior is preserved under a new both subcommand for same-machine use — no behavior change for existing callers other than needing to add both as the first argument.
  • Only qcom/samples/ep_context_encryption/encryption_test.py is touched; no other files changed.

Test plan

  • Verified both subcommand reproduces the original round-trip result on a real V81 ARM64 device (PASS: 1000 value(s) within 0.001 (max |diff| = 0.0))
  • Verified prepare → run → compare split produces the identical PASS result when run as three separate invocations
  • python -m py_compile clean

Comment thread qcom/samples/ep_context_encryption/encryption_test.py Outdated
# <input.raw> [--xor-key 5a] [--tol 1e-3]
# [--workdir DIR] [--htp-arch ARCH]
#
# Cross-device usage (e.g. UC2: prepare on x86 host, run on a separate ARM64

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No need to provide the detail for testing there, it will be exposed to external users.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated.
Removed the internal testing terminology and explanatory text from the usage section, keeping only clean command examples.

…on_test.py

The one-shot mode requires prepare_app and run_app on the same machine,
which cannot work for the UC2 scenario (compile on an x86_64 host with no
NPU, run on a separate ARM64 device with real HTP hardware) — the two
executables never coexist on one box in that setup.

Add "prepare", "run", and "compare" subcommands so each phase can run
independently on its own machine, with intermediate files (enc_ctx.onnx,
enc_cipher.bin, answer_prepare.raw, answer_run.raw) copied between them
manually (e.g. via scp). The original one-shot behavior is preserved under
a new "both" subcommand for same-machine use.
@tzuhsuanwei
tzuhsuanwei force-pushed the feature/encryption-test-cross-device branch from 1d4fd21 to 85fbaf1 Compare September 30, 2026 09:17

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants