Skip to content

Commit 5a3f31c

Browse files
committed
Merge remote-tracking branch 'origin/main' into android-build-within-gradle
2 parents ab99d19 + f5a8ff5 commit 5a3f31c

File tree

1,660 files changed

+87525
-28844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,660 files changed

+87525
-28844
lines changed
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a3942627f5ac048e06b4b1d703b0a6a53bf6da5b
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
59d5cf083b4f860dea76fe8936076177f9367f10
1+
7cda4017ddda554752e89069ae205be5e8388f59

.ci/docker/common/install_conda.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1313
install_miniconda() {
1414
BASE_URL="https://repo.anaconda.com/miniconda"
1515
CONDA_FILE="Miniconda3-py${PYTHON_VERSION//./}_${MINICONDA_VERSION}-Linux-x86_64.sh"
16-
if [[ $(uname -m) == "aarch64" ]]; then
16+
if [[ $(uname -m) == "aarch64" ]]; then
1717
CONDA_FILE="Miniconda3-py${PYTHON_VERSION//./}_${MINICONDA_VERSION}-Linux-aarch64.sh"
1818
fi
1919

@@ -71,4 +71,8 @@ fix_conda_ubuntu_libstdcxx() {
7171
install_miniconda
7272
install_python
7373
install_pip_dependencies
74-
fix_conda_ubuntu_libstdcxx
74+
# Hack breaks the job on aarch64 but is still necessary everywhere
75+
# else.
76+
if [ "$(uname -m)" != "aarch64" ]; then
77+
fix_conda_ubuntu_libstdcxx
78+
fi

.ci/docker/conda-env-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake=3.26.4
1+
cmake=3.31.2
22
ninja=1.10.2
33
libuv
44
llvm-openmp

.ci/docker/requirements-ci.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ matplotlib>=3.9.4
2828
myst-parser==0.18.1
2929
sphinx_design==0.4.1
3030
sphinx-copybutton==0.5.0
31+
32+
# script unit test requirements
33+
yaspin==3.1.0
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Executorch Benchmark Tooling
2+
3+
A library providing tools for fetching, processing, and analyzing ExecutorchBenchmark data from the HUD Open API. This tooling helps compare performance metrics between private and public devices with identical settings.
4+
5+
## Table of Contents
6+
7+
- [Overview](#overview)
8+
- [Installation](#installation)
9+
- [Tools](#tools)
10+
- [get_benchmark_analysis_data.py](#get_benchmark_analysis_datapy)
11+
- [Quick Start](#quick-start)
12+
- [Command Line Options](#command-line-options)
13+
- [Example Usage](#example-usage)
14+
- [Working with Output Files](#working-with-output-files-csv-and-excel)
15+
- [Python API Usage](#python-api-usage)
16+
- [Running Unit Tests](#running-unit-tests)
17+
18+
## Overview
19+
20+
The Executorch Benchmark Tooling provides a suite of utilities designed to:
21+
22+
- Fetch benchmark data from HUD Open API for specified time ranges
23+
- Clean and process data by filtering out failures
24+
- Compare metrics between private and public devices with matching configurations
25+
- Generate analysis reports in various formats (CSV, Excel, JSON)
26+
- Support filtering by device pools, backends, and models
27+
28+
This tooling is particularly useful for performance analysis, regression testing, and cross-device comparisons.
29+
30+
## Installation
31+
32+
Install dependencies:
33+
34+
```bash
35+
pip install -r requirements.txt
36+
```
37+
38+
## Tools
39+
40+
### get_benchmark_analysis_data.py
41+
42+
This script is mainly used to generate analysis data comparing private devices with public devices using the same settings.
43+
44+
It fetches benchmark data from HUD Open API for a specified time range, cleans the data by removing entries with FAILURE indicators, and retrieves all private device metrics along with equivalent public device metrics based on matching [model, backend, device_pool_names, arch] configurations. Users can filter the data by specifying private device_pool_names, backends, and models.
45+
46+
#### Quick Start
47+
48+
```bash
49+
# generate excel sheets for all private devices with public devices using the same settings
50+
python3 .ci/scripts/benchmark_tooling/get_benchmark_analysis_data.py \
51+
--startTime "2025-06-11T00:00:00" \
52+
--endTime "2025-06-17T18:00:00" \
53+
--outputType "excel"
54+
55+
# generate the benchmark stability analysis
56+
python3 .ci/scripts/benchmark_tooling/analyze_benchmark_stability.py \
57+
--primary-file private.xlsx \
58+
--reference-file public.xlsx
59+
```
60+
61+
#### Command Line Options
62+
63+
##### Basic Options:
64+
- `--startTime`: Start time in ISO format (e.g., "2025-06-11T00:00:00") (required)
65+
- `--endTime`: End time in ISO format (e.g., "2025-06-17T18:00:00") (required)
66+
- `--env`: Choose environment ("local" or "prod", default: "prod")
67+
- `--no-silent`: Show processing logs (default: only show results & minimum logging)
68+
69+
##### Output Options:
70+
- `--outputType`: Choose output format (default: "print")
71+
- `print`: Display results in console
72+
- `json`: Generate JSON file
73+
- `df`: Display results in DataFrame format: `{'private': List[{'groupInfo':Dict,'df': DF},...],'public':List[{'groupInfo':Dict,'df': DF}]`
74+
- `excel`: Generate Excel files with multiple sheets, the field in first row and first column contains the JSON string of the raw metadata
75+
- `csv`: Generate CSV files in separate folders, the field in first row and first column contains the JSON string of the raw metadata
76+
- `--outputDir`: Directory to save output files (default: current directory)
77+
78+
##### Filtering Options:
79+
80+
- `--device-pools`: Filter by device pool names (e.g., "apple_iphone_15_private", "samsung_s22_private")
81+
- `--backends`: Filter by specific backend names (e.g.,"xnnpack_q8")
82+
- `--models`: Filter by specific model names (e.g., "mv3", "meta-llama/Llama-3.2-1B-Instruct-SpinQuant_INT4_EO8")
83+
84+
#### Example Usage
85+
86+
Filter by multiple private device pools and models:
87+
```bash
88+
# This fetches all private table data for models 'llama-3.2-1B' and 'mv3'
89+
python3 .ci/scripts/benchmark_tooling/get_benchmark_analysis_data.py \
90+
--startTime "2025-06-01T00:00:00" \
91+
--endTime "2025-06-11T00:00:00" \
92+
--device-pools 'apple_iphone_15_private' 'samsung_s22_private' \
93+
--models 'meta-llama/Llama-3.2-1B-Instruct-SpinQuant_INT4_EO8' 'mv3'
94+
```
95+
96+
Filter by specific device pool and models:
97+
```bash
98+
# This fetches all private iPhone table data for models 'llama-3.2-1B' and 'mv3',
99+
# and associated public iPhone data
100+
python3 .ci/scripts/benchmark_tooling/get_benchmark_analysis_data.py \
101+
--startTime "2025-06-01T00:00:00" \
102+
--endTime "2025-06-11T00:00:00" \
103+
--device-pools 'apple_iphone_15_private' \
104+
--models 'meta-llama/Llama-3.2-1B-Instruct-SpinQuant_INT4_EO8' 'mv3'
105+
```
106+
107+
#### Working with Output Files CSV and Excel
108+
109+
You can use methods in `common.py` to convert the file data back to DataFrame format. These methods read the first row in CSV/Excel files and return results with the format `list of {"groupInfo":DICT, "df":df.Dataframe{}}`.
110+
111+
```python
112+
import logging
113+
logging.basicConfig(level=logging.INFO)
114+
from .ci.scripts.benchmark_tooling.common import read_all_csv_with_metadata, read_excel_with_json_header
115+
116+
# For CSV files (assuming the 'private' folder is in the current directory)
117+
folder_path = './private'
118+
res = read_all_csv_with_metadata(folder_path)
119+
logging.info(res)
120+
121+
# For Excel files (assuming the Excel file is in the current directory)
122+
file_path = "./private.xlsx"
123+
res = read_excel_with_json_header(file_path)
124+
logging.info(res)
125+
```
126+
127+
#### Python API Usage
128+
129+
To use the benchmark fetcher in your own scripts:
130+
131+
```python
132+
from .ci.scripts.benchmark_tooling.get_benchmark_analysis_data import ExecutorchBenchmarkFetcher
133+
134+
# Initialize the fetcher
135+
fetcher = ExecutorchBenchmarkFetcher(env="prod", disable_logging=False)
136+
137+
# Fetch data for a specific time range
138+
fetcher.run(
139+
start_time="2025-06-11T00:00:00",
140+
end_time="2025-06-17T18:00:00"
141+
)
142+
143+
# Use the output_data method for flexible output
144+
results = fetcher.output_data(output_type="excel", output_dir="./results")
145+
```
146+
147+
## Running Unit Tests
148+
149+
The benchmark tooling includes unit tests to ensure functionality.
150+
151+
### Using pytest for unit tests
152+
153+
```bash
154+
# From the executorch root directory
155+
pytest -c /dev/null .ci/scripts/tests/test_get_benchmark_analysis_data.py
156+
```

0 commit comments

Comments
 (0)