Skip to content

Refactor Memory Allocator from Arm Executor Runner #12353

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

Merged
merged 3 commits into from
Jul 14, 2025

Conversation

BujSet
Copy link
Contributor

@BujSet BujSet commented Jul 10, 2025

Summary

Some applications desire using more minimal memory allocators when leveraging the existing the exist arm_executor_runner.cpp, e.g. here. This change decouples a custom memory allocator wrapper from the executor runner so that apps can choose different implementations as needed.

Test plan

Ran the steps of the Arm EthosU tutorial to ensure that existing flow still works. I.e. running:

./examples/arm/setup.sh --i-agree-to-the-contained-eula
source ...
./examples/arm/run.sh --model_name=add --no_quantize --target=ethos-u55-128

still produces the following output:

I [executorch:arm_executor_runner.cpp:762 main()] Model executed successfully.
I [executorch:arm_executor_runner.cpp:768 main()] model_pte_program_size:     2064 bytes.
I [executorch:arm_executor_runner.cpp:769 main()] model_pte_loaded_size:      2064 bytes.
I [executorch:arm_executor_runner.cpp:783 main()] method_allocator_used:     320 / 62914560  free: 62914240 ( used: 0 % )
I [executorch:arm_executor_runner.cpp:790 main()] method_allocator_planned:  64 bytes
I [executorch:arm_executor_runner.cpp:794 main()] method_allocator_loaded:   232 bytes
I [executorch:arm_executor_runner.cpp:798 main()] method_allocator_input:    24 bytes
I [executorch:arm_executor_runner.cpp:799 main()] method_allocator_executor: 0 bytes
I [executorch:arm_executor_runner.cpp:802 main()] peak_temp_allocator:       64 / 2097152 free: 2097152 ( used: 0 % ) 
I [executorch:arm_executor_runner.cpp:812 main()] 1 outputs:
Output[0][0]: (int) 2
Output[0][1]: (int) 2
Output[0][2]: (int) 2
Output[0][3]: (int) 2
Output[0][4]: (int) 2
I [executorch:arm_executor_runner.cpp:952 main()] Program complete, exiting.
I [executorch:arm_executor_runner.cpp:956 main()] ♦
Info: /OSCI/SystemC: Simulation stopped by user.
[warning ][main@0][3440 ns] Simulation stopped by user
[backends/arm/scripts/run_fvp.sh] Simulation complete, 0
Checking for problems in log:
No problems found!
+ set +x

Copy link

pytorch-bot bot commented Jul 10, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 4 Unrelated Failures

As of commit 579f693 with merge base f909aaa (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@BujSet BujSet self-assigned this Jul 10, 2025
@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 Jul 10, 2025
@BujSet BujSet added the module: arm Issues related to arm backend label Jul 10, 2025
@BujSet
Copy link
Contributor Author

BujSet commented Jul 10, 2025

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot bot added the release notes: none Do not include this in the release notes label Jul 10, 2025
@BujSet BujSet force-pushed the arm_executor_runner_split_allocator branch 2 times, most recently from c6bf143 to ff8b2b5 Compare July 10, 2025 21:08
@zingo
Copy link
Collaborator

zingo commented Jul 11, 2025

Nice work, good idea to split it out so it can be usefull for more runners. We will probably have a few runner examples going forward. For examples for different OS/targets and I think we could do a better splitup between testing / semihosting and a "minimal" good example, as it's now much of the #ifdef stuff gets in the way if a good readable example.

@BujSet BujSet force-pushed the arm_executor_runner_split_allocator branch from ff8b2b5 to 579f693 Compare July 11, 2025 14:43
@BujSet BujSet marked this pull request as ready for review July 11, 2025 14:44
@BujSet BujSet merged commit 8f3eb3e into pytorch:main Jul 14, 2025
166 of 176 checks passed
@BujSet BujSet deleted the arm_executor_runner_split_allocator branch July 17, 2025 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 release notes: none Do not include this in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants