Skip to content

Conversation

@aorenste
Copy link
Contributor

These are my suggestions - they're all pretty minor however. The biggest one is just the use of Result + ? in main - getting used to the rust style of error handling is pretty key since it's pretty pervasive.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!!

#[derive(Debug, Deserialize)]
struct DynamoOutputGraphMetadata {
sizes: Option<FxHashMap<String, Vec<SymInt>>>,
_sizes: Option<FxHashMap<String, Vec<SymInt>>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change serde's behavior? I need the field to match what I am getting in the JSON format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will change the field name - so if you need it to match the JSON name then you can prefix it with:

#[allow(dead_code)]
sizes: Option<FxHashMap<String, Vec<SymInt>>>,

so it doesn't complain about the unread field.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i'll need to do this. fortunately these are all defaulted so it doesn't matter too much yet

.map_or(format!("unknown_{}", lineno), |e: CompileId| {
format!("{}_{}_{}", e.frame_id, e.frame_compile_id, e.attempt)
});
.as_ref()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhhh lol

frame_id,
frame_compile_id,
attempt,
}| { format!("{frame_id}_{frame_compile_id}_{attempt}") },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, f-string style is nice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just be aware that it only works with identifiers - so you can't do:

format!("{foo.bar}")

but you can do:

format!("{myvar}", myvar = foo.bar)

@ezyang ezyang merged commit 67b3d7d into meta-pytorch:main Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants