Skip to content

Commit 1bc53d7

Browse files
authored
Add platform (arch) for ExecuTorch dashboard (#6234)
Address part of pytorch/executorch#7986 The historical context here is that the older schema for benchmark database didn't have a separate columns for `device`, i.e. `cpu`, and `arch`, i.e. `x86_64`. So, they are bundle together into a single one called `deviceArch`. This PR splits this field into `device` and `arch` field behind the scene, but keeps the display name in the same format, i.e. ` Apple iPhone 15 (iOS 18.0)` to maintain the same UX, which allows me to add a new platform (arch) dropdown list for ExecuTorch. The list has only 3 options `Android` and `iOS` and `All Platforms`, ~~and only one can be selected at a time (this is the part that fixes pytorch/executorch#7986 This also applies lint to these queries and fixes a bug in which sqlfluff doesn't recognize the configuration file at `.sqlfluff` I found that https://mui.com/x/react-data-grid/pagination/ only allows up to 100 rows before enforcing pagination. Having more requires the paid pro version. ### Testing https://torchci-git-fork-huydhn-tweak-et-dashboard-fbopensource.vercel.app/benchmark/llms?repoName=pytorch%2Fexecutorch shows a new platform dropdown list
1 parent 063abf8 commit 1bc53d7

File tree

11 files changed

+93
-48
lines changed

11 files changed

+93
-48
lines changed

.lintrunner.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,12 @@ is_formatter = true
360360
[[linter]]
361361
code = 'SQLFLUFF'
362362
# include_patterns = ['torchci/clickhouse_queries/**/*.sql']
363-
include_patterns = ['torchci/clickhouse_queries/workflow_load/query.sql']
363+
include_patterns = [
364+
'torchci/clickhouse_queries/workflow_load/query.sql',
365+
'torchci/clickhouse_queries/oss_ci_benchmark_branches/query.sql',
366+
'torchci/clickhouse_queries/oss_ci_benchmark_llms/query.sql',
367+
'torchci/clickhouse_queries/oss_ci_benchmark_names/query.sql',
368+
]
364369
exclude_patterns = [
365370
]
366371
command = [

tools/linter/adapters/sqlfluff_linter.py

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ def check_file(
7878
[
7979
"sqlfluff",
8080
"format",
81+
"--config",
82+
os.path.join(os.getcwd(), ".sqlfluff"),
8183
"--dialect",
8284
"clickhouse",
8385
tmp.name,

torchci/clickhouse_queries/oss_ci_benchmark_branches/params.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"params": {
3-
"deviceArch": "String",
3+
"arch": "String",
4+
"device": "String",
45
"dtypes": "Array(String)",
56
"excludedMetrics": "Array(String)",
67
"benchmarks": "Array(String)",
@@ -11,4 +12,4 @@
1112
"stopTime": "DateTime64(3)"
1213
},
1314
"tests": []
14-
}
15+
}

torchci/clickhouse_queries/oss_ci_benchmark_branches/query.sql

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- This query is used to get the list of branches and commits used by different
22
-- OSS CI benchmark experiments. This powers HUD benchmarks dashboards
3-
SELECT
4-
DISTINCT replaceOne(head_branch, 'refs/heads/', '') AS head_branch,
3+
SELECT DISTINCT
4+
replaceOne(head_branch, 'refs/heads/', '') AS head_branch,
55
head_sha,
66
workflow_id AS id,
77
toStartOfDay(fromUnixTimestamp(timestamp)) AS event_time
@@ -32,17 +32,15 @@ WHERE
3232
OR empty({excludedMetrics: Array(String) })
3333
)
3434
AND notEmpty(metric_name)
35-
-- NB: DEVICE (ARCH) is the display format used by HUD when grouping together these two fields
3635
AND (
37-
CONCAT(
38-
device,
39-
' (',
40-
IF(empty(arch), 'NVIDIA A100-SXM4-40GB', arch),
41-
')'
42-
) = {deviceArch: String }
43-
OR {deviceArch: String } = ''
36+
startsWith({device: String }, device)
37+
OR {device: String } = ''
4438
)
4539
AND notEmpty(device)
40+
AND (
41+
arch LIKE concat('%', {arch: String }, '%')
42+
OR {arch: String } = ''
43+
)
4644
ORDER BY
4745
head_branch,
4846
timestamp DESC

torchci/clickhouse_queries/oss_ci_benchmark_llms/params.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"params": {
3+
"arch": "String",
34
"branches": "Array(String)",
45
"commits": "Array(String)",
5-
"deviceArch": "String",
6+
"device": "String",
67
"dtypes": "Array(String)",
78
"excludedMetrics": "Array(String)",
89
"benchmarks": "Array(String)",
@@ -14,4 +15,4 @@
1415
"stopTime": "DateTime64(3)"
1516
},
1617
"tests": []
17-
}
18+
}

