Add Android benchmark script#18802
Merged
GregoryComer merged 1 commit intopytorch:mainfrom Apr 10, 2026
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18802
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 1 Cancelled Job, 2 PendingAs of commit bee8ebd with merge base 6a516a7 ( CANCELLED JOB - The following job was cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
2acee20 to
d5d6a8c
Compare
Contributor
|
@GregoryComer has imported this pull request. If you are a Meta employee, you can view this in D100248223. |
Gasoonjia
approved these changes
Apr 10, 2026
Contributor
|
LGTM thanks for adding the script |
d5d6a8c to
0c1a845
Compare
0c1a845 to
bee8ebd
Compare
digantdesai
reviewed
Apr 10, 2026
| if [[ "$ETDUMP" == true ]]; then | ||
| echo "ETDump: $ETDUMP_LOCAL" | ||
| fi | ||
| echo "=========================================" |
Contributor
There was a problem hiding this comment.
I would add some kind of validation beyond $? == 0, it can also be user provided function but it would be good to have. Even dumping LOGCAT_OUTPUT in a text file is half way there.
jpiat
pushed a commit
to jpiat/executorch
that referenced
this pull request
Apr 14, 2026
### Summary Add a new script to easily benchmark models on Android. It handles building the runner, pushing the runner and model to the device via adb, running the benchmark, cleaning up, and then summarizing the results. Usage: ``` # ./devtools/scripts/benchmark_android.sh <model.pte> [options] # # Options: # --warmup <N> Number of warmup executions (default: 1) # --iterations <N> Number of timed executions (default: 10) # --num-threads <N> CPU threads for inference (default: -1, auto-detect) # --method <name> Method to run (default: first method in the program) # --backends <list> Comma-separated backends (default: xnnpack) # Supported: xnnpack, vulkan, qnn # --device <serial> ADB device serial (for multiple devices) # --etdump Enable event tracer and pull etdump back to host # --no-cleanup Leave model file on device after benchmarking # --rebuild Force cmake reconfigure and rebuild # --build-dir <path> Reuse existing build directory (skip build step) ``` Example output: ``` executor_runner already built, skipping build. Use --rebuild to force. Pushing files to device... cmake-out-android-benchmark/executor_runner: 0 files pushed, 1 skipped. /Users/gjcomer/models/yolo11n_xnnpack.pte: 1 file pushed, 0 skipped. 37.3 MB/s (10696000 bytes in 0.273s) Running 1 warmup iteration(s)... Running 10 benchmark iteration(s)... Cleaning up model on device... ========================================= Benchmark Results ========================================= Model: yolo11n_xnnpack.pte Warmup: 1 iteration(s) Load: 39.258 ms Benchmark: 10 iteration(s) in 952.097 ms Average: 95.209 ms/iteration Min: 87.583 ms Max: 142.932 ms ========================================= ``` I also made a few small changes to examples/portable/executor_runner: * Allow specifying the method name * Log load time * Log per-iteration time * Add an option to enable/disable tensor output printing cc @Gasoonjia
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.
Summary
Add a new script to easily benchmark models on Android. It handles building the runner, pushing the runner and model to the device via adb, running the benchmark, cleaning up, and then summarizing the results.
Usage:
Example output:
I also made a few small changes to examples/portable/executor_runner:
cc @Gasoonjia