-
Notifications
You must be signed in to change notification settings - Fork 10
Add tlparse support #21
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| from torch._inductor.decomposition import select_decomp_table | ||
| from torch._inductor.fx_passes.joint_graph import joint_graph_passes | ||
| from torch._inductor.fx_passes.post_grad import remove_assert_ops | ||
| from torch._logging import trace_structured | ||
| from torch._subclasses import FakeTensorMode | ||
| from torch.distributed.tensor import DeviceMesh | ||
|
|
||
|
|
@@ -287,6 +288,14 @@ def build_model_graph(self): | |
| # give more room for optimizations | ||
| _add_alias(gm) | ||
| apply_node_renaming(gm, self.params_len, self.buffer_len, self.metadata) | ||
| trace_structured( | ||
| "artifact", | ||
| metadata_fn=lambda: { | ||
| "name": "autoparallel_joint_graph", | ||
| "encoding": "string", | ||
| }, | ||
| payload_fn=lambda: str(gm.graph), | ||
| ) | ||
|
|
||
| self.gm = gm | ||
|
|
||
|
|
@@ -330,7 +339,16 @@ def optimize_placement(self, verbose=True): | |
| self.sharding_placement = self.sharding_optimizer.get_solution(verbose=False) | ||
|
|
||
| if verbose: | ||
| self.sharding_optimizer.print() | ||
| print(self.sharding_optimizer.get_log()) | ||
|
|
||
| trace_structured( | ||
| "artifact", | ||
| metadata_fn=lambda: { | ||
| "name": "autoparallel_sharding_optimizer_log", | ||
| "encoding": "string", | ||
| }, | ||
| payload_fn=lambda: self.sharding_optimizer.get_log(colored=False), | ||
| ) | ||
|
|
||
| if self.sharding_optimizer.prob.status == -1: | ||
| raise RuntimeError("Didn't find solution") | ||
|
|
@@ -347,6 +365,14 @@ def apply_placement(self, sharding_placement=None): | |
| # clean it up by removing the added aliases from previous pass | ||
| # as well as redundant views | ||
| parallel_gm = joint_graph_passes(parallel_gm) | ||
| trace_structured( | ||
|
Contributor
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. nit: it would be maybe more readable to store the |
||
| "artifact", | ||
| metadata_fn=lambda: { | ||
| "name": "autoparallel_parallel_graph", | ||
| "encoding": "string", | ||
| }, | ||
| payload_fn=lambda: str(parallel_gm.graph), | ||
| ) | ||
| # now rename input/param/tangent/output/grad_param/grad_input nodes following | ||
| # our convention | ||
| apply_node_renaming( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Might be preferable to store the
str(gm), as it would let it be a runnable representation of the graph.