fix(camera): blur CLI/self-verify calls undefined edge_detect -> NameError on NPU#2
Open
Vyacheslav-Tomashevskiy wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
camera/blur_pipeline.pydefines its NPU design asblur(def blur(...), and bothcamera/npu_camera_daemon.pyandcamera/test_blur.pydofrom blur_pipeline import blur). But the module's own runtime paths were still callingedge_detect— a leftover name from AMD'sedge_detectIRON example this file was adapted from.edge_detectis never defined or imported anywhere inblur_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.pyimportsaie.ironat the top, so on a host without the NPU toolchain the module fails at that import first — which is exactly the boundaryci.yml's import loop expects, so CI is green. On a real NPU box the import succeeds,python camera/blur_pipeline.pyreachesmain(), and it dies with: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_detecttoblur(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 (noaie/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 camerastays clean.Verified bug — claimed under the RustChain verified-bug channel (rustchain-bounties#71).
RTC:
RTCd1554f0f35576faf01d386a6be1c947f560dd0b7