torchci/clickhouse_queries/oss_ci_benchmark_llms/query.sql

+15-16
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ WITH benchmarks AS (
1515
o.benchmark.dtype AS dtype,
1616
IF(
1717
empty(o.runners),
18-
tupleElement(o.benchmark, 'extra_info') [ 'device' ],
19-
tupleElement(o.runners [ 1 ], 'name')
18+
tupleElement(o.benchmark, 'extra_info')['device'],
19+
tupleElement(o.runners[1], 'name')
2020
) AS device,
2121
IF(
2222
empty(o.runners),
23-
tupleElement(o.benchmark, 'extra_info') [ 'arch' ],
24-
tupleElement(o.runners [ 1 ], 'type')
23+
tupleElement(o.benchmark, 'extra_info')['arch'],
24+
tupleElement(o.runners[1], 'type')
2525
) AS arch,
2626
IF(
27-
tupleElement(o.benchmark, 'extra_info') [ 'compile' ] = '',
27+
tupleElement(o.benchmark, 'extra_info')['compile'] = '',
2828
'true', -- Default to true
29-
tupleElement(o.benchmark, 'extra_info') [ 'compile' ]
29+
tupleElement(o.benchmark, 'extra_info')['compile']
3030
) AS use_torch_compile,
3131
DATE_TRUNC(
3232
{granularity: String },
@@ -64,8 +64,9 @@ WITH benchmarks AS (
6464
)
6565
AND notEmpty(o.metric.name)
6666
)
67-
SELECT
68-
DISTINCT workflow_id,
67+
68+
SELECT DISTINCT
69+
workflow_id,
6970
job_id,
7071
model,
7172
backend,
@@ -85,17 +86,15 @@ WHERE
8586
has({branches: Array(String) }, head_branch)
8687
OR empty({branches: Array(String) })
8788
)
88-
-- NB: DEVICE (ARCH) is the display format used by HUD when grouping together these two fields
8989
AND (
90-
CONCAT(
91-
device,
92-
' (',
93-
IF(empty(arch), 'NVIDIA A100-SXM4-40GB', arch),
94-
')'
95-
) = {deviceArch: String }
96-
OR {deviceArch: String } = ''
90+
startsWith({device: String }, device)
91+
OR {device: String } = ''
9792
)
9893
AND notEmpty(device)
94+
AND (
95+
arch LIKE concat('%', {arch: String }, '%')
96+
OR {arch: String } = ''
97+
)
9998
ORDER BY
10099
granularity_bucket DESC,
101100
workflow_id DESC,

torchci/clickhouse_queries/oss_ci_benchmark_names/params.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"params": {
3-
"deviceArch": "String",
3+
"arch": "String",
4+
"device": "String",
45
"dtypes": "Array(String)",
56
"excludedMetrics": "Array(String)",
67
"benchmarks": "Array(String)",
@@ -11,4 +12,4 @@
1112
"stopTime": "DateTime64(3)"
1213
},
1314
"tests": []
14-
}
15+
}

