Skip to content

Commit 4b41c2b

Browse files
authored
Regression Micro Benchmark and Torchao (#7478)
add regression config
1 parent 4709168 commit 4b41c2b

File tree

2 files changed

+79
-3
lines changed

2 files changed

+79
-3
lines changed

aws/lambda/benchmark_regression_summary_report/common/config.py

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,70 @@
6363
),
6464
)
6565

66+
67+
TORCHAO_MICRO_API_CONFIG = BenchmarkConfig(
68+
name="Torchao Micro Api Regression",
69+
id="torchao_micro_api_benchmark",
70+
source=BenchmarkApiSource(
71+
api_query_url="https://hud.pytorch.org/api/benchmark/get_time_series",
72+
type="benchmark_time_series_api",
73+
api_endpoint_params_template="""
74+
{
75+
"name": "torchao_micro_api_benchmark",
76+
"query_params": {
77+
"mode": "",
78+
"branches": ["main"],
79+
"repo": "pytorch/ao",
80+
"device": "",
81+
"benchmarkName": "micro-benchmark api",
82+
"startTime": "{{ startTime }}",
83+
"stopTime": "{{ stopTime }}"
84+
},
85+
"response_formats":["time_series"]
86+
}
87+
""",
88+
),
89+
hud_info={
90+
"url": "https://hud.pytorch.org/benchmark/v3/dashboard/torchao_micro_api_benchmark",
91+
},
92+
# set baseline from past 4-8 days, and compare with the lastest 4 day
93+
policy=Policy(
94+
frequency=Frequency(value=1, unit="days"),
95+
range=RangeConfig(
96+
baseline=DayRangeWindow(value=4),
97+
comparison=DayRangeWindow(value=4),
98+
),
99+
metrics={
100+
"bfloat16 fwd time (ms)": RegressionPolicy(
101+
name="bfloat16 fwd time (ms)",
102+
condition="less_equal",
103+
threshold=1.20,
104+
baseline_aggregation="min",
105+
),
106+
"quantized fwd time (ms)": RegressionPolicy(
107+
name="quantized fwd time (ms)",
108+
condition="less_equal",
109+
threshold=1.20,
110+
baseline_aggregation="min",
111+
),
112+
"fwd speedup (x)": RegressionPolicy(
113+
name="fwd speedup (x)",
114+
condition="greater_equal",
115+
threshold=0.9,
116+
baseline_aggregation="median",
117+
),
118+
},
119+
notification_config={
120+
"type": "github",
121+
"repo": "pytorch/test-infra",
122+
"issue": "7477",
123+
},
124+
),
125+
report_config=ReportConfig(
126+
report_level="clear",
127+
),
128+
)
129+
66130
PYTORCH_OPERATOR_MICROBENCH_CONFIG = BenchmarkConfig(
67131
name="Pytorch Operator Microbench Regression",
68132
id="pytorch_operator_microbenchmark",
@@ -98,8 +162,8 @@
98162
metrics={
99163
"latency": RegressionPolicy(
100164
name="latency",
101-
condition="greater_equal",
102-
threshold=0.85,
165+
condition="less_equal",
166+
threshold=1.20,
103167
baseline_aggregation="median",
104168
),
105169
},
@@ -110,7 +174,7 @@
110174
},
111175
),
112176
report_config=ReportConfig(
113-
report_level="insufficient_data",
177+
report_level="regression",
114178
),
115179
)
116180

@@ -199,6 +263,7 @@
199263
"compiler_regression": COMPILER_BENCHMARK_CONFIG,
200264
"pytorch_operator_microbenchmark": PYTORCH_OPERATOR_MICROBENCH_CONFIG,
201265
"pytorch_helion": PYTORCH_HELION_CONFIG,
266+
"torchao_micro_api_benchmark": TORCHAO_MICRO_API_CONFIG,
202267
}
203268
)
204269

aws/lambda/benchmark_regression_summary_report/lambda_function.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,12 @@ def main(
372372
minute=0, second=0, microsecond=0
373373
)
374374
end_time_ts = int(end_time.timestamp())
375+
376+
# override end_time if args is provided
377+
if args and args.end_time:
378+
end_time = isoparse(args.end_time)
379+
end_time = truncate_to_hour(end_time)
380+
end_time_ts = int(end_time.timestamp())
375381
logger.info(
376382
"[Main] current time with hour granularity(utc) %s with unix timestamp %s",
377383
end_time,
@@ -462,6 +468,11 @@ def parse_args() -> argparse.Namespace:
462468
default=ENVS["GITHUB_TOKEN"],
463469
help="the github access token to access github api",
464470
)
471+
parser.add_argument(
472+
"--end-time",
473+
type=str,
474+
help="the end time to run, in format of YYYY-MM-DD HH:MM:SS",
475+
)
465476
parser.set_defaults(dry_run=True) # default is True
466477
args, _ = parser.parse_known_args()
467478
return args

0 commit comments

Comments
 (0)