Skip to content

Commit d717e4f

Browse files
authored
Update Provenance Tracking Name (#110)
Update the file names used for provenance tracking due to changes in https://github.com/pytorch/pytorch/pull/153584/files#diff-e0cdb58c0f84f56f20c5433339b6d83c470dcde47847e2328effea6bedd4cd27 Additional changes: - update the test log files - Highlight the whole line - Allow panel size changes
1 parent 01d5522 commit d717e4f

9 files changed

+2149
-2705
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,9 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
848848
// Generate HTML for each directory name
849849
for directory_name in &directory_names {
850850
let pre_grad_graph_content =
851-
get_file_content(&output, "inductor_pre_grad_graph", directory_name);
851+
get_file_content(&output, "before_pre_grad_graph", directory_name);
852852
let post_grad_graph_content =
853-
get_file_content(&output, "inductor_post_grad_graph", directory_name);
853+
get_file_content(&output, "after_post_grad_graph", directory_name);
854854
let output_code_content =
855855
get_file_content(&output, "inductor_output_code", directory_name);
856856
let aot_code_content =

src/provenance.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ body {
4747
padding: 2px 5px;
4848
cursor: pointer;
4949
white-space: nowrap;
50+
display: flex;
51+
width: 100%;
52+
min-width: max-content; /* Ensure line fills horizontally beyond visible area */
53+
box-sizing: border-box;
5054
transition: background-color 0.2s ease;
5155
}
5256

@@ -68,7 +72,7 @@ body {
6872
}
6973

7074
.divider {
71-
width: 10px;
75+
width: 3px;
7276
background-color: #ccc;
7377
cursor: col-resize;
7478
}

src/provenance.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<div id="preGradGraph" class="editor">
1616
<pre>{pre_grad_graph_content}</pre>
1717
</div>
18-
<div id="divider" class="divider"></div>
18+
<div id="divider1" class="divider"></div>
1919
<div id="postGradGraph" class="editor">
2020
<pre>{post_grad_graph_content}</pre>
2121
</div>
22-
<div id="divider" class="divider"></div>
22+
<div id="divider2" class="divider"></div>
2323
<div id="generatedCode" class="editor">
2424
<pre>{output_code_content | format_unescaped}{aot_code_content}</pre>
2525
</div>

src/provenance.js

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ function convertNodeMappingsToLineNumbers() {
6060
return;
6161
}
6262

63-
function validLine(line) {
63+
function validLine(line, symbol = "#") {
6464
const stripped = line.trim();
65-
return stripped && !stripped.startsWith("#");
65+
return stripped && !stripped.startsWith(symbol);
6666
}
6767

6868
// Create lookup maps for both files
@@ -126,7 +126,8 @@ function convertNodeMappingsToLineNumbers() {
126126
for (let i = 0; i < cppCodeData.length; i++) {
127127
const line = cppCodeData[i];
128128
// 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 + "("))) {
130131
// let kernelName be the first match
131132
const kernelName = kernelNames.find(kernelName => line.includes(kernelName + "("));
132133
// create an array for the kernel name if it doesn't exist
@@ -362,14 +363,14 @@ function initializeData() {
362363
if (postGradGraph) postGradGraphData = postGradGraph.textContent.split('\n');
363364
if (generatedCode) {
364365
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')) {
370367
// This is C++ code
371368
cppCodeData = content.split('\n');
372369
codeData = null;
370+
} else {
371+
// This is Python code
372+
codeData = content.split('\n');
373+
cppCodeData = null;
373374
}
374375
}
375376

@@ -487,4 +488,59 @@ function findCorrespondingLines(sourceEditorId, lineNumber) {
487488
}
488489

489490
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

Comments
 (0)