zephyr-cp: add ulab support, opt-in per board - #21
Closed
mikeysklar wants to merge 3 commits into
Closed
Conversation
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.
Owner
Author
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.
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.