-
Notifications
You must be signed in to change notification settings - Fork 537
Arm backend: Size Test for Cortex-M #9569
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
Conversation
🔗 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. ✅ No FailuresAs of commit af648de with merge base b66c319 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
364c2d6
to
e30bc7d
Compare
.github/scripts/run_nm.py
Outdated
sys.exit(1) | ||
|
||
def _get_nm_output(self) -> Dict[str, Symbol]: | ||
args = ["--print-size", "--size-sort", "--reverse-sort", "--demangle"] |
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.
you might want to specify the format. it can differ between systems.
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.
Added!
.github/scripts/run_nm.py
Outdated
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) |
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.
as written, compiling this regex doesn't help. you'd need to store it somewhere that outlives a single call to this function.
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.
fixed by moving it up out of the function. Thanks.
@@ -0,0 +1,167 @@ | |||
# Copyright (c) Meta Platforms, Inc. and affiliates. |
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.
perhaps we could use bloaty?
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.
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.
0ffc0cb
to
25c5dea
Compare
Could not find ET installation when cross-compiling.
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.
sure why not
.github/scripts/run_nm.py
Outdated
self.filter is None | ||
or self.filter not in ["all", "executorch", "executorch_text"] |
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.
nit: isn't the None check redundant?
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.
you could make this easier to maintain and extend by creating a FILTER_NAME_TO_FILTER_AND_LABEL table:
def is_executorch_symbol(s):
return "executorch" in s.name or s.name.startswith("et")
FILTER_NAME_TO_FILTER_AND_LABEL = {
"all": (None, "All"),
"executorch": (is_executorch_symbol, "ExecuTorch"),
"executorch_text": (lambda s: is_executorch_symbol(s) and s.symbol_type.lower() == "t", "ExecuTorch .text")
}
then access it as
filter, label = FILTER_NAME_TO_FILTER_AND_LABEL.get(self.filter, FILTER_NAME_TO_FILTER_AND_LABEL["all"])
print_table(filter, label)
and use FILTER_NAME_TO_FILTER_AND_LABEL.keys() in the argument definition below
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.
done
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.
required=False, | ||
default="all", | ||
help="Filter symbols by pre-defined filters", | ||
choices=["all", "executorch", "executorch_text"], |
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.
this should be FILTER_NAME_TO_FILTER_AND_LABEL.keys() (wrapped in list() if we must)
### Summary Add size test for cortex-M and add it in the CI
Summary
Add size test for cortex-M and add it in the CI