Skip to content

zephyr-cp: add ulab support, opt-in per board - #21

Closed
mikeysklar wants to merge 3 commits into
mainfrom
siwx917/feat-ulab-support
Closed

zephyr-cp: add ulab support, opt-in per board#21
mikeysklar wants to merge 3 commits into
mainfrom
siwx917/feat-ulab-support

Conversation

@mikeysklar

Copy link
Copy Markdown
Owner

Adds ulab, opt-in per board via CIRCUITPY_ULAB.

Measured on SiWx917-DK2605A: about 1.6 MFLOP/s on float32 matmul.

No board turns it on by default. Off, the build is unchanged.

The port did not build ulab at all - build_circuitpython.py never
referenced it, so CIRCUITPY_ULAB was always 0 regardless of the usual
CIRCUITPY_FULL_BUILD default.

Add it as a per-board opt-in via CIRCUITPY_ULAB in circuitpython.toml.
Sources and flags mirror py/py.mk (MODULE_ULAB_ENABLED,
ULAB_HAS_USER_MODULE=0, -iquote on extmod/ulab/code). It is off by
default because it costs roughly 95 KB of flash.

Verified on a SiWx917-DK2605A: numpy imports and runs.
build_circuitpython() hit complexity 41 (limit 40) from the ulab opt-in
added by this branch:

  C901 `build_circuitpython` is too complex (41 > 40)

Extracted the ulab flag/source-file logic into its own function,
behavior-preserving (same conditions, same order of operations relative
to circuitpython_flags/source_files). Verified: ruff check and ruff
format both pass, pre-commit clean.
Same fix as pushed to #20/#23/#24: check_suite["workflowRun"] is null
for check suites with no attached workflow run, and the "scheduler"
job dereferenced it unconditionally. That's what was failing this PR's
scheduler job too.
@mikeysklar mikeysklar added the port:siwx917 SiWx917 CircuitPython port label Aug 4, 2026
@mikeysklar

Copy link
Copy Markdown
Owner Author

Closing as merged. df644fe is verbatim in siwx917/integration and the C901 extraction is present; the only remaining difference in build_circuitpython.py is a docstring reword applied later by 6f6afbc. Verified read-only; nothing outstanding from this branch.

@mikeysklar mikeysklar closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

port:siwx917 SiWx917 CircuitPython port

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant