Skip to content
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

Arm backend: Size Test for Cortex-M #9569

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Arm backend: Size Test for Cortex-M #9569

wants to merge 6 commits into from

Conversation

digantdesai
Copy link
Contributor

Summary

Add size test for cortex-M and add it in the CI

Copy link

pytorch-bot bot commented Mar 25, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/9569

Note: Links to docs will display an error until the docs builds have been completed.

❌ 5 New Failures

As of commit 04c29f9 with merge base f174d55 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 25, 2025
@digantdesai digantdesai added ciflow/trunk topic: not user facing and removed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Mar 25, 2025
@digantdesai digantdesai marked this pull request as draft March 25, 2025 06:56
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 25, 2025
@zingo zingo changed the title Size Test for Cortex-M Arm backend: Size Test for Cortex-M Mar 25, 2025
@zingo zingo added the module: arm Issues related to arm backend label Mar 25, 2025
sys.exit(1)

def _get_nm_output(self) -> Dict[str, Symbol]:
args = ["--print-size", "--size-sort", "--reverse-sort", "--demangle"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might want to specify the format. it can differ between systems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

Comment on lines 62 to 64
symbol_pattern = re.compile(
r"(?P<addr>[0-9a-fA-F]+)\s+(?P<size>[0-9a-fA-F]+)\s+(?P<type>\w)\s+(?P<name>.+)"
)
match = symbol_pattern.match(line)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as written, compiling this regex doesn't help. you'd need to store it somewhere that outlives a single call to this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed by moving it up out of the function. Thanks.

@@ -0,0 +1,167 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we could use bloaty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I did think about it. This is just nm TBH so not sure if we need it to be more complicated than that. Wrote a python wrapper to print sorted table, and use cross-tools. But bloaty is nice though a bit "bloated" with dependency etc.

@digantdesai digantdesai force-pushed the size_test_m branch 5 times, most recently from 74b8c59 to e3d5815 Compare March 27, 2025 23:10
Could not find ET installation when cross-compiling.
It should be more in line with Arm Core Platform and TFLite Micro builds.
Prints useful tables about binary size.

TODO: expand it to parse linker map and also dump module, objects, and
section names with a given symbol.
Just getting started. We will build on top of this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants