-
Notifications
You must be signed in to change notification settings - Fork 1k
Add cmsis_nn pip package to executorch installation #18940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Copyright 2026 Arm Limited and/or its affiliates. | ||
| # All rights reserved. | ||
| # | ||
| # This source code is licensed under the BSD-style license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| import importlib | ||
|
|
||
| import pytest | ||
|
|
||
|
|
||
| def _import_cmsis_nn(): | ||
| try: | ||
| return importlib.import_module("cmsis_nn") | ||
| except Exception as exc: | ||
| pytest.fail(f"Failed to resolve cmsis_nn: {exc}") | ||
|
|
||
|
|
||
| def test_cmsis_nn_convolve_wrapper_buffer_size() -> None: | ||
| cmsis_nn = _import_cmsis_nn() | ||
|
|
||
| buf_size = cmsis_nn.convolve_wrapper_buffer_size( | ||
| cmsis_nn.Backend.MVE, | ||
| cmsis_nn.DataType.A8W8, | ||
| input_nhwc=[1, 8, 8, 16], | ||
| filter_nhwc=[8, 3, 3, 16], | ||
| output_nhwc=[1, 6, 6, 8], | ||
| padding_hw=[0, 0], | ||
| stride_hw=[1, 1], | ||
| dilation_hw=[1, 1], | ||
| ) | ||
|
|
||
| assert buf_size == 576 |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than a project wide dependency, I think we should move this to a cortex-m specific requirements file, similar to how we have
backends/arm/requirements-arm-ethos-u.txt. We'll probably need to update the cortex-m documentation to reference this extra step.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue here is that this will be required for AOT, so requiring something like that will either break the Cortex-M backend for pip installation completely, or at least disable the buffer planning functionality. My other proposal is to add it as an optional dependency: pip install executorch[cortex_m]. Or, thirdly, built it into the executorch wheel. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rascani we have the same thing going on for the TOSA arm-backends now when all tools needed to AOT is pip installable (is about a week ago) and we have an old wish from @digantdesai (and also from us/Arm) to make it more part of the executorch pip install process and easier to use. So whatever we decide/do here we will probably do the same for Ethos-U/VGF backends soonish. (before 1.3 ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a slight difference in that tosa-tools is available from pypi while cmsis_nn needs building. But my original point still stands imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I lean towards the optional dependency approach (
pip install executorch[cortex_m]).Additionally, we should ensure we keep the SHA in sync with the SHA in CMakeLists.txt that is used for fetching the source.
I think it would also be a good idea to publish a pip package for this.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@digantdesai would this be a good solution for Arm (and other) backends also.
e.g.
pip install executorch[cortex_m]
pip install executorch[ethos_u]
pip install executorch[vgf]
pip install executorch[nxp]
pip install executorch[qcom]
...
We will probably think about our names a bit, maybe we end up with a common for ethos_u & vgf like tosa_backend or arm_backends there are a lot of common deps but I also think the devs in most cases not overlapping and 2 packages with clear names might be easier to understand, lets see. Any preferences are welcome as a discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I will push an updated PR proposing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this here #19149 which the cmsis_nn dependency can then build on. Closing this PR.