Skip to content

Commit 57cfb42

Browse files
authored
Add CacheBench dashboard (#6322)
Add a new benchmark dashboard for pytorch/pytorch#147546. This change is bigger than usual because I need to: * Add support to select different benchmarks from the same repo via a new `benchmarkName` parameter * Add a new mode dropdown list There are quite a handful of hardcoded benchmark-specific logic in the dashboard code now, so I think it's time to see if we can refactor them away ### Preview https://torchci-git-fork-huydhn-add-cachebench-page-fbopensource.vercel.app/benchmark/llms?repoName=pytorch%2Fpytorch&benchmarkName=TorchCache+Benchmark
1 parent ede5258 commit 57cfb42

File tree

10 files changed

+188
-29
lines changed

10 files changed

+188
-29
lines changed

clickhouse_db_schema/oss_ci_benchmark_v3_materialized_views/schema.sql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CREATE TABLE benchmark.oss_ci_benchmark_metadata (
44
`repo` String,
55
`benchmark_name` String,
66
`benchmark_dtype` String,
7+
`benchmark_mode` String,
78
`model_name` String,
89
`model_backend` String,
910
`device` String,
@@ -19,6 +20,7 @@ ORDER BY
1920
repo,
2021
benchmark_name,
2122
benchmark_dtype,
23+
benchmark_mode,
2224
model_name,
2325
model_backend,
2426
device,
@@ -34,6 +36,7 @@ SELECT
3436
repo AS repo,
3537
tupleElement(benchmark, 'name') AS benchmark_name,
3638
tupleElement(benchmark, 'dtype') AS benchmark_dtype,
39+
tupleElement(benchmark, 'mode') AS benchmark_mode,
3740
tupleElement(model, 'name') AS model_name,
3841
tupleElement(model, 'backend') AS model_backend,
3942
IF(
@@ -54,7 +57,8 @@ SELECT
5457
FROM
5558
benchmark.oss_ci_benchmark_v3
5659
WHERE
57-
timestamp >= toUnixTimestamp(toDateTime('2025-01-20 22:45:00'));
60+
timestamp >= toUnixTimestamp(toDateTime('2025-02-19 00:00:00'))
61+
AND tupleElement(benchmark, 'name') != 'sccache_stats';
5862

5963
-- Below is the SQL query to backfill the view with all data from 2024 onward
6064
INSERT INTO
@@ -63,6 +67,7 @@ SELECT
6367
repo AS repo,
6468
tupleElement(benchmark, 'name') AS benchmark_name,
6569
tupleElement(benchmark, 'dtype') AS benchmark_dtype,
70+
tupleElement(benchmark, 'mode') AS benchmark_mode,
6671
tupleElement(model, 'name') AS model_name,
6772
tupleElement(model, 'backend') AS model_backend,
6873
IF(
@@ -82,3 +87,5 @@ SELECT
8287
timestamp AS timestamp
8388
FROM
8489
benchmark.oss_ci_benchmark_v3
90+
WHERE
91+
tupleElement(benchmark, 'name') != 'sccache_stats';

torchci/clickhouse_queries/oss_ci_benchmark_llms/params.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"branches": "Array(String)",
55
"commits": "Array(String)",
66
"device": "String",
7+
"mode": "String",
78
"dtypes": "Array(String)",
89
"excludedMetrics": "Array(String)",
910
"benchmarks": "Array(String)",
@@ -20,6 +21,7 @@
2021
"branches": ["main"],
2122
"commits": ["bb4bd5f00b35eaaecb47d17caddfbd69e1f733df"],
2223
"device": "",
24+
"mode": "",
2325
"dtypes": [],
2426
"excludedMetrics": [],
2527
"benchmarks": ["PyTorch gpt-fast benchmark"],

torchci/clickhouse_queries/oss_ci_benchmark_llms/query.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ WITH benchmarks AS (
1212
o.metric.'name' AS metric,
1313
floor(arrayAvg(o.metric.'benchmark_values'), 2) AS actual,
1414
floor(toFloat64(o.metric.'target_value'), 2) AS target,
15+
o.benchmark.'mode' AS mode,
1516
o.benchmark.'dtype' AS dtype,
1617
IF(
1718
empty(o.runners),
@@ -47,6 +48,14 @@ WITH benchmarks AS (
4748
JSONExtractString(
4849
tupleElement(o.benchmark, 'extra_info')['args'],
4950
'tensor_parallel_size'
51+
),
52+
-- Used by Cachebench
53+
'is_dynamic',
54+
IF(
55+
tupleElement(o.benchmark, 'extra_info')['is_dynamic'] = '',
56+
'false',
57+
-- Default to false
58+
tupleElement(o.benchmark, 'extra_info')['is_dynamic']
5059
)
5160
) AS extra
5261
FROM
@@ -71,6 +80,10 @@ WITH benchmarks AS (
7180
has({backends: Array(String) }, o.model.'backend')
7281
OR empty({backends: Array(String) })
7382
)
83+
AND (
84+
o.benchmark.'mode' = {mode: String }
85+
OR {mode: String } = ''
86+
)
7487
AND (
7588
has({dtypes: Array(String) }, o.benchmark.'dtype')
7689
OR empty({dtypes: Array(String) })
@@ -91,6 +104,7 @@ SELECT DISTINCT
91104
metric,
92105
actual,
93106
target,
107+
mode,
94108
dtype,
95109
device,
96110
arch,
@@ -117,6 +131,7 @@ ORDER BY
117131
workflow_id DESC,
118132
backend,
119133
model,
134+
mode,
120135
dtype,
121136
device,
122137
metric

torchci/clickhouse_queries/oss_ci_benchmark_names/query.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SELECT DISTINCT
55
model_backend AS backend,
66
metric_name AS metric,
77
benchmark_dtype AS dtype,
8+
benchmark_mode AS mode,
89
device,
910
arch
1011
FROM
@@ -49,4 +50,5 @@ ORDER BY
4950
model,
5051
metric,
5152
dtype,
53+
mode,
5254
device

torchci/components/NavBar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ function NavBar() {
6060
name: "TorchAO LLMs",
6161
href: "/benchmark/llms?repoName=pytorch%2Fao",
6262
},
63+
{
64+
name: "PT CacheBench",
65+
href: "/benchmark/llms?repoName=pytorch%2Fpytorch&benchmarkName=TorchCache+Benchmark",
66+
},
6367
{
6468
name: "vLLM v1",
6569
href: "/benchmark/llms?repoName=vllm-project%2Fvllm",

torchci/components/benchmark/llms/ModelGraphPanel.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function GraphPanel({
3030
queryParams,
3131
granularity,
3232
repoName,
33+
benchmarkName,
3334
modelName,
3435
backendName,
3536
dtypeName,
@@ -41,6 +42,7 @@ export function GraphPanel({
4142
queryParams: { [key: string]: any };
4243
granularity: Granularity;
4344
repoName: string;
45+
benchmarkName: string;
4446
modelName: string;
4547
backendName: string;
4648
dtypeName: string;
@@ -170,6 +172,12 @@ export function GraphPanel({
170172
} else {
171173
record.display = `${model} / tp${tensorParallel}`;
172174
}
175+
} else if (
176+
repoName === "pytorch/pytorch" &&
177+
benchmarkName === "TorchCache Benchmark"
178+
) {
179+
const isDynamic = record.extra!["is_dynamic"];
180+
record.display = `${model} / ${isDynamic}`;
173181
} else {
174182
record.display = model.includes(dtype)
175183
? model.includes(device)

torchci/components/benchmark/llms/SummaryPanel.tsx

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ const getDeviceArch = (
2121
) => {
2222
const d = device ? device : "";
2323
const a = arch ? arch : "";
24-
return `${d} (${a})`;
24+
return a === "" ? d : `${d} (${a})`;
2525
};
2626

2727
export function SummaryPanel({
2828
startTime,
2929
stopTime,
3030
granularity,
3131
repoName,
32+
benchmarkName,
3233
modelName,
3334
backendName,
3435
metricNames,
@@ -40,6 +41,7 @@ export function SummaryPanel({
4041
stopTime: dayjs.Dayjs;
4142
granularity: Granularity;
4243
repoName: string;
44+
benchmarkName: string;
4345
modelName: string;
4446
backendName: string;
4547
metricNames: string[];
@@ -56,7 +58,13 @@ export function SummaryPanel({
5658
const rCommit = rPerfData.commit;
5759
const rData = rPerfData.data;
5860

59-
const data = combineLeftAndRight(repoName, lPerfData, rPerfData);
61+
const data = combineLeftAndRight(
62+
repoName,
63+
benchmarkName,
64+
lPerfData,
65+
rPerfData
66+
);
67+
console.log(data);
6068
const columns: any[] = [
6169
{
6270
field: "metadata",
@@ -87,6 +95,10 @@ export function SummaryPanel({
8795
return `Invalid model name`;
8896
}
8997

98+
const mode =
99+
metadata.mode !== undefined
100+
? `&modeName=${encodeURIComponent(metadata.mode)}`
101+
: "";
90102
const dtype =
91103
metadata.dtype !== undefined
92104
? `&dtypeName=${encodeURIComponent(metadata.dtype)}`
@@ -99,58 +111,90 @@ export function SummaryPanel({
99111

100112
const url = `/benchmark/llms?startTime=${startTime}&stopTime=${stopTime}&granularity=${granularity}&repoName=${encodeURIComponent(
101113
repoName
114+
)}&benchmarkName=${encodeURIComponent(
115+
benchmarkName
102116
)}&modelName=${encodeURIComponent(
103117
model
104-
)}${backend}${dtype}&deviceName=${encodeURIComponent(
118+
)}${backend}${mode}${dtype}&deviceName=${encodeURIComponent(
105119
deviceName
106120
)}&archName=${encodeURIComponent(archName)}`;
107121

122+
const displayName =
123+
metadata.origins.length !== 0
124+
? `${model} (${metadata.origins.join(",")})`
125+
: model;
108126
return (
109127
<a href={url}>
110-
<b>{model}</b>
128+
<b>{displayName}</b>
111129
</a>
112130
);
113131
},
114132
},
115133
];
116134

117-
const hasDtype = data.length > 0 && "dtype" in data[0] ? true : false;
118-
if (hasDtype) {
135+
const hasMode = data.length > 0 && "mode" in data[0] ? true : false;
136+
if (hasMode) {
119137
columns.push({
120-
field: "dtype",
121-
headerName: "Quantization",
138+
field: "mode",
139+
headerName: "Mode",
122140
flex: 1,
123141
renderCell: (params: GridRenderCellParams<any>) => {
124142
return `${params.value}`;
125143
},
126144
});
127145
}
128146

129-
const hasBackend = data.length > 0 && "backend" in data[0] ? true : false;
130-
if (hasBackend) {
147+
if (repoName === "vllm-project/vllm") {
131148
columns.push({
132-
field: "backend",
133-
headerName: "Backend",
149+
field: "tensor_parallel_size",
150+
headerName: "Tensor parallel",
151+
flex: 1,
152+
renderCell: (params: GridRenderCellParams<any>) => {
153+
return `${params.value}`;
154+
},
155+
});
156+
157+
columns.push({
158+
field: "request_rate",
159+
headerName: "Request rate",
134160
flex: 1,
135161
renderCell: (params: GridRenderCellParams<any>) => {
136162
return `${params.value}`;
137163
},
138164
});
139165
}
140166

141-
if (repoName === "vllm-project/vllm") {
167+
if (
168+
repoName === "pytorch/pytorch" &&
169+
benchmarkName === "TorchCache Benchmark"
170+
) {
142171
columns.push({
143-
field: "tensor_parallel_size",
144-
headerName: "Tensor parallel",
172+
field: "is_dynamic",
173+
headerName: "Is dynamic?",
145174
flex: 1,
146175
renderCell: (params: GridRenderCellParams<any>) => {
147176
return `${params.value}`;
148177
},
149178
});
179+
}
150180

181+
const hasDtype = data.length > 0 && "dtype" in data[0] ? true : false;
182+
if (hasDtype) {
151183
columns.push({
152-
field: "request_rate",
153-
headerName: "Request rate",
184+
field: "dtype",
185+
headerName: "Quantization",
186+
flex: 1,
187+
renderCell: (params: GridRenderCellParams<any>) => {
188+
return `${params.value}`;
189+
},
190+
});
191+
}
192+
193+
const hasBackend = data.length > 0 && "backend" in data[0] ? true : false;
194+
if (hasBackend && benchmarkName !== "TorchCache Benchmark") {
195+
columns.push({
196+
field: "backend",
197+
headerName: "Backend",
154198
flex: 1,
155199
renderCell: (params: GridRenderCellParams<any>) => {
156200
return `${params.value}`;

torchci/components/benchmark/llms/common.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export const EXCLUDED_METRICS: string[] = [
1515
"std_itl_ms",
1616
"std_tpot_ms",
1717
"std_ttft_ms",
18+
"cold_compile_time(s)",
19+
"warm_compile_time(s)",
20+
"speedup_pct",
1821
];
1922
export const DEFAULT_MODEL_NAME = "All Models";
2023
export const SCALE = 2;
@@ -59,6 +62,10 @@ export const IS_INCREASING_METRIC_VALUE_GOOD: { [k: string]: boolean } = {
5962
p99_ttft_ms: false,
6063
requests_per_second: true,
6164
tokens_per_second: true,
65+
"Cold compile time (s)": false,
66+
"Warm compile time (s)": false,
67+
Speedup: true,
68+
"Speedup (%)": true,
6269
};
6370
export const METRIC_DISPLAY_SHORT_HEADERS: { [k: string]: string } = {
6471
"memory_bandwidth(GB/s)": "Bandwidth",
@@ -70,10 +77,13 @@ export const METRIC_DISPLAY_SHORT_HEADERS: { [k: string]: string } = {
7077
"peak_inference_mem_usage(mb)": "InferenceMem",
7178
"peak_load_mem_usuage(mb)": "LoadMem",
7279
"generate_time(ms)": "GenerateTime",
80+
"Cold compile time (s)": "ColdCompTime",
81+
"Warm compile time (s)": "WarmCompTime",
7382
};
7483
export const DEFAULT_DEVICE_NAME = "All Devices";
7584
export const DEFAULT_ARCH_NAME = "All Platforms";
7685
export const DEFAULT_DTYPE_NAME = "All DType";
86+
export const DEFAULT_MODE_NAME = "All Modes";
7787
export const DEFAULT_BACKEND_NAME = "All Backends";
7888

7989
// Only used by ExecuTorch for now
@@ -94,6 +104,7 @@ export interface LLMsBenchmarkData {
94104
metric: string;
95105
actual: number;
96106
target: number;
107+
mode?: string;
97108
dtype: string;
98109
device: string;
99110
arch: string;

0 commit comments

Comments
 (0)