From ac5dcea92c3c11484b36aa89f91a14685a189d3a Mon Sep 17 00:00:00 2001 From: Nick Riasanovsky Date: Thu, 23 Oct 2025 14:52:40 -0700 Subject: [PATCH] Add the web frontend (#182) Summary: Pull Request resolved: https://github.com/meta-pytorch/tritonparse/pull/182 Differential Revision: D85376311 --- website/src/App.tsx | 27 +++++++- website/src/pages/IRAnalysis.tsx | 105 +++++++++++++++++++++++++++++++ website/src/utils/dataLoader.ts | 18 ++++++ 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 website/src/pages/IRAnalysis.tsx diff --git a/website/src/App.tsx b/website/src/App.tsx index c6d8d2c..75530ba 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -12,6 +12,7 @@ import CodeView from "./pages/CodeView"; import FileDiffView from "./pages/FileDiffView"; import SingleCodeViewer from "./components/SingleCodeViewer"; import KernelOverview from "./pages/KernelOverview"; +import IRAnalysis from "./pages/IRAnalysis"; import DataSourceSelector from "./components/DataSourceSelector"; import WelcomeScreen from "./components/WelcomeScreen"; import ExternalLink from "./components/ExternalLink"; @@ -409,7 +410,7 @@ function App() { ); } else { - // Show either overview, IR code, or file diff based on active tab + // Show either overview, IR code, IR analysis, or file diff based on active tab if (activeTab === "overview") { return ( ); } + if (activeTab === "ir_analysis") { + return ( + + ); + } if (activeTab === "comparison") { return ( File Diff + diff --git a/website/src/pages/IRAnalysis.tsx b/website/src/pages/IRAnalysis.tsx new file mode 100644 index 0000000..7d3616e --- /dev/null +++ b/website/src/pages/IRAnalysis.tsx @@ -0,0 +1,105 @@ +import React from "react"; +import { ProcessedKernel } from "../utils/dataLoader"; + +interface IRAnalysisProps { + kernels: ProcessedKernel[]; + selectedKernel: number; +} + +const formatMetadataValue = (value: any): string => { + if (value === null) { + return "null"; + } + if (typeof value === "boolean") { + return value ? "true" : "false"; + } + if (Array.isArray(value)) { + return JSON.stringify(value); + } + if (typeof value === "object") { + return JSON.stringify(value); + } + return String(value); +}; + +interface MetadataItemProps { + label: string; + value: React.ReactNode; +} + +const MetadataItem: React.FC = ({ label, value }) => ( +
+ {label} + {value} +
+); + +const IRAnalysis: React.FC = ({ kernels, selectedKernel }) => { + if (kernels.length === 0) { + return ( +
+
No kernel data available
+
+ ); + } + + const kernel = kernels[selectedKernel]; + + return ( +
+

Triton Kernel IR Analysis

+ +
+

+ Kernel: {kernel.name} +

+
+ + {kernel.irAnalysis.amdBufferOps && ( +
+

+ AMD BufferOps Information +

+
+ <> + + + + + + + + + +
+
+ )} +
+ ); +}; + +export default IRAnalysis; diff --git a/website/src/utils/dataLoader.ts b/website/src/utils/dataLoader.ts index 924f990..c64aa51 100644 --- a/website/src/utils/dataLoader.ts +++ b/website/src/utils/dataLoader.ts @@ -226,6 +226,23 @@ export interface LogEntry { sames?: LaunchSamesData; } +/** + * AMD BufferOps analysis information + */ +export interface AMDBufferOpsInfo { + total?: number; + loads?: number; + stores?: number; + atomics?: number; +} + +/** + * IR Analysis information + */ +export interface IRAnalysisInfo { + amdBufferOps?: AMDBufferOpsInfo; +} + /** * Processed kernel data structure for rendering in the UI */ @@ -239,6 +256,7 @@ export interface ProcessedKernel { pythonSourceInfo?: PythonSourceCodeInfo; // Python source code information metadata?: KernelMetadata; // Compilation metadata launchDiff?: LogEntry; // Aggregated launch event differences + irAnalysis?: IRAnalysisInfo; // IR analysis information } /**