Skip to content

fix(camera): blur CLI/self-verify calls undefined edge_detect -> NameError on NPU#2

Open
Vyacheslav-Tomashevskiy wants to merge 1 commit into
Scottcjn:mainfrom
Vyacheslav-Tomashevskiy:fix/blur-cli-edge-detect-nameerror
Open

fix(camera): blur CLI/self-verify calls undefined edge_detect -> NameError on NPU#2
Vyacheslav-Tomashevskiy wants to merge 1 commit into
Scottcjn:mainfrom
Vyacheslav-Tomashevskiy:fix/blur-cli-edge-detect-nameerror

Conversation

@Vyacheslav-Tomashevskiy

Copy link
Copy Markdown

Problem

camera/blur_pipeline.py defines its NPU design as blur (def blur(...), and both camera/npu_camera_daemon.py and camera/test_blur.py do from blur_pipeline import blur). But the module's own runtime paths were still calling edge_detect — a leftover name from AMD's edge_detect IRON example this file was adapted from. edge_detect is never defined or imported anywhere in blur_pipeline.py:

  • _run_and_verify()edge_detect(in_t, b_t, out_t, **_compile_kwargs(opts))
  • main()run_design_cli(edge_detect, ...)

Why CI stays green but real hardware crashes

blur_pipeline.py imports aie.iron at the top, so on a host without the NPU toolchain the module fails at that import first — which is exactly the boundary ci.yml's import loop expects, so CI is green. On a real NPU box the import succeeds, python camera/blur_pipeline.py reaches main(), and it dies with:

NameError: name 'edge_detect' is not defined

before running the blur design or its self-verify. The module's CLI/self-verify is unusable on the one platform it's meant for.

Fix

Rename the two runtime references from edge_detect to blur (the function that actually exists and that the daemon/test already import). Two-line change; no behavior change on the happy path.

Regression test

Added camera/test_blur_pipeline_cli_symbol.py — a pure-AST test (no aie/numpy, runs anywhere) asserting the design symbol the CLI hands to the NPU is one the module actually defines. Mutation-guarded: it fails on the pre-fix code (AssertionError: ... references undefined edge_detect ...) and passes after the fix. python -m compileall -q camera stays clean.


Verified bug — claimed under the RustChain verified-bug channel (rustchain-bounties#71).
RTC: RTCd1554f0f35576faf01d386a6be1c947f560dd0b7

…Error on NPU

blur_pipeline.py defines the design function , but _run_and_verify()
and main() still referenced  (a leftover from the AMD example
this was adapted from), which is never defined or imported in the module.

The module imports aie.iron at the top, so a host without the NPU toolchain
fails at that import first and CI's import-boundary check stays green. But on
a real NPU box, `python camera/blur_pipeline.py` reaches main() and crashes
with `NameError: name 'edge_detect' is not defined` instead of running the
blur design or its self-verify.

Rename the two runtime references to `blur` (the function the daemon and
test_blur.py already import). Add a pure-AST regression test (no aie/numpy
needed, runs anywhere) asserting the design symbol the CLI hands to the NPU
is one the module actually defines.
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.

1 participant