Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI (software-only)

# Every module in this kit is an application layer on top of the open-xdna
# NPU stack (IRON/mlir-aie + Peano + a real XDNA1 NPU + amdxdna driver).
# None of that toolchain or hardware exists on a normal GitHub-hosted
# runner, so this workflow does NOT and CANNOT verify:
# - any camera/*.py effect actually running on the NPU
# - camera/kernels/blur3x3.cc compiling (needs the Peano AIE2
# cross-compiler and aie_api headers)
# - any of the measured FPS/latency numbers in camera/README.md
#
# What IS hardware-independent and checked here:
# - every Python file parses (byte-compiles) cleanly
# - the host-side pip requirements (opencv, onnxruntime, numpy,
# ml_dtypes, pyvirtualcam) install cleanly on Linux/x86_64
# - each camera/*.py module imports up through all of ITS OWN
# host-side deps and fails only at `import aie.iron` (i.e. the NPU
# toolchain boundary), never earlier on a host-side bug. If a
# module fails on anything other than a missing `aie` module, that
# is a real bug this CI will catch.

on:
push:
branches: [main]
pull_request:

jobs:
syntax-and-host-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Byte-compile all Python sources (syntax only, no NPU/aie needed)
run: python -m compileall -q camera

- name: Install host-side requirements (no NPU stack involved)
run: pip install -r requirements.txt

- name: Import each camera module up to the NPU-toolchain boundary
run: |
set -e
fail=0
for f in camera/*.py; do
echo "--- $f ---"
out=$(python3 "$f" 2>&1) && { echo "ran to completion (unexpected without hardware, but not a failure)"; continue; }
if echo "$out" | grep -q "ModuleNotFoundError: No module named 'aie'"; then
echo "OK: fails only at the expected NPU-toolchain (aie) boundary"
else
echo "$out"
echo "FAIL: $f errored before reaching the aie import boundary"
fail=1
fi
done
exit $fail
7 changes: 4 additions & 3 deletions camera/test_blur.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys, time, os
import numpy as np, cv2
sys.path.insert(0, os.path.dirname(__file__) or ".")
HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, HERE)
import aie.iron as iron
from blur_pipeline import blur

Expand All @@ -24,8 +25,8 @@

sharp_var = float(img[H // 2, :, 0].astype(np.float32).var())
blur_var = float(o[H // 2, :, 0].astype(np.float32).var())
cv2.imwrite("/home/scott/npu-linux-kit/camera/blur_before.png", cv2.cvtColor(img, cv2.COLOR_RGBA2BGR))
cv2.imwrite("/home/scott/npu-linux-kit/camera/blur_after.png", cv2.cvtColor(o, cv2.COLOR_RGBA2BGR))
cv2.imwrite(os.path.join(HERE, "blur_before.png"), cv2.cvtColor(img, cv2.COLOR_RGBA2BGR))
cv2.imwrite(os.path.join(HERE, "blur_after.png"), cv2.cvtColor(o, cv2.COLOR_RGBA2BGR))
smoothed = "SMOOTHED ok" if blur_var < sharp_var * 0.8 else "NOT smoothed?"
print(f"blur @720p: {dt*1e3:.2f} ms/frame -> {1/dt:.0f} FPS")
print(f"row variance sharp={sharp_var:.0f} -> blurred={blur_var:.0f} ({smoothed})")
Loading