Skip to content

Commit 404854f

Browse files
authored
Add Inductor kernel benchmark dashboard (#8476)
Adds a PyTorch Inductor kernel benchmark dashboard backed by results from better-benchmark. - Registers pytorch_inductor_kernel_benchmark. - Maps it to inductor-kernel-benchmark records from pytorch/pytorch. - Adds lower-is-better comparison policies for latency_us and gap_vs_sol. - Defaults to CUDA on NVIDIA B200. - Adds the dashboard to the PyTorch benchmark catalog. the benchmark CI was validated in [pytorch/pytorch#192659](pytorch/pytorch#192659) [B200 run](https://github.com/pytorch/pytorch/actions/runs/31334635356) generated and uploaded 3,454 records for 1,727 kernels.
1 parent dfde978 commit 404854f

2 files changed

Lines changed: 102 additions & 0 deletions

File tree

torchci/components/benchmark_v3/configs/configurations.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import {
1919
BenchmarkIdMappingItem,
2020
BenchmarkPageType,
2121
} from "./config_book_types";
22+
import {
23+
BETTER_BENCHMARK_ID,
24+
BetterBenchmarkDashboardConfig,
25+
} from "./teams/compilers/inductor_kernel_benchmark_config";
2226
import {
2327
PYTORCH_GPTFAST_BENCHMARK_ID,
2428
PytorchGptFastBenchmarkDashboardConfig,
@@ -45,6 +49,9 @@ export const REPORT_ID_TO_BENCHMARK_ID_MAPPING: Record<string, string> = {
4549
};
4650

4751
export const PREDEFINED_BENCHMARK_CONFIG: BenchmarkConfigMap = {
52+
[BETTER_BENCHMARK_ID]: {
53+
[BenchmarkPageType.DashboardPage]: BetterBenchmarkDashboardConfig,
54+
},
4855
[COMPILTER_BENCHMARK_NAME]: {
4956
[BenchmarkPageType.DashboardPage]: CompilerDashboardBenchmarkUIConfig,
5057
},
@@ -78,6 +85,11 @@ export const PREDEFINED_BENCHMARK_CONFIG: BenchmarkConfigMap = {
7885
};
7986

8087
export const BENCHMARK_ID_MAPPING: Record<string, BenchmarkIdMappingItem> = {
88+
[BETTER_BENCHMARK_ID]: {
89+
id: BETTER_BENCHMARK_ID,
90+
repoName: "pytorch/pytorch",
91+
benchmarkName: "inductor-kernel-benchmark",
92+
},
8193
[COMPILTER_BENCHMARK_NAME]: {
8294
id: COMPILTER_BENCHMARK_NAME,
8395
repoName: "pytorch/pytorch",
@@ -223,6 +235,13 @@ export const BENCHMARK_CATEGORIES: BenchmarkCategoryGroup[] = [
223235
},
224236
],
225237
},
238+
{
239+
name: "Better Benchmark",
240+
route: `/benchmark/v3/dashboard/${BETTER_BENCHMARK_ID}`,
241+
info: "Powered by [better-benchmark](https://github.com/eellison/better-benchmark), which extracts and deduplicates fused kernel regions from real model compilations, and the [PyTorch B200 workflow](https://github.com/pytorch/pytorch/blob/main/.github/workflows/better-benchmark-b200.yml).",
242+
description:
243+
"Nightly B200 measurements of TorchInductor kernels across retained model shapes, including latency and gap to memory-bandwidth SOL.",
244+
},
226245
{
227246
name: "Triton Benchmark",
228247
route: "/tritonbench/commit_view",
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import {
2+
BenchmarkUIConfig,
3+
SubSectionRenderConfig,
4+
UIRenderConfig,
5+
} from "../../config_book_types";
6+
import { BenchmarkComparisonPolicyConfig } from "../../helpers/RegressionPolicy";
7+
import {
8+
DEFAULT_DASHBOARD_BENCHMARK_INITIAL,
9+
defaultDashboardBenchmarkUIConfig,
10+
} from "../defaults/default_dashboard_config";
11+
12+
export const BETTER_BENCHMARK_ID = "better_benchmark";
13+
14+
const LOWER_IS_BETTER_POLICY: BenchmarkComparisonPolicyConfig = {
15+
target: "latency_us",
16+
type: "ratio",
17+
ratioPolicy: {
18+
badRatio: 1.05,
19+
goodRatio: 0.95,
20+
direction: "down",
21+
},
22+
};
23+
24+
const COMPARISON_POLICY = {
25+
latency_us: LOWER_IS_BETTER_POLICY,
26+
gap_vs_sol: {
27+
...LOWER_IS_BETTER_POLICY,
28+
target: "gap_vs_sol",
29+
},
30+
};
31+
32+
function withComparisonPolicy(render: UIRenderConfig): UIRenderConfig {
33+
if (render.type !== "AutoBenchmarkTimeSeriesTable") {
34+
return render;
35+
}
36+
return {
37+
...render,
38+
config: {
39+
...render.config,
40+
comparisonPolicy: COMPARISON_POLICY,
41+
},
42+
};
43+
}
44+
45+
const defaultDataRender = defaultDashboardBenchmarkUIConfig.dataRender;
46+
47+
export const BetterBenchmarkDashboardConfig: BenchmarkUIConfig = {
48+
...defaultDashboardBenchmarkUIConfig,
49+
benchmarkId: BETTER_BENCHMARK_ID,
50+
apiId: BETTER_BENCHMARK_ID,
51+
title: "Better Benchmark",
52+
type: "dashboard",
53+
dataBinding: {
54+
...defaultDashboardBenchmarkUIConfig.dataBinding,
55+
initial: {
56+
...DEFAULT_DASHBOARD_BENCHMARK_INITIAL,
57+
benchmarkId: BETTER_BENCHMARK_ID,
58+
filters: {
59+
device: "cuda",
60+
arch: "NVIDIA B200",
61+
deviceName: "cuda||NVIDIA B200",
62+
},
63+
},
64+
},
65+
dataRender: {
66+
...defaultDataRender,
67+
renders: (defaultDataRender.renders ?? []).map(withComparisonPolicy),
68+
subSectionRenders: Object.fromEntries(
69+
(
70+
Object.entries(defaultDataRender.subSectionRenders ?? {}) as [
71+
string,
72+
SubSectionRenderConfig
73+
][]
74+
).map(([name, section]) => [
75+
name,
76+
{
77+
...section,
78+
renders: section.renders.map(withComparisonPolicy),
79+
},
80+
])
81+
),
82+
},
83+
};

0 commit comments

Comments
 (0)