Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/tl_out
*.log
!/tests/inputs/*.log
.claude/
25 changes: 25 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ fn add_file_output(
compile_directory: &mut Vec<OutputFile>,
output_count: &mut i32,
vllm_state: &vllm::VllmState,
subgraph_name: &Option<String>,
) {
let is_stack_traces = is_stack_traces_file(&filename);
let maybe_content = if is_stack_traces {
Expand Down Expand Up @@ -158,6 +159,8 @@ fn add_file_output(
number: *output_count,
suffix: suffix,
readable_url,
starts_group: false,
group_name: subgraph_name.clone().unwrap_or_default(),
});
*output_count += 1;
}
Expand Down Expand Up @@ -240,6 +243,7 @@ fn run_parser<'t>(
compile_directory,
output_count,
vllm_state,
&e.subgraph_name,
);
}
ParserOutput::GlobalFile(filename, out) => {
Expand All @@ -250,6 +254,7 @@ fn run_parser<'t>(
compile_directory,
output_count,
vllm_state,
&e.subgraph_name,
);
}
ParserOutput::PayloadFile(raw_filename) => {
Expand All @@ -264,6 +269,7 @@ fn run_parser<'t>(
compile_directory,
output_count,
vllm_state,
&e.subgraph_name,
);
}
ParserOutput::PayloadReformatFile(raw_filename, formatter) => {
Expand All @@ -280,6 +286,7 @@ fn run_parser<'t>(
compile_directory,
output_count,
vllm_state,
&e.subgraph_name,
);
}
Err(err) => {
Expand All @@ -301,6 +308,8 @@ fn run_parser<'t>(
number: *output_count,
suffix: "".to_string(),
readable_url: None,
starts_group: false,
group_name: e.subgraph_name.clone().unwrap_or_default(),
});
*output_count += 1;
}
Expand Down Expand Up @@ -857,6 +866,7 @@ pub fn parse_path(path: &PathBuf, config: &ParseConfig) -> anyhow::Result<ParseO
compile_directory,
&mut output_count,
&vllm_state,
&e.subgraph_name,
);
}
ParserOutput::GlobalFile(filename, out) => {
Expand All @@ -867,6 +877,7 @@ pub fn parse_path(path: &PathBuf, config: &ParseConfig) -> anyhow::Result<ParseO
compile_directory,
&mut output_count,
&vllm_state,
&e.subgraph_name,
);
}
ParserOutput::PayloadFile(raw_filename) => {
Expand All @@ -881,6 +892,7 @@ pub fn parse_path(path: &PathBuf, config: &ParseConfig) -> anyhow::Result<ParseO
compile_directory,
&mut output_count,
&vllm_state,
&e.subgraph_name,
);
}
ParserOutput::PayloadReformatFile(raw_filename, formatter) => {
Expand All @@ -897,6 +909,7 @@ pub fn parse_path(path: &PathBuf, config: &ParseConfig) -> anyhow::Result<ParseO
compile_directory,
&mut output_count,
&vllm_state,
&e.subgraph_name,
);
}
Err(err) => {
Expand All @@ -918,6 +931,8 @@ pub fn parse_path(path: &PathBuf, config: &ParseConfig) -> anyhow::Result<ParseO
number: output_count,
suffix: "".to_string(),
readable_url: None,
starts_group: false,
group_name: e.subgraph_name.clone().unwrap_or_default(),
});
output_count += 1;
}
Expand Down Expand Up @@ -1262,6 +1277,16 @@ pub fn parse_path(path: &PathBuf, config: &ParseConfig) -> anyhow::Result<ParseO

let has_unknown_compile_id = directory.contains_key(&None);

for files in directory.values_mut() {
let mut prev_group = String::new();
for file in files.iter_mut() {
if file.group_name != prev_group {
file.starts_group = true;
prev_group = file.group_name.clone();
}
}
}

let directory_names: Vec<String> = directory
.iter()
.map(|(x, _)| {
Expand Down
2 changes: 2 additions & 0 deletions src/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,8 @@ impl StructuredLogParser for CompilationMetricsParser<'_> {
number: o.number.clone(),
suffix: o.suffix.clone(),
readable_url: o.readable_url.as_ref().map(|u| remove_prefix(u)),
starts_group: o.starts_group,
group_name: o.group_name.clone(),
})
.collect();
let extra_metrics: Vec<ExtraMetricContext> = m
Expand Down
1 change: 1 addition & 0 deletions src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ Build products below:
<li><a id="{compile_directory.0}">{compile_directory.0}</a>
<ul>
{{ for path_idx in compile_directory.1 }}
{{ if path_idx.starts_group }}<li style="margin-top: 8px;">{{ if path_idx.group_name }}Subgraph Name: {path_idx.group_name}{{ endif }}</li>{{ endif }}
<li><a href="{path_idx.url}">{path_idx.name}</a>{{ if path_idx.readable_url }} (<a href="{path_idx.readable_url}">readable_html</a>){{ endif }} {path_idx.suffix} ({path_idx.number})</li>
{{ endfor }}
</ul>
Expand Down
5 changes: 5 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ pub struct OutputFile {
pub suffix: String,
/// URL to a human-readable HTML version of inductor_provenance_tracking_kernel_stack_traces.json
pub readable_url: Option<String>,
#[serde(default)]
pub starts_group: bool,
#[serde(default)]
pub group_name: String,
}

#[derive(Debug, Serialize)]
Expand Down Expand Up @@ -773,6 +777,7 @@ pub struct Envelope {
pub rank: Option<u32>,
#[serde(flatten)]
pub compile_id: Option<CompileId>,
pub subgraph_name: Option<String>,
#[serde(default)]
pub has_payload: Option<String>,
pub stack: Option<StackSummary>,
Expand Down
6 changes: 6 additions & 0 deletions tests/inputs/subgraph_name.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
V0429 16:46:26.856000 3930665 /torch/_logging/structured.py:28] {"artifact": {"name": "dynamo_output_graph", "encoding": "string"}, "frame_id": 0, "frame_compile_id": 0, "attempt": 0, "has_payload": "8b4a69a00ac3b2850d14ad15b66d77ed"}
test payload no subgraph
V0429 16:46:27.745000 3930665 /torch/_inductor/compile_fx.py:1313] {"artifact": {"name": "fx_graph_runnable", "encoding": "string"}, "frame_id": 0, "frame_compile_id": 0, "attempt": 0, "subgraph_name": "repeated_subgraph0", "has_payload": "dcffdffe5e74fe67eaf327b0453e379a"}
test payload subgraph A
V0429 16:46:29.604000 3930665 /torch/_inductor/compile_fx.py:1313] {"artifact": {"name": "fx_graph_runnable", "encoding": "string"}, "frame_id": 0, "frame_compile_id": 0, "attempt": 0, "subgraph_name": "partitioned_bw_subgraph_1_0", "has_payload": "13e1309b0f53ad9d570fda42091e0569"}
test payload subgraph B
31 changes: 31 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3345,3 +3345,34 @@ fn test_cli_no_overwrite_fails() -> Result<(), Box<dyn std::error::Error>> {

Ok(())
}

#[test]
fn test_subgraph_name_grouping() {
let path = Path::new("tests/inputs/subgraph_name.log").to_path_buf();
let config = ParseConfig::default();
let output = tlparse::parse_path(&path, &config);
assert!(output.is_ok());
let map: HashMap<PathBuf, String> = output.unwrap().into_iter().collect();

// All files should be flat in -_0_0_0/ (no subgraph subdirectories)
assert!(prefix_exists(&map, "-_0_0_0/dynamo_output_graph"));
assert!(prefix_exists(&map, "-_0_0_0/fx_graph_runnable"));

// No files should be nested under subgraph subdirectories
assert!(
!map.keys()
.any(|k| k.to_str().unwrap_or("").contains("repeated_subgraph0/")),
"files should not be in subgraph subdirectories"
);

// Index should contain subgraph group headers
let index = &map[&PathBuf::from("index.html")];
assert!(
index.contains("Subgraph Name: repeated_subgraph0"),
"index should contain repeated_subgraph0 group header"
);
assert!(
index.contains("Subgraph Name: partitioned_bw_subgraph_1_0"),
"index should contain partitioned_bw_subgraph_1_0 group header"
);
}
Loading