torchci/clickhouse_queries/oss_ci_benchmark_names/query.sql

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- This query is used by HUD benchmarks dashboards to get the list of experiment names
2-
SELECT
3-
DISTINCT benchmark_name AS benchmark,
2+
SELECT DISTINCT
3+
benchmark_name AS benchmark,
44
model_name AS model,
55
model_backend AS backend,
66
metric_name AS metric,
@@ -34,17 +34,15 @@ WHERE
3434
OR empty({excludedMetrics: Array(String) })
3535
)
3636
AND notEmpty(metric_name)
37-
-- NB: DEVICE (ARCH) is the display format used by HUD when grouping together these two fields
3837
AND (
39-
CONCAT(
40-
device,
41-
' (',
42-
IF(empty(arch), 'NVIDIA A100-SXM4-40GB', arch),
43-
')'
44-
) = {deviceArch: String }
45-
OR {deviceArch: String } = ''
38+
startsWith({device: String }, device)
39+
OR {device: String } = ''
4640
)
4741
AND notEmpty(device)
42+
AND (
43+
arch LIKE concat('%', {arch: String }, '%')
44+
OR {arch: String } = ''
45+
)
4846
ORDER BY
4947
benchmark,
5048
backend,

torchci/components/benchmark/llms/SummaryPanel.tsx

