Skip to content
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

[dtensor][debug] add operation tracing to comm_mode #129017

Closed
wants to merge 10 commits into from

Conversation

sinhaanshul
Copy link
Contributor

@sinhaanshul sinhaanshul commented Jun 19, 2024

Stack from ghstack (oldest at bottom):

Summary
I have added an even more detailed module tracker that now includes the collective counts and operations that happen in each submodule making it easier for users to debug. The tracing now includes the operation's DTensor arguements' input shape and sharding. Like the module collective tracing, the user also has the option to log the tracing table to output.txt file. I have decided not to include the example output for transformer as it is too many lines. The expected output for the MLP_operation_tracing is shown below:

Screenshot 2024-06-25 at 3 33 16 PM Screenshot 2024-06-25 at 3 33 45 PM

Test Plan

  1. torchrun --standalone --nnodes=1 --nproc-per-node=4 torch/distributed/_tensor/examples/comm_mode_features_example.py -e MLP_operation_tracing
  2. torchrun --standalone --nnodes=1 --nproc-per-node=4 torch/distributed/_tensor/examples/comm_mode_features_example.py -e transformer_operation_tracing

cc @mrshenli @pritamdamania87 @zhaojuanmao @satgera @gqchen @aazzolini @osalpekar @jiayisuse @H-Huang @kwen2501 @awgu @penguinwu @fegin @XilunWu @wanchaol @fduwjj @wz337 @tianyu-l @wconstab @yf225 @chauhang @d4l3k

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Jun 19, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/129017

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (4 Unrelated Failures)

As of commit 9aa0b16 with merge base ec284d3 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

UNSTABLE - The following jobs failed but were likely due to flakiness present on trunk and has been marked as unstable:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added ciflow/inductor oncall: distributed Add this issue/PR to distributed oncall triage queue labels Jun 19, 2024
sinhaanshul added a commit that referenced this pull request Jun 19, 2024
ghstack-source-id: aab2b50c790e49482b65a97c9471dd2f5e84a2b9
Pull Request resolved: #129017
@XilunWu XilunWu self-requested a review June 21, 2024 08:31
@XilunWu
Copy link
Contributor

XilunWu commented Jun 21, 2024

let's convert this PR to Draft since it's still WIP.

@XilunWu XilunWu marked this pull request as draft June 21, 2024 08:32
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
sinhaanshul added a commit that referenced this pull request Jun 25, 2024
ghstack-source-id: 03c3ffaf2b533ff8980484f2f3076faf6ac76124
Pull Request resolved: #129017
@sinhaanshul sinhaanshul added the topic: not user facing topic category label Jun 25, 2024
@sinhaanshul sinhaanshul marked this pull request as ready for review June 25, 2024 22:22
Copy link
Contributor

@tianyu-l tianyu-l left a comment

Choose a reason for hiding this comment

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

This looks very interesting! Maybe similarly we can print out the placements of module parameters if they are DTensor?

[ghstack-poisoned]
@wz337
Copy link
Contributor

wz337 commented Jun 26, 2024

Curious of what is your decision of printing out the mesh for the DTensor.

[ghstack-poisoned]
Copy link
Contributor

@XilunWu XilunWu left a comment

Choose a reason for hiding this comment

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

LGTM! This change is a good fundament for future extension. Please address the comment in future PR.

ansi_escape = re.compile(r"\x1B\[[0-?]*[ -/]*[@-~]")
table = ansi_escape.sub("", self.generate_operation_tracing_table())

with open("output.txt", "w") as log_file:
Copy link
Contributor

Choose a reason for hiding this comment

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

let's make the filename an argument. also in log_module_tracing_table_to_file.

@sinhaanshul
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 1, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@sinhaanshul
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions github-actions bot deleted the gh/sinhaanhsul/24/head branch August 2, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged oncall: distributed Add this issue/PR to distributed oncall triage queue topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants