@@ -60,9 +60,9 @@ function convertNodeMappingsToLineNumbers() {
60
60
return ;
61
61
}
62
62
63
- function validLine ( line ) {
63
+ function validLine ( line , symbol = "#" ) {
64
64
const stripped = line . trim ( ) ;
65
- return stripped && ! stripped . startsWith ( "#" ) ;
65
+ return stripped && ! stripped . startsWith ( symbol ) ;
66
66
}
67
67
68
68
// Create lookup maps for both files
@@ -126,7 +126,8 @@ function convertNodeMappingsToLineNumbers() {
126
126
for ( let i = 0 ; i < cppCodeData . length ; i ++ ) {
127
127
const line = cppCodeData [ i ] ;
128
128
// check if the line include any of the kernel names
129
- if ( validLine ( line ) && kernelNames . some ( kernelName => line . includes ( kernelName + "(" ) ) ) {
129
+ // Skip definition lines, highlight the launch line
130
+ if ( validLine ( line , "//" ) && validLine ( line , "def" ) && validLine ( line , "static inline void" ) && kernelNames . some ( kernelName => line . includes ( kernelName + "(" ) ) ) {
130
131
// let kernelName be the first match
131
132
const kernelName = kernelNames . find ( kernelName => line . includes ( kernelName + "(" ) ) ;
132
133
// create an array for the kernel name if it doesn't exist
@@ -362,14 +363,14 @@ function initializeData() {
362
363
if ( postGradGraph ) postGradGraphData = postGradGraph . textContent . split ( '\n' ) ;
363
364
if ( generatedCode ) {
364
365
const content = generatedCode . textContent ;
365
- if ( content . includes ( 'async_compile.triton(' ) ) {
366
- // This is Python code
367
- codeData = content . split ( '\n' ) ;
368
- cppCodeData = null ;
369
- } else {
366
+ if ( content . includes ( 'AOTInductorModel::run_impl' ) ) {
370
367
// This is C++ code
371
368
cppCodeData = content . split ( '\n' ) ;
372
369
codeData = null ;
370
+ } else {
371
+ // This is Python code
372
+ codeData = content . split ( '\n' ) ;
373
+ cppCodeData = null ;
373
374
}
374
375
}
375
376
@@ -487,4 +488,59 @@ function findCorrespondingLines(sourceEditorId, lineNumber) {
487
488
}
488
489
489
490
return result ;
490
- }
491
+ }
492
+
493
+ // Resizable Panels Start
494
+ function setupResizablePanels ( ) {
495
+ const container = document . querySelector ( '.editor-container' ) ;
496
+ const pre = document . getElementById ( 'preGradGraph' ) ;
497
+ const post = document . getElementById ( 'postGradGraph' ) ;
498
+ const code = document . getElementById ( 'generatedCode' ) ;
499
+ const divider1 = document . getElementById ( 'divider1' ) ;
500
+ const divider2 = document . getElementById ( 'divider2' ) ;
501
+
502
+ let isDragging = false ;
503
+ let dragDivider = null ;
504
+
505
+ function onMouseMove ( e ) {
506
+ if ( ! isDragging || ! dragDivider ) return ;
507
+
508
+ const containerRect = container . getBoundingClientRect ( ) ;
509
+ const totalWidth = containerRect . width ;
510
+
511
+ if ( dragDivider === divider1 ) {
512
+ const newPreWidth = e . clientX - containerRect . left ;
513
+ const newPostWidth = post . offsetWidth + ( pre . offsetWidth - newPreWidth ) ;
514
+ pre . style . flex = `0 0 ${ newPreWidth } px` ;
515
+ post . style . flex = `0 0 ${ newPostWidth } px` ;
516
+ } else if ( dragDivider === divider2 ) {
517
+ const preWidth = pre . offsetWidth ;
518
+ const newPostWidth = e . clientX - containerRect . left - preWidth - divider1 . offsetWidth ;
519
+ const newCodeWidth = totalWidth - e . clientX + containerRect . left - divider2 . offsetWidth ;
520
+ post . style . flex = `0 0 ${ newPostWidth } px` ;
521
+ code . style . flex = `0 0 ${ newCodeWidth } px` ;
522
+ }
523
+ }
524
+
525
+ function onMouseUp ( ) {
526
+ isDragging = false ;
527
+ dragDivider = null ;
528
+ document . body . style . cursor = '' ;
529
+ document . removeEventListener ( 'mousemove' , onMouseMove ) ;
530
+ document . removeEventListener ( 'mouseup' , onMouseUp ) ;
531
+ }
532
+
533
+ [ divider1 , divider2 ] . forEach ( div => {
534
+ div . addEventListener ( 'mousedown' , e => {
535
+ isDragging = true ;
536
+ dragDivider = div ;
537
+ document . body . style . cursor = 'col-resize' ;
538
+ document . addEventListener ( 'mousemove' , onMouseMove ) ;
539
+ document . addEventListener ( 'mouseup' , onMouseUp ) ;
540
+ } ) ;
541
+ } ) ;
542
+ }
543
+
544
+ window . addEventListener ( 'DOMContentLoaded' , setupResizablePanels ) ;
545
+
546
+ // Resizable Panels End
0 commit comments