+13-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function SummaryPanel({
2323
modelName,
2424
backendName,
2525
metricNames,
26+
archName,
2627
lPerfData,
2728
rPerfData,
2829
}: {
@@ -33,6 +34,7 @@ export function SummaryPanel({
3334
modelName: string;
3435
backendName: string;
3536
metricNames: string[];
37+
archName: string;
3638
lPerfData: BranchAndCommitPerfData;
3739
rPerfData: BranchAndCommitPerfData;
3840
}) {
@@ -75,13 +77,15 @@ export function SummaryPanel({
7577
params.value.backend !== undefined
7678
? `&backendName=${encodeURIComponent(params.value.backend)}`
7779
: "";
78-
const deviceArch = `${params.value.device} (${params.value.arch})`;
80+
const deviceName = `${params.value.device} (${params.value.arch})`;
7981

8082
const url = `/benchmark/llms?startTime=${startTime}&stopTime=${stopTime}&granularity=${granularity}&repoName=${encodeURIComponent(
8183
repoName
8284
)}&modelName=${encodeURIComponent(
8385
model
84-
)}${backend}${dtype}&deviceName=${encodeURIComponent(deviceArch)}`;
86+
)}${backend}${dtype}&deviceName=${encodeURIComponent(
87+
deviceName
88+
)}&archName=${encodeURIComponent(archName)}`;
8589

8690
return (
8791
<a href={url}>
@@ -215,17 +219,23 @@ export function SummaryPanel({
215219
]
216220
);
217221

222+
// TODO (huydhn): Table bigger than 100 rows requires x-data-grid-pro
218223
return (
219224
<Grid2 container spacing={2} style={{ height: "100%" }}>
220225
<Grid2
221226
size={{ xs: 12, lg: 12 }}
222-
height={data.length * ROW_HEIGHT + ROW_GAP}
227+
height={
228+
data.length > 99
229+
? 99 * ROW_HEIGHT
230+
: data.length * ROW_HEIGHT + ROW_GAP
231+
}
223232
>
224233
<TablePanelWithData
225234
title={"Models"}
226235
data={data}
227236
columns={columns}
228237
dataGridProps={{ getRowId: (el: any) => el.name }}
238+
showFooter={true}
229239
/>
230240
</Grid2>
231241
</Grid2>

torchci/components/benchmark/llms/common.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ export const METRIC_DISPLAY_SHORT_HEADERS: { [k: string]: string } = {
3535
"compilation_time(s)": "CompTime",
3636
};
3737
export const DEFAULT_DEVICE_NAME = "All Devices";
38+
export const DEFAULT_ARCH_NAME = "All Platforms";
3839
export const DEFAULT_DTYPE_NAME = "All DType";
3940
export const DEFAULT_BACKEND_NAME = "All Backends";
4041

42+
// Only used by ExecuTorch for now
43+
export const ARCH_NAMES: { [k: string]: string[] } = {
44+
"pytorch/executorch": ["Android", "iOS"],
45+
};
46+
4147
// Relative thresholds
4248
export const RELATIVE_THRESHOLD = 0.05;
4349

torchci/pages/benchmark/llms.tsx

+26-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
MAIN_BRANCH,
88
} from "components/benchmark/common";
99
import {
10+
ARCH_NAMES,
11+
DEFAULT_ARCH_NAME,
1012
DEFAULT_BACKEND_NAME,
1113
DEFAULT_DEVICE_NAME,
1214
DEFAULT_DTYPE_NAME,
@@ -45,6 +47,7 @@ function Report({
4547
backendName,
4648
dtypeName,
4749
deviceName,
50+
archName,
4851
metricNames,
4952
lBranchAndCommit,
5053
rBranchAndCommit,
@@ -58,6 +61,7 @@ function Report({
5861
backendName: string;
5962
dtypeName: string;
6063
deviceName: string;
64+
archName: string;
6165
metricNames: string[];
6266
lBranchAndCommit: BranchAndCommit;
6367
rBranchAndCommit: BranchAndCommit;
@@ -146,6 +150,7 @@ function Report({
146150
modelName={modelName}
147151
backendName={backendName}
148152
metricNames={metricNames}
153+
archName={archName}
149154
lPerfData={{
150155
...lBranchAndCommit,
151156
data: lDataWithSpeedup,
@@ -178,6 +183,7 @@ export default function Page() {
178183
const [backendName, setBackendName] = useState<string>(DEFAULT_BACKEND_NAME);
179184
const [dtypeName, setDTypeName] = useState<string>(DEFAULT_DTYPE_NAME);
180185
const [deviceName, setDeviceName] = useState<string>(DEFAULT_DEVICE_NAME);
186+
const [archName, setArchName] = useState<string>(DEFAULT_ARCH_NAME);
181187

182188
// Set the dropdown value what is in the param
183189
useEffect(() => {
@@ -231,6 +237,12 @@ export default function Page() {
231237
setDeviceName(deviceName);
232238
}
233239

240+
// Set the default arch to Android for ExecuTorch as it has only 2 options Android and iOS
241+
const archName: string = (router.query.archName as string) ?? undefined;
242+
if (archName !== undefined) {
243+
setArchName(archName);
244+
}
245+
234246
const lBranch: string = (router.query.lBranch as string) ?? undefined;
235247
if (lBranch !== undefined) {
236248
setLBranch(lBranch);
@@ -260,7 +272,8 @@ export default function Page() {
260272

261273
const queryName = "oss_ci_benchmark_names";
262274
const queryParams = {
263-
deviceArch: deviceName === DEFAULT_DEVICE_NAME ? "" : deviceName,
275+
arch: archName === DEFAULT_ARCH_NAME ? "" : archName,
276+
device: deviceName === DEFAULT_DEVICE_NAME ? "" : deviceName,
264277
dtypes:
265278
dtypeName === DEFAULT_DTYPE_NAME
266279
? []
@@ -326,7 +339,9 @@ export default function Page() {
326339
backendName
327340
)}&dtypeName=${encodeURIComponent(
328341
dtypeName
329-
)}&deviceName=${encodeURIComponent(deviceName)}`}
342+
)}&deviceName=${encodeURIComponent(
343+
deviceName
344+
)}&archName=${encodeURIComponent(archName)}`}
330345
/>
331346
</Stack>
332347
<Stack direction="row" spacing={2} sx={{ mb: 2 }}>
@@ -365,6 +380,14 @@ export default function Page() {
365380
label={"DType"}
366381
/>
367382
)}
383+
{repoName === "pytorch/executorch" && (
384+
<DTypePicker
385+
dtype={archName}
386+
setDType={setArchName}
387+
dtypes={[DEFAULT_ARCH_NAME, ...ARCH_NAMES[repoName]]}
388+
label={"Platform"}
389+
/>
390+
)}
368391
<DTypePicker
369392
dtype={deviceName}
370393
setDType={setDeviceName}
@@ -407,6 +430,7 @@ export default function Page() {
407430
backendName={backendName}
408431
dtypeName={dtypeName}
409432
deviceName={deviceName}
433+
archName={archName}
410434
metricNames={metricNames}
411435
lBranchAndCommit={{ branch: lBranch, commit: lCommit }}
412436
rBranchAndCommit={{ branch: rBranch, commit: rCommit }}

0 commit comments

Comments
 (0)