Skip to content

Commit d422175

Browse files
authored
add Info section for card (#7276)
## Add info section We've been asked by people where the source of the benchmark results are coming from, A info section is added to guide people to the github repo locatio of the benchmarks ## Others Add arrow and card shape to the list view for benchmarks to indicate it's clickable demo link: https://torchci-git-addsource-fbopensource.vercel.app/benchmark/benchmark_list demo: <img width="1959" height="937" alt="image" src="https://github.com/user-attachments/assets/d1b9a429-dc58-4fea-934d-3748cc3c1b86" />
1 parent 5903a75 commit d422175

File tree

2 files changed

+107
-51
lines changed

2 files changed

+107
-51
lines changed

torchci/components/benchmark/v3/BenchmarkListPage.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ export const categories: BenchmarkCategoryGroup[] = [
1212
{
1313
name: "CacheBench Benchmark",
1414
route:
15-
"/benchmark/llms?repoName=pytorch%2Fpytorch&benchmarkName=TorchCache+Benchmark",
15+
"/benchmark/llms?repoName=pytorch%2Fpytorch&benchmarkName=+Benchmark",
16+
info: "Powered by [code](https://github.com/search?q=repo%3Apytorch%2Fpytorch%20%20TorchCache&type=code)",
1617
},
1718
{
1819
name: "Compiler Inductor Benchmark",
1920
route: "/benchmark/compilers_regression",
2021
description:
2122
"Use `legacy page` to see comparison view for different branches. It will be deprecated soon",
23+
info: "Powered by [code](https://github.com/pytorch/pytorch/tree/main/benchmarks/dynamo#torchcompile-benchmarking)",
2224
actions: [
2325
{
2426
label: "Legacy Page/Playground",
@@ -33,11 +35,13 @@ export const categories: BenchmarkCategoryGroup[] = [
3335
{
3436
name: "LLMs Benchmark",
3537
route: "/benchmark/llms?repoName=pytorch%2Fpytorch",
38+
info: "Powered by [code](https://github.com/pytorch/pytorch/tree/main/benchmarks/gpt_fast)",
3639
},
3740
{
3841
name: "Operator Microbenchmark",
3942
route:
4043
"/benchmark/llms?repoName=pytorch%2Fpytorch&benchmarkName=PyTorch+operator+microbenchmark",
44+
info: "Powered by [code](https://github.com/pytorch/pytorch/tree/main/benchmarks/operator_benchmark)",
4145
},
4246
{
4347
name: "Triton Benchmark",
@@ -58,6 +62,7 @@ export const categories: BenchmarkCategoryGroup[] = [
5862
name: "TorchAO Micro API Benchmark",
5963
route:
6064
"/benchmark/llms?repoName=pytorch%2Fao&benchmarkName=micro-benchmark+api",
65+
info: "Powered by [code](https://github.com/pytorch/ao/blob/main/docs/source/benchmarking_api_guide.md)",
6166
},
6267
],
6368
},
@@ -69,6 +74,8 @@ export const categories: BenchmarkCategoryGroup[] = [
6974
{
7075
name: "ExecuTorch Benchmark",
7176
route: "/benchmark/llms?repoName=pytorch%2Fexecutorch",
77+
info: "Powered by [apple-perf](https://github.com/pytorch/executorch/blob/main/.github/workflows/apple-perf.yml) \
78+
and [android-perf](https://github.com/pytorch/executorch/blob/main/.github/workflows/android-perf.yml) workflows",
7279
},
7380
],
7481
},
@@ -80,6 +87,7 @@ export const categories: BenchmarkCategoryGroup[] = [
8087
{
8188
name: "VLLM V1 Benchmark",
8289
route: "/benchmark/llms?repoName=vllm-project%2Fvllm",
90+
info: "Powered by [code](https://github.com/pytorch/pytorch-integration-testing/tree/main/vllm-benchmarks/benchmarks)",
8391
},
8492
],
8593
},
@@ -91,6 +99,7 @@ export const categories: BenchmarkCategoryGroup[] = [
9199
{
92100
name: "SGLang Benchmark",
93101
route: "/benchmark/llms?repoName=sgl-project%2Fsglang",
102+
info: "Powered by [code](https://github.com/pytorch/pytorch-integration-testing/tree/main/sglang-benchmarks/benchmarks)",
94103
},
95104
],
96105
},
@@ -103,6 +112,7 @@ export const categories: BenchmarkCategoryGroup[] = [
103112
name: "Helion Benchmark",
104113
route:
105114
"/benchmark/llms?repoName=pytorch%2Fhelion&benchmarkName=Helion+Benchmark",
115+
info: "Powered by [code](https://github.com/pytorch/helion/tree/main/benchmarks)",
106116
},
107117
],
108118
},

torchci/components/benchmark/v3/components/benchmarkList/BenchmarkCategoryCard.tsx

Lines changed: 96 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
12
import {
23
Card,
34
CardContent,
@@ -8,12 +9,14 @@ import {
89
ListItem,
910
ListItemButton,
1011
ListItemText,
12+
Paper,
1113
Stack,
1214
Tooltip,
1315
Typography,
1416
} from "@mui/material";
1517
import { Box } from "@mui/system";
1618
import Link from "next/link";
19+
import ReactMarkdown from "react-markdown";
1720

1821
// ============================
1922
// Styles (centralized)
@@ -38,6 +41,7 @@ export interface BenchmarkLinkItem {
3841
name: string;
3942
route: string;
4043
description?: string;
44+
info?: string;
4145
keys?: string[];
4246
actions?: {
4347
label: string;
@@ -81,15 +85,31 @@ function BenchmarkCardItem({
8185
};
8286

8387
return (
84-
<ListItem key={it.route} disablePadding>
85-
<Box sx={{ width: "100%" }}>
88+
<ListItem key={it.route} disablePadding sx={{ mb: 1 }}>
89+
<Paper
90+
variant="outlined"
91+
sx={{
92+
p: 1,
93+
width: "100%",
94+
borderRadius: 2,
95+
overflow: "hidden",
96+
borderColor: "divider",
97+
"&:hover": {
98+
boxShadow: 3,
99+
borderColor: "primary.main",
100+
},
101+
}}
102+
>
86103
<Tooltip title="Go to Main Page" arrow>
87104
<ListItemButton {...buttonProps}>
88105
<ListItemText
89106
primary={
90-
<Typography variant="subtitle1">
91-
{highlight(it.name, query)}
92-
</Typography>
107+
<Stack direction="row" alignItems="center" spacing={1}>
108+
<Typography variant="h6" color="primary">
109+
{highlight(it.name, query)}
110+
</Typography>
111+
<ChevronRightIcon fontSize="small" />
112+
</Stack>
93113
}
94114
secondary={
95115
it.description?.length ? (
@@ -100,50 +120,77 @@ function BenchmarkCardItem({
100120
</ListItemButton>
101121
</Tooltip>
102122

103-
{/* Actions */}
123+
{it.info ? (
124+
<Stack
125+
spacing={1}
126+
sx={{ px: 2, pb: 1, pt: 0.5 }}
127+
direction="row"
128+
alignItems="center"
129+
>
130+
<Typography variant="subtitle1">Details:</Typography>
131+
<Typography
132+
variant="subtitle1"
133+
color="text.secondary"
134+
sx={{
135+
"& p": { margin: 0, lineHeight: 1.2 },
136+
"& ul, & ol": { margin: 0, paddingLeft: "1.2rem" },
137+
"& li": { margin: 0, lineHeight: 1.2 },
138+
}}
139+
>
140+
<MarkdownText text={it.info} />
141+
</Typography>
142+
</Stack>
143+
) : null}
144+
104145
{it.actions && (
105-
<Stack direction="row" spacing={1} sx={{ px: 2, pb: 1, pt: 0.5 }}>
106-
{it.actions.map((a, idx) => {
107-
if (!a.href) {
108-
// non-link action (local click)
146+
<Box sx={{ px: 2, pb: 1, pt: 0.5 }}>
147+
<Stack direction="row" spacing={1} alignItems="center">
148+
<Typography variant="subtitle1">Pages:</Typography>
149+
{it.actions.map((a, idx) => {
150+
if (!a.href) {
151+
return (
152+
<Chip
153+
key={idx}
154+
clickable
155+
size="small"
156+
color="secondary"
157+
label={a.label}
158+
onClick={a.onClick}
159+
/>
160+
);
161+
}
162+
const linkProps = isExternal(a.href)
163+
? {
164+
component: "a" as const,
165+
href: a.href,
166+
target: "_blank",
167+
rel: "noopener noreferrer",
168+
}
169+
: {
170+
component: Link as any,
171+
href: a.href,
172+
prefetch: false,
173+
};
109174
return (
110175
<Chip
176+
{...linkProps}
111177
key={idx}
112178
clickable
113179
size="small"
114-
color="secondary"
115-
label={a.label}
116-
onClick={a.onClick}
180+
color="primary"
181+
label={
182+
<Stack direction="row" alignItems="center" spacing={0.5}>
183+
<span>{a.label}</span>
184+
<ChevronRightIcon fontSize="small" />
185+
</Stack>
186+
}
117187
/>
118188
);
119-
}
120-
const linkProps = isExternal(a.href)
121-
? {
122-
component: "a" as const,
123-
href: a.href,
124-
target: "_blank",
125-
rel: "noopener noreferrer",
126-
}
127-
: {
128-
component: Link as any,
129-
href: a.href,
130-
// optional Next.js tweaks:
131-
prefetch: false,
132-
};
133-
return (
134-
<Chip
135-
{...linkProps}
136-
key={idx}
137-
clickable
138-
size="small"
139-
color="primary"
140-
label={a.label}
141-
/>
142-
);
143-
})}
144-
</Stack>
189+
})}
190+
</Stack>
191+
</Box>
145192
)}
146-
</Box>
193+
</Paper>
147194
</ListItem>
148195
);
149196
}
@@ -185,16 +232,11 @@ export function BenchmarkCategoryCard({
185232
...(it.actions ?? []), // keep existing actions if any
186233
];
187234
return (
188-
<>
189-
<BenchmarkCardItem
190-
key={it.route}
191-
it={{ ...it, actions }}
192-
query={query}
193-
/>
194-
{index < cat.items.length - 1 && (
195-
<Divider key={`divider-${index}`} />
196-
)}
197-
</>
235+
<BenchmarkCardItem
236+
key={it.route}
237+
it={{ ...it, actions }}
238+
query={query}
239+
/>
198240
);
199241
})}
200242
</List>
@@ -236,3 +278,7 @@ function highlight(text: string, q: string) {
236278
}
237279

238280
const isExternal = (url: string) => /^https?:\/\//i.test(url);
281+
282+
export function MarkdownText({ text }: { text: string }) {
283+
return <ReactMarkdown>{text}</ReactMarkdown>;
284+
}

0 commit comments

Comments
 (0)