From ad590d151954697f4e6c8e868ab83b3a42359533 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Mon, 27 Jan 2025 18:55:39 -0800 Subject: [PATCH 01/11] test --- .../query.sql | 1 + .../benchmark/BranchAndCommitPicker.tsx | 48 +++++++++++++++---- torchci/components/benchmark/CommitPanel.tsx | 3 ++ .../benchmark/compilers/SummaryPanel.tsx | 1 + .../components/benchmark/compilers/common.tsx | 7 +++ torchci/lib/clickhouse.ts | 1 + .../[suite]/[compiler]/[[...page]].tsx | 11 +++-- torchci/pages/benchmark/compilers.tsx | 17 +++++++ 8 files changed, 78 insertions(+), 11 deletions(-) diff --git a/torchci/clickhouse_queries/compilers_benchmark_performance_branches/query.sql b/torchci/clickhouse_queries/compilers_benchmark_performance_branches/query.sql index 7029538d56..420ec53bc5 100644 --- a/torchci/clickhouse_queries/compilers_benchmark_performance_branches/query.sql +++ b/torchci/clickhouse_queries/compilers_benchmark_performance_branches/query.sql @@ -4,6 +4,7 @@ SELECT DISTINCT w.head_branch AS head_branch, w.head_sha, w.id, + p.filename, toStartOfDay(fromUnixTimestamp64Milli(p.timestamp)) AS event_time FROM benchmark.inductor_torch_dynamo_perf_stats p diff --git a/torchci/components/benchmark/BranchAndCommitPicker.tsx b/torchci/components/benchmark/BranchAndCommitPicker.tsx index bb32be072e..d0a66a57d7 100644 --- a/torchci/components/benchmark/BranchAndCommitPicker.tsx +++ b/torchci/components/benchmark/BranchAndCommitPicker.tsx @@ -20,16 +20,33 @@ import useSWR from "swr"; export const COMMIT_TO_WORKFLOW_ID: { [k: string]: number } = {}; export const WORKFLOW_ID_TO_COMMIT: { [k: number]: string } = {}; + +function filterCommitsByFilename(commits: any[], filenameFilter: string|undefined) { + if (filenameFilter === undefined || filenameFilter == "all") { + return commits; + } + + const filteredCommits = commits.filter((r:any)=>{ + const found = r.filenames.filter((f: string) => f.includes(filenameFilter)); + return found.length > 0; + }) + return filteredCommits; +} + function groupCommitByBranch(data: any) { + const dedups: { [k: string]: Set } = {}; const branches: { [k: string]: any[] } = {}; + data.forEach((r: any) => { const b = r.head_branch; if (!(b in branches)) { branches[b] = []; dedups[b] = new Set(); } + if (dedups[b].has(r.head_sha)) { + branches[b].find((c: any) => c.head_sha === r.head_sha).filenames.push(r.filename); return; } @@ -38,6 +55,9 @@ function groupCommitByBranch(data: any) { event_time: r.event_time, // This is used to sort the list of branches to show the main branch first display_priority: r.head_branch === MAIN_BRANCH ? 99 : 1, + // store list of config files for the commit, this is used to filter out tags + filenames: [r.filename], + id: r.id, }); dedups[b].add(r.head_sha); }); @@ -55,6 +75,7 @@ export function BranchAndCommitPicker({ titlePrefix, fallbackIndex, timeRange, + filenameFilter, }: { queryName: string; queryParams: { [k: string]: any }; @@ -65,6 +86,7 @@ export function BranchAndCommitPicker({ titlePrefix: string; fallbackIndex: number; timeRange: any; + filenameFilter?: string; }) { const url = `/api/clickhouse/${queryName}?parameters=${encodeURIComponent( JSON.stringify(queryParams) @@ -86,25 +108,29 @@ export function BranchAndCommitPicker({ // Fallback to the main branch or the first available branch found in result setBranch(branch); } - const branchCommits = branches[branch].map((r: any) => r.head_sha); + + const resultCommits =filterCommitsByFilename(branches[branch],filenameFilter); + const branchCommits = resultCommits.map((r: any) => r.head_sha); if ( commit === undefined || commit === "" || - !branchCommits.includes(commit) || + !resultCommits.includes(commit) || timeRange !== -1 ) { const index = - (branchCommits.length + fallbackIndex) % branchCommits.length; - setCommit(branchCommits[index]); + setCommit(branchCommits.length + fallbackIndex) % branchCommits.length; + (branchCommits[index]); } + console.log("BranchAndCommitPicker", branch, commit); + data.forEach((r: any) => { COMMIT_TO_WORKFLOW_ID[r.head_sha] = r.id; WORKFLOW_ID_TO_COMMIT[r.id] = r.head_sha; }); } - }, [data]); + }, [data,filenameFilter]); if (error !== undefined) { return ( @@ -140,6 +166,12 @@ export function BranchAndCommitPicker({ const displayBranches = Object.keys(branches).sort( (x, y) => branches[y][0].display_priority - branches[x][0].display_priority ); + + const resultCommits = filterCommitsByFilename(branches[branch],filenameFilter); + + console.log("BranchAndCommitPicker2", branch, commit,filenameFilter); + + return (
@@ -160,8 +192,7 @@ export function BranchAndCommitPicker({ ))} - - + {resultCommits.length > 0 && {titlePrefix} Commit @@ -172,7 +203,7 @@ export function BranchAndCommitPicker({ onChange={handleCommitChange} id={`commit-picker-select-${commit}`} > - {branches[branch].map((r: any) => ( + {resultCommits.map((r: any) => ( {r.head_sha.substring(0, SHA_DISPLAY_LENGTH)} ( {dayjs(r.event_time).format("YYYY/MM/DD")}) @@ -180,6 +211,7 @@ export function BranchAndCommitPicker({ ))} + }
); } diff --git a/torchci/components/benchmark/CommitPanel.tsx b/torchci/components/benchmark/CommitPanel.tsx index e48da70470..0ee7ef5aa6 100644 --- a/torchci/components/benchmark/CommitPanel.tsx +++ b/torchci/components/benchmark/CommitPanel.tsx @@ -16,6 +16,9 @@ export function CommitPanel({ workflowName: string; children: ReactNode; }) { + if (!lBranchAndCommit.commit || !rBranchAndCommit.commit) { + return <> No commits are selected ; + } return ( diff --git a/torchci/components/benchmark/compilers/SummaryPanel.tsx b/torchci/components/benchmark/compilers/SummaryPanel.tsx index 6cd93eff46..1d2e8287b2 100644 --- a/torchci/components/benchmark/compilers/SummaryPanel.tsx +++ b/torchci/components/benchmark/compilers/SummaryPanel.tsx @@ -251,6 +251,7 @@ export function SummaryPanel({ const l = extractPercentage(v.l); const r = extractPercentage(v.r); + if (l === undefined) { return ""; } diff --git a/torchci/components/benchmark/compilers/common.tsx b/torchci/components/benchmark/compilers/common.tsx index d76828b05a..f498bd2aba 100644 --- a/torchci/components/benchmark/compilers/common.tsx +++ b/torchci/components/benchmark/compilers/common.tsx @@ -76,3 +76,10 @@ export const DISPLAY_NAMES_TO_WORKFLOW_NAMES: { [k: string]: string } = { rocm: "inductor-perf-nightly-rocm", mps: "inductor-perf-nightly-macos", }; + +export const DEFAULT_FILTER_NAME = "all"; + +export const DISPLAY_NAMES_TO_FILTER: { [k: string]: string } = { + "All": DEFAULT_FILTER_NAME, + "Max_autotune": "max_autotune", +}; diff --git a/torchci/lib/clickhouse.ts b/torchci/lib/clickhouse.ts index 311a2c21dd..fdceacb38d 100644 --- a/torchci/lib/clickhouse.ts +++ b/torchci/lib/clickhouse.ts @@ -17,6 +17,7 @@ export function getClickhouseClient() { password: process.env.CLICKHOUSE_HUD_USER_PASSWORD ?? "", }); } +// export function getClickhouseClientWritable() { return createClient({ diff --git a/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx b/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx index 2c12755caa..fed9ea6c04 100644 --- a/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx +++ b/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx @@ -117,6 +117,8 @@ function Report({ return ; } + console.log(lBranchAndCommit, rBranchAndCommit) + return (
@@ -393,8 +396,9 @@ export default function Page() { /> + - + />} + {lCommit.length==0 || rCommit.length === 0 &&
cannot detect commits to compare
}
); diff --git a/torchci/pages/benchmark/compilers.tsx b/torchci/pages/benchmark/compilers.tsx index 2cb126d8b6..1331b7c52a 100644 --- a/torchci/pages/benchmark/compilers.tsx +++ b/torchci/pages/benchmark/compilers.tsx @@ -8,15 +8,18 @@ import { } from "components/benchmark/common"; import { BenchmarkLogs } from "components/benchmark/compilers/BenchmarkLogs"; import { + DEFAULT_FILTER_NAME, DEFAULT_DEVICE_NAME, DISPLAY_NAMES_TO_DEVICE_NAMES, DISPLAY_NAMES_TO_WORKFLOW_NAMES, DTYPES, + DISPLAY_NAMES_TO_FILTER, } from "components/benchmark/compilers/common"; import CompilerGraphGroup from "components/benchmark/compilers/CompilerGraphGroup"; import { SUITES } from "components/benchmark/compilers/SuitePicker"; import { SummaryPanel } from "components/benchmark/compilers/SummaryPanel"; import { + FilterPicker, DEFAULT_MODE, DTypePicker, ModePicker, @@ -56,6 +59,10 @@ function Report({ lBranchAndCommit: BranchAndCommit; rBranchAndCommit: BranchAndCommit; }) { + if (!lBranchAndCommit.commit || !rBranchAndCommit.commit) { + return ; + } + const queryName = "compilers_benchmark_performance"; const queryParamsWithL: { [key: string]: any } = { ...queryParams, @@ -116,6 +123,7 @@ function Report({ > +
I'm here
(""); const [baseUrl, setBaseUrl] = useState(""); const [deviceName, setDeviceName] = useState(DEFAULT_DEVICE_NAME); + const [filter, setFilter] = useState(DEFAULT_FILTER_NAME); // Set the dropdown value what is in the param useEffect(() => { @@ -300,6 +309,12 @@ export default function Page() { dtypes={Object.keys(DISPLAY_NAMES_TO_DEVICE_NAMES)} label={"Device"} /> + —Diff→ @@ -324,6 +340,7 @@ export default function Page() { titlePrefix={"New"} fallbackIndex={0} // Default to the latest commit timeRange={timeRange} + filenameFilter= {filter} />
Date: Tue, 28 Jan 2025 13:39:38 -0800 Subject: [PATCH 02/11] test --- .../benchmark/BranchAndCommitPicker.tsx | 84 ++++++++++++++----- .../components/benchmark/compilers/common.tsx | 5 +- torchci/pages/benchmark/compilers.tsx | 3 +- 3 files changed, 67 insertions(+), 25 deletions(-) diff --git a/torchci/components/benchmark/BranchAndCommitPicker.tsx b/torchci/components/benchmark/BranchAndCommitPicker.tsx index d0a66a57d7..36361a4bbc 100644 --- a/torchci/components/benchmark/BranchAndCommitPicker.tsx +++ b/torchci/components/benchmark/BranchAndCommitPicker.tsx @@ -1,14 +1,18 @@ import { FormControl, + IconButton, InputLabel, MenuItem, Select, SelectChangeEvent, Skeleton, + Tooltip, } from "@mui/material"; +import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; import { MAIN_BRANCH, SHA_DISPLAY_LENGTH } from "components/benchmark/common"; import dayjs from "dayjs"; import { fetcher } from "lib/GeneralUtils"; +import { set } from "lodash"; import { useEffect } from "react"; import useSWR from "swr"; @@ -20,6 +24,52 @@ import useSWR from "swr"; export const COMMIT_TO_WORKFLOW_ID: { [k: string]: number } = {}; export const WORKFLOW_ID_TO_COMMIT: { [k: number]: string } = {}; +interface Commit { + head_sha: string; + event_time: number; + display_priority: number; + filenames: string[]; + id: number; +} + +interface HighlightMenuItemProps extends React.ComponentProps{ + condition: boolean; +} + +function isCommitHighlightItem(commit:string,commits: any[],filenameFilter:string|undefined){ + const matchedCommits = commits.filter((c:Commit) => c.head_sha === commit); + if (matchedCommits.length === 0) { + return false; + } + return isHighlight(filenameFilter,matchedCommits[0]); +} + +const HighlightMenuItem = ({ condition, children, ...props }: HighlightMenuItemProps) => { + const highlightStyle = { + backgroundColor: 'yellow', + }; + return ( + + {children} + + ); +}; + +function isHighlight(filenameFilter: string | undefined, commit: any) { + if (filenameFilter === undefined || filenameFilter == "all") { + return false; + } + const found = commit.filenames.filter((f: string) => f.includes(filenameFilter)); + + + return found.length > 0; + +} function filterCommitsByFilename(commits: any[], filenameFilter: string|undefined) { if (filenameFilter === undefined || filenameFilter == "all") { @@ -108,29 +158,25 @@ export function BranchAndCommitPicker({ // Fallback to the main branch or the first available branch found in result setBranch(branch); } - - const resultCommits =filterCommitsByFilename(branches[branch],filenameFilter); - const branchCommits = resultCommits.map((r: any) => r.head_sha); + const branchCommits = branches[branch].map((r: any) => r.head_sha); if ( commit === undefined || commit === "" || - !resultCommits.includes(commit) || + !branchCommits.includes(commit) || timeRange !== -1 ) { const index = - setCommit(branchCommits.length + fallbackIndex) % branchCommits.length; - (branchCommits[index]); + (branchCommits.length + fallbackIndex) % branchCommits.length; + setCommit(branchCommits[index]); } - console.log("BranchAndCommitPicker", branch, commit); - data.forEach((r: any) => { COMMIT_TO_WORKFLOW_ID[r.head_sha] = r.id; WORKFLOW_ID_TO_COMMIT[r.id] = r.head_sha; }); } - }, [data,filenameFilter]); + }, [data]); if (error !== undefined) { return ( @@ -166,12 +212,6 @@ export function BranchAndCommitPicker({ const displayBranches = Object.keys(branches).sort( (x, y) => branches[y][0].display_priority - branches[x][0].display_priority ); - - const resultCommits = filterCommitsByFilename(branches[branch],filenameFilter); - - console.log("BranchAndCommitPicker2", branch, commit,filenameFilter); - - return (
@@ -192,7 +232,7 @@ export function BranchAndCommitPicker({ ))} - {resultCommits.length > 0 && + {titlePrefix} Commit @@ -202,16 +242,20 @@ export function BranchAndCommitPicker({ labelId={`commit-picker-select-label-${commit}`} onChange={handleCommitChange} id={`commit-picker-select-${commit}`} + sx={{...(isCommitHighlightItem(commit,branches[branch],filenameFilter) && { backgroundColor: 'yellow' })}} > - {resultCommits.map((r: any) => ( - + {branches[branch].map((r: any) => ( + {r.head_sha.substring(0, SHA_DISPLAY_LENGTH)} ( {dayjs(r.event_time).format("YYYY/MM/DD")}) - + {isHighlight(filenameFilter,r) && + + + } + ))} - }
); } diff --git a/torchci/components/benchmark/compilers/common.tsx b/torchci/components/benchmark/compilers/common.tsx index f498bd2aba..7f8169f03b 100644 --- a/torchci/components/benchmark/compilers/common.tsx +++ b/torchci/components/benchmark/compilers/common.tsx @@ -77,9 +77,8 @@ export const DISPLAY_NAMES_TO_WORKFLOW_NAMES: { [k: string]: string } = { mps: "inductor-perf-nightly-macos", }; -export const DEFAULT_FILTER_NAME = "all"; - +export const DEFAULT_FILTER_NAME = "unselected"; export const DISPLAY_NAMES_TO_FILTER: { [k: string]: string } = { - "All": DEFAULT_FILTER_NAME, + "Unselected": DEFAULT_FILTER_NAME, "Max_autotune": "max_autotune", }; diff --git a/torchci/pages/benchmark/compilers.tsx b/torchci/pages/benchmark/compilers.tsx index 1331b7c52a..fbdd27ef79 100644 --- a/torchci/pages/benchmark/compilers.tsx +++ b/torchci/pages/benchmark/compilers.tsx @@ -19,7 +19,6 @@ import CompilerGraphGroup from "components/benchmark/compilers/CompilerGraphGrou import { SUITES } from "components/benchmark/compilers/SuitePicker"; import { SummaryPanel } from "components/benchmark/compilers/SummaryPanel"; import { - FilterPicker, DEFAULT_MODE, DTypePicker, ModePicker, @@ -313,7 +312,7 @@ export default function Page() { dtype={filter} setDType={setFilter} dtypes={Object.values(DISPLAY_NAMES_TO_FILTER)} - label={"Filter"} + label={"Highlight"} /> Date: Tue, 28 Jan 2025 13:57:26 -0800 Subject: [PATCH 03/11] test --- .../benchmark/BranchAndCommitPicker.tsx | 58 ++----------------- torchci/components/benchmark/CommitPanel.tsx | 3 - .../benchmark/compilers/HighlightMenu.tsx | 39 +++++++++++++ .../benchmark/compilers/SummaryPanel.tsx | 1 - .../[suite]/[compiler]/[[...page]].tsx | 10 +--- torchci/pages/benchmark/compilers.tsx | 5 -- 6 files changed, 47 insertions(+), 69 deletions(-) create mode 100644 torchci/components/benchmark/compilers/HighlightMenu.tsx diff --git a/torchci/components/benchmark/BranchAndCommitPicker.tsx b/torchci/components/benchmark/BranchAndCommitPicker.tsx index 36361a4bbc..31623f6d5a 100644 --- a/torchci/components/benchmark/BranchAndCommitPicker.tsx +++ b/torchci/components/benchmark/BranchAndCommitPicker.tsx @@ -12,9 +12,9 @@ import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; import { MAIN_BRANCH, SHA_DISPLAY_LENGTH } from "components/benchmark/common"; import dayjs from "dayjs"; import { fetcher } from "lib/GeneralUtils"; -import { set } from "lodash"; import { useEffect } from "react"; import useSWR from "swr"; +import { HighlightMenuItem, isCommitHighlight, isCommitStringHighlight } from "./compilers/HighlightMenu"; // Keep the mapping from workflow ID to commit, so that we can use it to // zoom in and out of the graph. NB: this is to avoid sending commit sha @@ -24,53 +24,6 @@ import useSWR from "swr"; export const COMMIT_TO_WORKFLOW_ID: { [k: string]: number } = {}; export const WORKFLOW_ID_TO_COMMIT: { [k: number]: string } = {}; -interface Commit { - head_sha: string; - event_time: number; - display_priority: number; - filenames: string[]; - id: number; -} - -interface HighlightMenuItemProps extends React.ComponentProps{ - condition: boolean; -} - -function isCommitHighlightItem(commit:string,commits: any[],filenameFilter:string|undefined){ - const matchedCommits = commits.filter((c:Commit) => c.head_sha === commit); - if (matchedCommits.length === 0) { - return false; - } - return isHighlight(filenameFilter,matchedCommits[0]); -} - -const HighlightMenuItem = ({ condition, children, ...props }: HighlightMenuItemProps) => { - const highlightStyle = { - backgroundColor: 'yellow', - }; - return ( - - {children} - - ); -}; - -function isHighlight(filenameFilter: string | undefined, commit: any) { - if (filenameFilter === undefined || filenameFilter == "all") { - return false; - } - const found = commit.filenames.filter((f: string) => f.includes(filenameFilter)); - - - return found.length > 0; - -} - function filterCommitsByFilename(commits: any[], filenameFilter: string|undefined) { if (filenameFilter === undefined || filenameFilter == "all") { return commits; @@ -84,7 +37,6 @@ function filterCommitsByFilename(commits: any[], filenameFilter: string|undefine } function groupCommitByBranch(data: any) { - const dedups: { [k: string]: Set } = {}; const branches: { [k: string]: any[] } = {}; @@ -96,7 +48,7 @@ function groupCommitByBranch(data: any) { } if (dedups[b].has(r.head_sha)) { - branches[b].find((c: any) => c.head_sha === r.head_sha).filenames.push(r.filename); + branches[b]?.find((c: any) => c.head_sha === r.head_sha).filenames.push(r.filename); return; } @@ -242,13 +194,13 @@ export function BranchAndCommitPicker({ labelId={`commit-picker-select-label-${commit}`} onChange={handleCommitChange} id={`commit-picker-select-${commit}`} - sx={{...(isCommitHighlightItem(commit,branches[branch],filenameFilter) && { backgroundColor: 'yellow' })}} + sx={{...(isCommitStringHighlight(commit,branches[branch],filenameFilter) && { backgroundColor: 'yellow' })}} > {branches[branch].map((r: any) => ( - + {r.head_sha.substring(0, SHA_DISPLAY_LENGTH)} ( {dayjs(r.event_time).format("YYYY/MM/DD")}) - {isHighlight(filenameFilter,r) && + {isCommitHighlight(filenameFilter,r) && } diff --git a/torchci/components/benchmark/CommitPanel.tsx b/torchci/components/benchmark/CommitPanel.tsx index 0ee7ef5aa6..e48da70470 100644 --- a/torchci/components/benchmark/CommitPanel.tsx +++ b/torchci/components/benchmark/CommitPanel.tsx @@ -16,9 +16,6 @@ export function CommitPanel({ workflowName: string; children: ReactNode; }) { - if (!lBranchAndCommit.commit || !rBranchAndCommit.commit) { - return <> No commits are selected ; - } return ( diff --git a/torchci/components/benchmark/compilers/HighlightMenu.tsx b/torchci/components/benchmark/compilers/HighlightMenu.tsx new file mode 100644 index 0000000000..cb35f49d77 --- /dev/null +++ b/torchci/components/benchmark/compilers/HighlightMenu.tsx @@ -0,0 +1,39 @@ +import { MenuItem } from "@mui/material"; +import { match } from "assert"; + +interface HighlightMenuItemProps extends React.ComponentProps{ + condition: boolean; + customColor?: string; + } + +export const HighlightMenuItem = ({ condition, children, customColor = 'yellow', ...props }: HighlightMenuItemProps) => { + const highlightStyle = { + backgroundColor: customColor, + }; + return ( + + {children} + + ); + }; + + export function isCommitStringHighlight(commit:string,commits: any[],filenameFilter:string|undefined){ + const matchedCommit = commits.find((c:any) => c.head_sha === commit); + if (!matchedCommit) { + return false; + } + return isCommitHighlight(filenameFilter,matchedCommit); + } + + export function isCommitHighlight(filenameFilter: string | undefined, commit: any) { + if (filenameFilter === undefined || filenameFilter == "all") { + return false; + } + const found = commit.filenames.filter((f: string) => f.includes(filenameFilter)); + return found.length > 0; +} diff --git a/torchci/components/benchmark/compilers/SummaryPanel.tsx b/torchci/components/benchmark/compilers/SummaryPanel.tsx index 1d2e8287b2..6cd93eff46 100644 --- a/torchci/components/benchmark/compilers/SummaryPanel.tsx +++ b/torchci/components/benchmark/compilers/SummaryPanel.tsx @@ -251,7 +251,6 @@ export function SummaryPanel({ const l = extractPercentage(v.l); const r = extractPercentage(v.r); - if (l === undefined) { return ""; } diff --git a/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx b/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx index fed9ea6c04..b7840b74b6 100644 --- a/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx +++ b/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx @@ -117,8 +117,6 @@ function Report({ return ; } - console.log(lBranchAndCommit, rBranchAndCommit) - return (
@@ -398,7 +395,7 @@ export default function Page() { - {lCommit && rCommit && } - {lCommit.length==0 || rCommit.length === 0 &&
cannot detect commits to compare
} + />
); diff --git a/torchci/pages/benchmark/compilers.tsx b/torchci/pages/benchmark/compilers.tsx index fbdd27ef79..18f02b1ea0 100644 --- a/torchci/pages/benchmark/compilers.tsx +++ b/torchci/pages/benchmark/compilers.tsx @@ -58,10 +58,6 @@ function Report({ lBranchAndCommit: BranchAndCommit; rBranchAndCommit: BranchAndCommit; }) { - if (!lBranchAndCommit.commit || !rBranchAndCommit.commit) { - return ; - } - const queryName = "compilers_benchmark_performance"; const queryParamsWithL: { [key: string]: any } = { ...queryParams, @@ -122,7 +118,6 @@ function Report({ > -
I'm here
Date: Tue, 28 Jan 2025 14:13:54 -0800 Subject: [PATCH 04/11] test --- .../benchmark/BranchAndCommitPicker.tsx | 27 +++++++------------ .../benchmark/compilers/HighlightMenu.tsx | 8 +++--- torchci/pages/benchmark/compilers.tsx | 13 +++++++-- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/torchci/components/benchmark/BranchAndCommitPicker.tsx b/torchci/components/benchmark/BranchAndCommitPicker.tsx index 31623f6d5a..918a42f1ab 100644 --- a/torchci/components/benchmark/BranchAndCommitPicker.tsx +++ b/torchci/components/benchmark/BranchAndCommitPicker.tsx @@ -14,7 +14,7 @@ import dayjs from "dayjs"; import { fetcher } from "lib/GeneralUtils"; import { useEffect } from "react"; import useSWR from "swr"; -import { HighlightMenuItem, isCommitHighlight, isCommitStringHighlight } from "./compilers/HighlightMenu"; +import { DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, HighlightMenuItem, isCommitHighlight, isCommitStringHighlight } from "./compilers/HighlightMenu"; // Keep the mapping from workflow ID to commit, so that we can use it to // zoom in and out of the graph. NB: this is to avoid sending commit sha @@ -24,16 +24,9 @@ import { HighlightMenuItem, isCommitHighlight, isCommitStringHighlight } from ". export const COMMIT_TO_WORKFLOW_ID: { [k: string]: number } = {}; export const WORKFLOW_ID_TO_COMMIT: { [k: number]: string } = {}; -function filterCommitsByFilename(commits: any[], filenameFilter: string|undefined) { - if (filenameFilter === undefined || filenameFilter == "all") { - return commits; - } - - const filteredCommits = commits.filter((r:any)=>{ - const found = r.filenames.filter((f: string) => f.includes(filenameFilter)); - return found.length > 0; - }) - return filteredCommits; +interface HighlightConfig { + key?: string; + highlightColor?: string; } function groupCommitByBranch(data: any) { @@ -77,7 +70,7 @@ export function BranchAndCommitPicker({ titlePrefix, fallbackIndex, timeRange, - filenameFilter, + highlightConfig }: { queryName: string; queryParams: { [k: string]: any }; @@ -88,7 +81,7 @@ export function BranchAndCommitPicker({ titlePrefix: string; fallbackIndex: number; timeRange: any; - filenameFilter?: string; + highlightConfig?: HighlightConfig; }) { const url = `/api/clickhouse/${queryName}?parameters=${encodeURIComponent( JSON.stringify(queryParams) @@ -194,14 +187,14 @@ export function BranchAndCommitPicker({ labelId={`commit-picker-select-label-${commit}`} onChange={handleCommitChange} id={`commit-picker-select-${commit}`} - sx={{...(isCommitStringHighlight(commit,branches[branch],filenameFilter) && { backgroundColor: 'yellow' })}} + sx={{...(isCommitStringHighlight(commit,branches[branch],highlightConfig?.key) && { backgroundColor: DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR })}} > {branches[branch].map((r: any) => ( - + {r.head_sha.substring(0, SHA_DISPLAY_LENGTH)} ( {dayjs(r.event_time).format("YYYY/MM/DD")}) - {isCommitHighlight(filenameFilter,r) && - + {isCommitHighlight(highlightConfig?.key,r) && + } diff --git a/torchci/components/benchmark/compilers/HighlightMenu.tsx b/torchci/components/benchmark/compilers/HighlightMenu.tsx index cb35f49d77..f5659a783d 100644 --- a/torchci/components/benchmark/compilers/HighlightMenu.tsx +++ b/torchci/components/benchmark/compilers/HighlightMenu.tsx @@ -1,4 +1,4 @@ -import { MenuItem } from "@mui/material"; +import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; import { match } from "assert"; interface HighlightMenuItemProps extends React.ComponentProps{ @@ -6,9 +6,11 @@ interface HighlightMenuItemProps extends React.ComponentProps{ customColor?: string; } -export const HighlightMenuItem = ({ condition, children, customColor = 'yellow', ...props }: HighlightMenuItemProps) => { +export const DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR = 'yellow'; + +export const HighlightMenuItem = ({ condition, children, customColor = DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, ...props }: HighlightMenuItemProps) => { const highlightStyle = { - backgroundColor: customColor, + backgroundColor: customColor?customColor:DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, }; return ( —Diff→ @@ -334,7 +340,10 @@ export default function Page() { titlePrefix={"New"} fallbackIndex={0} // Default to the latest commit timeRange={timeRange} - filenameFilter= {filter} + highlightConfig= {{ + key:filter, + highlightColor:"yellow" + }} />
Date: Tue, 28 Jan 2025 14:17:33 -0800 Subject: [PATCH 05/11] test --- .../benchmark/BranchAndCommitPicker.tsx | 40 ++++++--- .../benchmark/compilers/HighlightMenu.tsx | 81 +++++++++++-------- .../components/benchmark/compilers/common.tsx | 4 +- .../[suite]/[compiler]/[[...page]].tsx | 1 - torchci/pages/benchmark/compilers.tsx | 21 +++-- 5 files changed, 88 insertions(+), 59 deletions(-) diff --git a/torchci/components/benchmark/BranchAndCommitPicker.tsx b/torchci/components/benchmark/BranchAndCommitPicker.tsx index 918a42f1ab..d4f8edc19a 100644 --- a/torchci/components/benchmark/BranchAndCommitPicker.tsx +++ b/torchci/components/benchmark/BranchAndCommitPicker.tsx @@ -1,6 +1,6 @@ +import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; import { FormControl, - IconButton, InputLabel, MenuItem, Select, @@ -8,13 +8,17 @@ import { Skeleton, Tooltip, } from "@mui/material"; -import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; import { MAIN_BRANCH, SHA_DISPLAY_LENGTH } from "components/benchmark/common"; import dayjs from "dayjs"; import { fetcher } from "lib/GeneralUtils"; import { useEffect } from "react"; import useSWR from "swr"; -import { DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, HighlightMenuItem, isCommitHighlight, isCommitStringHighlight } from "./compilers/HighlightMenu"; +import { + DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, + HighlightMenuItem, + isCommitHighlight, + isCommitStringHighlight, +} from "./compilers/HighlightMenu"; // Keep the mapping from workflow ID to commit, so that we can use it to // zoom in and out of the graph. NB: this is to avoid sending commit sha @@ -41,7 +45,9 @@ function groupCommitByBranch(data: any) { } if (dedups[b].has(r.head_sha)) { - branches[b]?.find((c: any) => c.head_sha === r.head_sha).filenames.push(r.filename); + branches[b] + ?.find((c: any) => c.head_sha === r.head_sha) + .filenames.push(r.filename); return; } @@ -70,7 +76,7 @@ export function BranchAndCommitPicker({ titlePrefix, fallbackIndex, timeRange, - highlightConfig + highlightConfig, }: { queryName: string; queryParams: { [k: string]: any }; @@ -187,16 +193,28 @@ export function BranchAndCommitPicker({ labelId={`commit-picker-select-label-${commit}`} onChange={handleCommitChange} id={`commit-picker-select-${commit}`} - sx={{...(isCommitStringHighlight(commit,branches[branch],highlightConfig?.key) && { backgroundColor: DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR })}} + sx={{ + ...(isCommitStringHighlight( + commit, + branches[branch], + highlightConfig?.key + ) && { backgroundColor: DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR }), + }} > {branches[branch].map((r: any) => ( - + {r.head_sha.substring(0, SHA_DISPLAY_LENGTH)} ( {dayjs(r.event_time).format("YYYY/MM/DD")}) - {isCommitHighlight(highlightConfig?.key,r) && - - - } + {isCommitHighlight(highlightConfig?.key, r) && ( + + + + )} ))} diff --git a/torchci/components/benchmark/compilers/HighlightMenu.tsx b/torchci/components/benchmark/compilers/HighlightMenu.tsx index f5659a783d..361d51d4d1 100644 --- a/torchci/components/benchmark/compilers/HighlightMenu.tsx +++ b/torchci/components/benchmark/compilers/HighlightMenu.tsx @@ -1,41 +1,56 @@ -import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; -import { match } from "assert"; +import { MenuItem } from "@mui/material"; -interface HighlightMenuItemProps extends React.ComponentProps{ - condition: boolean; - customColor?: string; - } +interface HighlightMenuItemProps extends React.ComponentProps { + condition: boolean; + customColor?: string; +} -export const DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR = 'yellow'; +export const DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR = "yellow"; -export const HighlightMenuItem = ({ condition, children, customColor = DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, ...props }: HighlightMenuItemProps) => { - const highlightStyle = { - backgroundColor: customColor?customColor:DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, - }; - return ( - - {children} - - ); +export const HighlightMenuItem = ({ + condition, + children, + customColor = DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, + ...props +}: HighlightMenuItemProps) => { + const highlightStyle = { + backgroundColor: customColor + ? customColor + : DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, }; + return ( + + {children} + + ); +}; - export function isCommitStringHighlight(commit:string,commits: any[],filenameFilter:string|undefined){ - const matchedCommit = commits.find((c:any) => c.head_sha === commit); - if (!matchedCommit) { - return false; - } - return isCommitHighlight(filenameFilter,matchedCommit); +export function isCommitStringHighlight( + commit: string, + commits: any[], + filenameFilter: string | undefined +) { + const matchedCommit = commits.find((c: any) => c.head_sha === commit); + if (!matchedCommit) { + return false; } + return isCommitHighlight(filenameFilter, matchedCommit); +} - export function isCommitHighlight(filenameFilter: string | undefined, commit: any) { - if (filenameFilter === undefined || filenameFilter == "all") { - return false; - } - const found = commit.filenames.filter((f: string) => f.includes(filenameFilter)); - return found.length > 0; +export function isCommitHighlight( + filenameFilter: string | undefined, + commit: any +) { + if (filenameFilter === undefined || filenameFilter == "all") { + return false; + } + const found = commit.filenames.filter((f: string) => + f.includes(filenameFilter) + ); + return found.length > 0; } diff --git a/torchci/components/benchmark/compilers/common.tsx b/torchci/components/benchmark/compilers/common.tsx index 7f8169f03b..75cffe1ffd 100644 --- a/torchci/components/benchmark/compilers/common.tsx +++ b/torchci/components/benchmark/compilers/common.tsx @@ -79,6 +79,6 @@ export const DISPLAY_NAMES_TO_WORKFLOW_NAMES: { [k: string]: string } = { export const DEFAULT_FILTER_NAME = "unselected"; export const DISPLAY_NAMES_TO_FILTER: { [k: string]: string } = { - "Unselected": DEFAULT_FILTER_NAME, - "Max_autotune": "max_autotune", + Unselected: DEFAULT_FILTER_NAME, + Max_autotune: "max_autotune", }; diff --git a/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx b/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx index b7840b74b6..2c12755caa 100644 --- a/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx +++ b/torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx @@ -393,7 +393,6 @@ export default function Page() { /> - —Diff→ @@ -340,9 +337,9 @@ export default function Page() { titlePrefix={"New"} fallbackIndex={0} // Default to the latest commit timeRange={timeRange} - highlightConfig= {{ - key:filter, - highlightColor:"yellow" + highlightConfig={{ + key: filter, + highlightColor: "yellow", }} /> From 3058dc00107ff42374e5e87ec821b679dcc03d66 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Tue, 28 Jan 2025 14:27:56 -0800 Subject: [PATCH 06/11] test --- .../components/benchmark/compilers/common.tsx | 6 +++--- torchci/pages/benchmark/compilers.tsx | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/torchci/components/benchmark/compilers/common.tsx b/torchci/components/benchmark/compilers/common.tsx index 75cffe1ffd..b49d1eb0b5 100644 --- a/torchci/components/benchmark/compilers/common.tsx +++ b/torchci/components/benchmark/compilers/common.tsx @@ -77,8 +77,8 @@ export const DISPLAY_NAMES_TO_WORKFLOW_NAMES: { [k: string]: string } = { mps: "inductor-perf-nightly-macos", }; -export const DEFAULT_FILTER_NAME = "unselected"; -export const DISPLAY_NAMES_TO_FILTER: { [k: string]: string } = { - Unselected: DEFAULT_FILTER_NAME, +export const DEFAULT_HIGHLIGHT_KEY = "unselected"; +export const DISPLAY_KEYS_TO_HIGHLIGHT: { [k: string]: string } = { + Unselected: DEFAULT_HIGHLIGHT_KEY, Max_autotune: "max_autotune", }; diff --git a/torchci/pages/benchmark/compilers.tsx b/torchci/pages/benchmark/compilers.tsx index 8939a30948..519ca9c1ab 100644 --- a/torchci/pages/benchmark/compilers.tsx +++ b/torchci/pages/benchmark/compilers.tsx @@ -9,9 +9,9 @@ import { import { BenchmarkLogs } from "components/benchmark/compilers/BenchmarkLogs"; import { DEFAULT_DEVICE_NAME, - DEFAULT_FILTER_NAME, + DEFAULT_HIGHLIGHT_KEY, + DISPLAY_KEYS_TO_HIGHLIGHT, DISPLAY_NAMES_TO_DEVICE_NAMES, - DISPLAY_NAMES_TO_FILTER, DISPLAY_NAMES_TO_WORKFLOW_NAMES, DTYPES, } from "components/benchmark/compilers/common"; @@ -174,7 +174,9 @@ export default function Page() { const [rCommit, setRCommit] = useState(""); const [baseUrl, setBaseUrl] = useState(""); const [deviceName, setDeviceName] = useState(DEFAULT_DEVICE_NAME); - const [filter, setFilter] = useState(DEFAULT_FILTER_NAME); + const [highlightKey, setHighlightKey] = useState( + DEFAULT_HIGHLIGHT_KEY + ); // Set the dropdown value what is in the param useEffect(() => { @@ -304,9 +306,9 @@ export default function Page() { label={"Device"} /> @@ -338,7 +340,7 @@ export default function Page() { fallbackIndex={0} // Default to the latest commit timeRange={timeRange} highlightConfig={{ - key: filter, + key: highlightKey, highlightColor: "yellow", }} /> From a12605c4ea0e0eb4513d5e078bba03ffc69c9884 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Tue, 28 Jan 2025 14:28:17 -0800 Subject: [PATCH 07/11] test --- torchci/components/benchmark/BranchAndCommitPicker.tsx | 2 +- torchci/components/benchmark/{compilers => }/HighlightMenu.tsx | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename torchci/components/benchmark/{compilers => }/HighlightMenu.tsx (100%) diff --git a/torchci/components/benchmark/BranchAndCommitPicker.tsx b/torchci/components/benchmark/BranchAndCommitPicker.tsx index d4f8edc19a..51f058e70f 100644 --- a/torchci/components/benchmark/BranchAndCommitPicker.tsx +++ b/torchci/components/benchmark/BranchAndCommitPicker.tsx @@ -18,7 +18,7 @@ import { HighlightMenuItem, isCommitHighlight, isCommitStringHighlight, -} from "./compilers/HighlightMenu"; +} from "./HighlightMenu"; // Keep the mapping from workflow ID to commit, so that we can use it to // zoom in and out of the graph. NB: this is to avoid sending commit sha diff --git a/torchci/components/benchmark/compilers/HighlightMenu.tsx b/torchci/components/benchmark/HighlightMenu.tsx similarity index 100% rename from torchci/components/benchmark/compilers/HighlightMenu.tsx rename to torchci/components/benchmark/HighlightMenu.tsx From 4b29734b13c709827efe77f55805260a7b4fa03e Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Tue, 28 Jan 2025 15:19:52 -0800 Subject: [PATCH 08/11] test --- .../components/benchmark/BranchAndCommitPicker.tsx | 13 +++++++------ torchci/components/benchmark/compilers/common.tsx | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/torchci/components/benchmark/BranchAndCommitPicker.tsx b/torchci/components/benchmark/BranchAndCommitPicker.tsx index 51f058e70f..6db426f564 100644 --- a/torchci/components/benchmark/BranchAndCommitPicker.tsx +++ b/torchci/components/benchmark/BranchAndCommitPicker.tsx @@ -45,9 +45,11 @@ function groupCommitByBranch(data: any) { } if (dedups[b].has(r.head_sha)) { - branches[b] - ?.find((c: any) => c.head_sha === r.head_sha) - .filenames.push(r.filename); + if (r.filename) { + branches[b] + ?.find((c: any) => c.head_sha === r.head_sha) + .filenames.push(r.filename); + } return; } @@ -56,13 +58,12 @@ function groupCommitByBranch(data: any) { event_time: r.event_time, // This is used to sort the list of branches to show the main branch first display_priority: r.head_branch === MAIN_BRANCH ? 99 : 1, - // store list of config files for the commit, this is used to filter out tags - filenames: [r.filename], + // store list of config files for the commit, this is used to highlight + filenames: r.filename ? [r.filename] : [], id: r.id, }); dedups[b].add(r.head_sha); }); - return branches; } diff --git a/torchci/components/benchmark/compilers/common.tsx b/torchci/components/benchmark/compilers/common.tsx index b49d1eb0b5..82df1128b9 100644 --- a/torchci/components/benchmark/compilers/common.tsx +++ b/torchci/components/benchmark/compilers/common.tsx @@ -77,8 +77,8 @@ export const DISPLAY_NAMES_TO_WORKFLOW_NAMES: { [k: string]: string } = { mps: "inductor-perf-nightly-macos", }; -export const DEFAULT_HIGHLIGHT_KEY = "unselected"; +export const DEFAULT_HIGHLIGHT_KEY = "none"; export const DISPLAY_KEYS_TO_HIGHLIGHT: { [k: string]: string } = { - Unselected: DEFAULT_HIGHLIGHT_KEY, + None: DEFAULT_HIGHLIGHT_KEY, Max_autotune: "max_autotune", }; From 71e9327fa9bb998377db7fe8d6d184e6ea1a6084 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Tue, 28 Jan 2025 16:04:44 -0800 Subject: [PATCH 09/11] test --- .../benchmark/BranchAndCommitPicker.tsx | 14 +++--- .../components/benchmark/HighlightMenu.tsx | 45 +++++++++++++++---- .../components/benchmark/compilers/common.tsx | 6 --- torchci/pages/benchmark/compilers.tsx | 25 +++-------- 4 files changed, 52 insertions(+), 38 deletions(-) diff --git a/torchci/components/benchmark/BranchAndCommitPicker.tsx b/torchci/components/benchmark/BranchAndCommitPicker.tsx index 6db426f564..a819c78aa2 100644 --- a/torchci/components/benchmark/BranchAndCommitPicker.tsx +++ b/torchci/components/benchmark/BranchAndCommitPicker.tsx @@ -15,6 +15,7 @@ import { useEffect } from "react"; import useSWR from "swr"; import { DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, + getMatchedFilters, HighlightMenuItem, isCommitHighlight, isCommitStringHighlight, @@ -29,7 +30,7 @@ export const COMMIT_TO_WORKFLOW_ID: { [k: string]: number } = {}; export const WORKFLOW_ID_TO_COMMIT: { [k: number]: string } = {}; interface HighlightConfig { - key?: string; + keys?: string[]; highlightColor?: string; } @@ -198,7 +199,7 @@ export function BranchAndCommitPicker({ ...(isCommitStringHighlight( commit, branches[branch], - highlightConfig?.key + highlightConfig?.keys ) && { backgroundColor: DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR }), }} > @@ -206,13 +207,16 @@ export function BranchAndCommitPicker({ {r.head_sha.substring(0, SHA_DISPLAY_LENGTH)} ( {dayjs(r.event_time).format("YYYY/MM/DD")}) - {isCommitHighlight(highlightConfig?.key, r) && ( - + {isCommitHighlight(highlightConfig?.keys, r) && ( + )} diff --git a/torchci/components/benchmark/HighlightMenu.tsx b/torchci/components/benchmark/HighlightMenu.tsx index 361d51d4d1..cdebc44738 100644 --- a/torchci/components/benchmark/HighlightMenu.tsx +++ b/torchci/components/benchmark/HighlightMenu.tsx @@ -33,24 +33,53 @@ export const HighlightMenuItem = ({ export function isCommitStringHighlight( commit: string, commits: any[], - filenameFilter: string | undefined + filenameFilterList: string[] | undefined ) { const matchedCommit = commits.find((c: any) => c.head_sha === commit); if (!matchedCommit) { return false; } - return isCommitHighlight(filenameFilter, matchedCommit); + return isCommitHighlight(filenameFilterList, matchedCommit); } export function isCommitHighlight( - filenameFilter: string | undefined, + filenameFilterList: string[] | undefined, commit: any ) { - if (filenameFilter === undefined || filenameFilter == "all") { + if (filenameFilterList === undefined || filenameFilterList.length == 0) { return false; } - const found = commit.filenames.filter((f: string) => - f.includes(filenameFilter) - ); - return found.length > 0; + + if (!commit || !commit.filenames) { + return false; + } + return isStringMatchedAll(filenameFilterList, commit.filenames.join(",")); +} + +export function getMatchedFilters( + filenameFilterList: string[] | undefined, + commit: any +) { + if (filenameFilterList === undefined || filenameFilterList.length == 0) { + return []; + } + + if (!commit || !commit.filenames) { + return []; + } + return getMatchedList(commit.filenames.join(","), filenameFilterList); +} + +function getMatchedList(text: string, substrings: string[]): string[] { + let matched = []; + for (const substring of substrings) { + if (text.includes(substring)) { + matched.push(substring); + } + } + return matched; +} + +function isStringMatchedAll(substrings: string[], text: string) { + return substrings.every((substring) => text.includes(substring)); } diff --git a/torchci/components/benchmark/compilers/common.tsx b/torchci/components/benchmark/compilers/common.tsx index 82df1128b9..d76828b05a 100644 --- a/torchci/components/benchmark/compilers/common.tsx +++ b/torchci/components/benchmark/compilers/common.tsx @@ -76,9 +76,3 @@ export const DISPLAY_NAMES_TO_WORKFLOW_NAMES: { [k: string]: string } = { rocm: "inductor-perf-nightly-rocm", mps: "inductor-perf-nightly-macos", }; - -export const DEFAULT_HIGHLIGHT_KEY = "none"; -export const DISPLAY_KEYS_TO_HIGHLIGHT: { [k: string]: string } = { - None: DEFAULT_HIGHLIGHT_KEY, - Max_autotune: "max_autotune", -}; diff --git a/torchci/pages/benchmark/compilers.tsx b/torchci/pages/benchmark/compilers.tsx index 519ca9c1ab..87d6b6927f 100644 --- a/torchci/pages/benchmark/compilers.tsx +++ b/torchci/pages/benchmark/compilers.tsx @@ -9,8 +9,6 @@ import { import { BenchmarkLogs } from "components/benchmark/compilers/BenchmarkLogs"; import { DEFAULT_DEVICE_NAME, - DEFAULT_HIGHLIGHT_KEY, - DISPLAY_KEYS_TO_HIGHLIGHT, DISPLAY_NAMES_TO_DEVICE_NAMES, DISPLAY_NAMES_TO_WORKFLOW_NAMES, DTYPES, @@ -36,6 +34,10 @@ import { useEffect, useState } from "react"; import useSWR from "swr"; import { COMPILER_SUITES_MAP } from "../../lib/benchmark/compliers/CompilerSuites"; import { TimeRangePicker } from "../metrics"; +const HardCodedHightlightConfig = { + keys: ["max_autotune"], + highlightColor: "yellow", +}; function Report({ queryParams, @@ -174,9 +176,6 @@ export default function Page() { const [rCommit, setRCommit] = useState(""); const [baseUrl, setBaseUrl] = useState(""); const [deviceName, setDeviceName] = useState(DEFAULT_DEVICE_NAME); - const [highlightKey, setHighlightKey] = useState( - DEFAULT_HIGHLIGHT_KEY - ); // Set the dropdown value what is in the param useEffect(() => { @@ -305,12 +304,6 @@ export default function Page() { dtypes={Object.keys(DISPLAY_NAMES_TO_DEVICE_NAMES)} label={"Device"} /> - —Diff→ @@ -339,10 +329,7 @@ export default function Page() { titlePrefix={"New"} fallbackIndex={0} // Default to the latest commit timeRange={timeRange} - highlightConfig={{ - key: highlightKey, - highlightColor: "yellow", - }} + highlightConfig={HardCodedHightlightConfig} /> Date: Tue, 28 Jan 2025 16:17:41 -0800 Subject: [PATCH 10/11] test --- .../components/benchmark/HighlightMenu.tsx | 12 +++++++++++ .../components/benchmark/compilers/common.tsx | 6 ++++++ torchci/pages/benchmark/compilers.tsx | 20 +++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/torchci/components/benchmark/HighlightMenu.tsx b/torchci/components/benchmark/HighlightMenu.tsx index cdebc44738..f39d2ff1df 100644 --- a/torchci/components/benchmark/HighlightMenu.tsx +++ b/torchci/components/benchmark/HighlightMenu.tsx @@ -42,6 +42,12 @@ export function isCommitStringHighlight( return isCommitHighlight(filenameFilterList, matchedCommit); } +/** + * isCommitHighlight returns true if the commit's filenames list contains all filter names from filenameFilterList. + * @param filenameFilterList + * @param commit + * @returns + */ export function isCommitHighlight( filenameFilterList: string[] | undefined, commit: any @@ -56,6 +62,12 @@ export function isCommitHighlight( return isStringMatchedAll(filenameFilterList, commit.filenames.join(",")); } +/** + * getMatchedFilters return all matched filtername in commit.filename list. + * @param filenameFilterList + * @param commit + * @returns + */ export function getMatchedFilters( filenameFilterList: string[] | undefined, commit: any diff --git a/torchci/components/benchmark/compilers/common.tsx b/torchci/components/benchmark/compilers/common.tsx index d76828b05a..82df1128b9 100644 --- a/torchci/components/benchmark/compilers/common.tsx +++ b/torchci/components/benchmark/compilers/common.tsx @@ -76,3 +76,9 @@ export const DISPLAY_NAMES_TO_WORKFLOW_NAMES: { [k: string]: string } = { rocm: "inductor-perf-nightly-rocm", mps: "inductor-perf-nightly-macos", }; + +export const DEFAULT_HIGHLIGHT_KEY = "none"; +export const DISPLAY_KEYS_TO_HIGHLIGHT: { [k: string]: string } = { + None: DEFAULT_HIGHLIGHT_KEY, + Max_autotune: "max_autotune", +}; diff --git a/torchci/pages/benchmark/compilers.tsx b/torchci/pages/benchmark/compilers.tsx index 87d6b6927f..fd96cc7845 100644 --- a/torchci/pages/benchmark/compilers.tsx +++ b/torchci/pages/benchmark/compilers.tsx @@ -9,6 +9,8 @@ import { import { BenchmarkLogs } from "components/benchmark/compilers/BenchmarkLogs"; import { DEFAULT_DEVICE_NAME, + DEFAULT_HIGHLIGHT_KEY, + DISPLAY_KEYS_TO_HIGHLIGHT, DISPLAY_NAMES_TO_DEVICE_NAMES, DISPLAY_NAMES_TO_WORKFLOW_NAMES, DTYPES, @@ -34,6 +36,7 @@ import { useEffect, useState } from "react"; import useSWR from "swr"; import { COMPILER_SUITES_MAP } from "../../lib/benchmark/compliers/CompilerSuites"; import { TimeRangePicker } from "../metrics"; +import { set, setWith } from "lodash"; const HardCodedHightlightConfig = { keys: ["max_autotune"], highlightColor: "yellow", @@ -176,6 +179,7 @@ export default function Page() { const [rCommit, setRCommit] = useState(""); const [baseUrl, setBaseUrl] = useState(""); const [deviceName, setDeviceName] = useState(DEFAULT_DEVICE_NAME); + const [highlightKey, setHighlightKey] = useState(DEFAULT_HIGHLIGHT_KEY); // Set the dropdown value what is in the param useEffect(() => { @@ -278,6 +282,12 @@ export default function Page() { /> + + —Diff→ @@ -329,7 +342,10 @@ export default function Page() { titlePrefix={"New"} fallbackIndex={0} // Default to the latest commit timeRange={timeRange} - highlightConfig={HardCodedHightlightConfig} + highlightConfig={{ + keys: highlightKey === DEFAULT_HIGHLIGHT_KEY? [] : [highlightKey], + highlightColor: "yellow", + }} /> Date: Tue, 28 Jan 2025 16:22:07 -0800 Subject: [PATCH 11/11] test --- torchci/pages/benchmark/compilers.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/torchci/pages/benchmark/compilers.tsx b/torchci/pages/benchmark/compilers.tsx index fd96cc7845..e2926b2d44 100644 --- a/torchci/pages/benchmark/compilers.tsx +++ b/torchci/pages/benchmark/compilers.tsx @@ -36,7 +36,6 @@ import { useEffect, useState } from "react"; import useSWR from "swr"; import { COMPILER_SUITES_MAP } from "../../lib/benchmark/compliers/CompilerSuites"; import { TimeRangePicker } from "../metrics"; -import { set, setWith } from "lodash"; const HardCodedHightlightConfig = { keys: ["max_autotune"], highlightColor: "yellow", @@ -179,7 +178,9 @@ export default function Page() { const [rCommit, setRCommit] = useState(""); const [baseUrl, setBaseUrl] = useState(""); const [deviceName, setDeviceName] = useState(DEFAULT_DEVICE_NAME); - const [highlightKey, setHighlightKey] = useState(DEFAULT_HIGHLIGHT_KEY); + const [highlightKey, setHighlightKey] = useState( + DEFAULT_HIGHLIGHT_KEY + ); // Set the dropdown value what is in the param useEffect(() => { @@ -282,12 +283,12 @@ export default function Page() { /> - - + label={"Highlight"} + > @@ -343,7 +344,7 @@ export default function Page() { fallbackIndex={0} // Default to the latest commit timeRange={timeRange} highlightConfig={{ - keys: highlightKey === DEFAULT_HIGHLIGHT_KEY? [] : [highlightKey], + keys: highlightKey === DEFAULT_HIGHLIGHT_KEY ? [] : [highlightKey], highlightColor: "yellow", }} />