-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add compiled_autograd_id to CompileId #83
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,10 +59,22 @@ fn simple_file_output( | |
.map_or( | ||
format!("unknown_{lineno}"), | ||
|CompileId { | ||
compiled_autograd_id, | ||
frame_id, | ||
frame_compile_id, | ||
attempt, | ||
}| { format!("{frame_id}_{frame_compile_id}_{attempt}") }, | ||
}| { | ||
let frame_id_str = frame_id.map_or("-".to_string(), |v| v.to_string()); | ||
let frame_compile_id_str = | ||
frame_compile_id.map_or("-".to_string(), |v| v.to_string()); | ||
let attempt_str = attempt.map_or("-".to_string(), |v| v.to_string()); | ||
|
||
if let Some(ca_id) = compiled_autograd_id { | ||
format!("{ca_id}_{frame_id_str}_{frame_compile_id_str}_{attempt_str}") | ||
} else { | ||
format!("{frame_id_str}_{frame_compile_id_str}_{attempt_str}") | ||
} | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this and your earlier site have to be updated in lockstep, so now that it is this complicated you should actually factor this out to a dedicated function. |
||
) | ||
.into(); | ||
let subdir = PathBuf::from(compile_id_dir); | ||
|
@@ -380,7 +392,10 @@ impl StructuredLogParser for CompilationMetricsParser<'_> { | |
.map_or("(unknown) ".to_string(), |c| format!("{cid} ", cid = c)); | ||
let mut cid = compile_id.clone(); | ||
if let Some(c) = cid.as_mut() { | ||
c.attempt = 0; | ||
if let Some(_frame_id) = c.frame_compile_id { | ||
// data migration for old logs that don't have attempt | ||
c.attempt = Some(0); | ||
} | ||
} | ||
let stack_html = self | ||
.stack_index | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,16 +128,27 @@ impl StackTrieNode { | |
|
||
#[derive(Eq, PartialEq, Hash, Deserialize, Serialize, Debug, Clone)] | ||
pub struct CompileId { | ||
pub frame_id: u32, | ||
pub frame_compile_id: u32, | ||
pub attempt: u32, | ||
pub compiled_autograd_id: Option<u32>, | ||
pub frame_id: Option<u32>, | ||
pub frame_compile_id: Option<u32>, | ||
pub attempt: Option<u32>, | ||
} | ||
|
||
impl fmt::Display for CompileId { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
write!(f, "[{}/{}", self.frame_id, self.frame_compile_id)?; | ||
if self.attempt != 0 { | ||
write!(f, "_{}", self.attempt)?; | ||
write!(f, "[")?; | ||
if let Some(compiled_autograd_id) = self.compiled_autograd_id { | ||
write!(f, "{}/", compiled_autograd_id)?; | ||
} | ||
let frame_id = self.frame_id.map_or("-".to_string(), |v| v.to_string()); | ||
let frame_compile_id = self | ||
.frame_compile_id | ||
.map_or("-".to_string(), |v| v.to_string()); | ||
write!(f, "{}/{}", frame_id, frame_compile_id)?; | ||
if let Some(attempt) = self.attempt { | ||
if attempt != 0 { | ||
write!(f, "_{}", attempt)?; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, so this is for the display, and I think it's worth bikeshedding this part a little. My main concern is that if we render as By the way, when all three latter fields are empty, I think it's still helpful to just elide the rhs entirely, so you just have "compiled autograd 0". You can't do this without a special compiled autograd sigil though, because o/w it's ambiguous! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's ok too! But it is nice to have a globally unique id too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we want a globally unique id that's visible to the user, and that's consistent with how we save it in our datastores, i think we should just keep using [x/y/z_a] and [y/z_a] out of simplicity. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I have another question for you about future proofing. Another place we may need to insert another level of hierarchy is for DDPOptimizer, which splits a single Dynamo graph into multiple subgraphs. Here, this would be done most logically by adding another level of hierarchy below z, i.e. [y/z_a/h]. When a is 0 (and therefore elided), how do we disambiguate between [x/y/z] and [y/z/h]? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok regathering the requirements:
One option is only allow eliding arguments that use prefix/suffix unique tokens: [!0/1/0] vs [0/1/@0]. The compact form is favorable to be directly used by internal dashboards widegets where it might be hard to have custom rendering We probably want compile directory to also be unique, but special tokens don't work well with filesystems, so we could continue with a no eliding approach: 0_0_0_0_0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the filesystem directory I really don't care haha, just as long as it's unique |
||
} | ||
write!(f, "]") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the file naming here isn't load bearing, I wonder if we should do something wordier like "compiled_autograd_{ca_id}_..." so it's obvious that compiled autograd is involved here. Well, I guess the filename doesn't matter that much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use abbreviations like ca{id}_... to keep things compact and to stick under the 255 char limit for windows