@@ -114,6 +114,7 @@ function createRunElement(name) {
114114}
115115
116116function addSelectedRun ( ) {
117+ if ( ! runSelect ) return ; // Safety check for DOM element
117118 const selectedRun = runSelect . value ;
118119 if ( selectedRun && ! activeRuns . has ( selectedRun ) ) {
119120 activeRuns . add ( selectedRun ) ;
@@ -1331,12 +1332,19 @@ function initializeCharts() {
13311332 console . log ( 'Layer comparisons data processed:' , layerComparisonsData . length , 'items' ) ;
13321333
13331334 allRunNames = [ ...new Set ( loadedBenchmarkRuns . map ( run => run . name ) ) ] ;
1335+
1336+ // In flamegraph-only mode, ensure we include runs from flamegraph data
1337+ if ( validateFlameGraphData ( ) ) {
1338+ const flamegraphRunNames = Object . keys ( flamegraphData . runs ) ;
1339+ allRunNames = [ ...new Set ( [ ...allRunNames , ...flamegraphRunNames ] ) ] ;
1340+ }
1341+
13341342 latestRunsLookup = createLatestRunsLookup ( ) ;
13351343 console . log ( 'Run names and lookup created. Runs:' , allRunNames ) ;
13361344
13371345 // Check if we have actual benchmark results vs flamegraph-only results
13381346 const hasActualBenchmarks = loadedBenchmarkRuns . some ( run =>
1339- run . results && run . results . some ( result => result . suite !== 'flamegraph' )
1347+ run . results && run . results . length > 0 && run . results . some ( result => result . suite !== 'flamegraph' )
13401348 ) ;
13411349
13421350 const hasFlameGraphResults = loadedBenchmarkRuns . some ( run =>
@@ -1346,7 +1354,14 @@ function initializeCharts() {
13461354 console . log ( 'Benchmark analysis:' , {
13471355 hasActualBenchmarks,
13481356 hasFlameGraphResults,
1349- loadedBenchmarkRuns : loadedBenchmarkRuns . length
1357+ loadedBenchmarkRuns : loadedBenchmarkRuns . length ,
1358+ runDetails : loadedBenchmarkRuns . map ( run => ( {
1359+ name : run . name ,
1360+ resultCount : run . results ? run . results . length : 0 ,
1361+ hasResults : run . results && run . results . length > 0
1362+ } ) ) ,
1363+ flamegraphValidation : validateFlameGraphData ( ) ,
1364+ flamegraphRunCount : validateFlameGraphData ( ) ? Object . keys ( flamegraphData . runs ) . length : 0
13501365 } ) ;
13511366
13521367 // If we only have flamegraph results (no actual benchmark data), create synthetic data
@@ -1408,6 +1423,12 @@ function initializeCharts() {
14081423 } else {
14091424 // No runs parameter, use defaults
14101425 activeRuns = new Set ( defaultCompareNames || [ ] ) ;
1426+
1427+ // If no default runs and we're in flamegraph-only mode, use all available runs
1428+ if ( activeRuns . size === 0 && ! hasActualBenchmarks && hasFlameGraphResults ) {
1429+ activeRuns = new Set ( allRunNames ) ;
1430+ console . log ( 'Flamegraph-only mode: auto-selected all available runs:' , Array . from ( activeRuns ) ) ;
1431+ }
14111432 }
14121433
14131434 // Setup UI components
@@ -1779,36 +1800,33 @@ function createSyntheticFlameGraphData(flamegraphLabels) {
17791800
17801801 // Create synthetic benchmark results for each flamegraph
17811802 flamegraphLabels . forEach ( label => {
1782- // Try to determine suite from metadata, default to "Flamegraphs"
1783- const metadata = metadataForLabel ( label , 'benchmark' ) ;
1784- let suite = 'Flamegraphs' ;
1803+ // Get suite from flamegraphData - this should always be available
1804+ let suite = null ;
17851805
1786- // Try to match with existing metadata to get proper suite name
1787- if ( metadata ) {
1788- // Most flamegraphs are likely from Compute Benchmarks
1789- suite = 'Compute Benchmarks' ;
1790- } else {
1791- // For common benchmark patterns, assume Compute Benchmarks
1792- const computeBenchmarkPatterns = [
1793- 'SubmitKernel' , 'SubmitGraph' , 'FinalizeGraph' , 'SinKernelGraph' ,
1794- 'AllocateBuffer' , 'CopyBuffer' , 'CopyImage' , 'CreateBuffer' ,
1795- 'CreateContext' , 'CreateImage' , 'CreateKernel' , 'CreateProgram' ,
1796- 'CreateQueue' , 'ExecuteKernel' , 'MapBuffer' , 'MapImage' ,
1797- 'ReadBuffer' , 'ReadImage' , 'WriteBuffer' , 'WriteImage'
1798- ] ;
1799-
1800- if ( computeBenchmarkPatterns . some ( pattern => label . includes ( pattern ) ) ) {
1801- suite = 'Compute Benchmarks' ;
1806+ if ( window . flamegraphData ?. runs ) {
1807+ // Check all runs for suite information for this benchmark
1808+ for ( const runName in flamegraphData . runs ) {
1809+ const runData = flamegraphData . runs [ runName ] ;
1810+ if ( runData . suites && runData . suites [ label ] ) {
1811+ suite = runData . suites [ label ] ;
1812+ break ;
1813+ }
18021814 }
18031815 }
18041816
1817+ // If no suite found, this indicates a problem with the flamegraph data generation
1818+ if ( ! suite ) {
1819+ console . error ( `No suite information found for flamegraph: ${ label } . This indicates missing suite data in flamegraphs.js` ) ;
1820+ suite = `ERROR: Missing suite for ${ label } ` ;
1821+ }
1822+
18051823 // Add to suite names
18061824 suiteNames . add ( suite ) ;
18071825
18081826 // Create a synthetic timeseries entry for this flamegraph
18091827 const syntheticData = {
18101828 label : label ,
1811- display_label : metadata ?. display_name || label ,
1829+ display_label : label , // Use label directly since this is synthetic data
18121830 suite : suite ,
18131831 unit : 'flamegraph' ,
18141832 lower_is_better : false ,
0 commit comments