-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[CUDA Graphs] Add option to dump a captured graph for debugging #85519
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/85519
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c08266d: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
aten/src/ATen/cuda/CUDAGraph.cpp
Outdated
AT_CUDA_CHECK(cudaGraphDestroy(graph_)); | ||
has_graph_ = false; | ||
} else { | ||
TORCH_WARN("DEBUG: TORCH_CUDAGRAPHS_DEBUG_PATH detected. graph_ will not be freed"); |
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.
I think this is outdated.
torch/cuda/graphs.py
Outdated
def debug_dump(self): | ||
r""" | ||
Calls a debugging function to dump the graph if the dump path has been | ||
set via torch._C._cuda_setCudaGraphsDebugPath() |
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.
Should it be torch._C._cuda_set_graphs_debug_path
?
@pytorchmergebot rebase |
@pytorchbot successfully started a rebase job. Check the current status here |
Successfully rebased |
c2575ef
to
7f0fba6
Compare
aten/src/ATen/cuda/CUDAGraph.cpp
Outdated
TORCH_WARN("DEBUG: calling debug_dump()"); | ||
if (has_graph_) { | ||
TORCH_WARN("DEBUG: calling cudaGraphDebugDotPrint() with ", _cuda_graphs_debug_path); | ||
C10_CUDA_CHECK_WARN(cudaGraphDebugDotPrint(graph_, _cuda_graphs_debug_path.c_str(), 1<<10)); // most verbose output |
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.
you can destroy graph_
now?
torch/csrc/cuda/Module.cpp
Outdated
@@ -979,6 +984,10 @@ static struct PyMethodDef _THCPModule_methods[] = { | |||
THCPModule_setBenchmarkLimitCuDNN, | |||
METH_O, | |||
nullptr}, | |||
{"_cuda_set_graphs_debug_path", |
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.
I think instead of _cuda_set_graphs_debug_path
you should have something like enable_cudagraph_debug_mode
that will preserve graph_
object for further inspection - you might want to do something other than dumping dot graph. As for path to dump the file, debug_dump itself should accept path argument - that would make it more consistent with other io functions.
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.
As for path to dump the file, debug_dump itself should accept path argument - that would make it more consistent with other io functions.
👍 as this was also my first approach while testing the PR without looking at the code
/easycla As part of the transition to the PyTorch Foundation, this project now requires contributions be covered under the new CLA. See #85559 for additional details. This comment will trigger a new check of this PR. If you are already covered, you will simply see a new "EasyCLA" check that passes. If you are not covered, a bot will leave a new comment with a link to sign. |
7f0fba6
to
2cc6cef
Compare
@pytorchmergebot rebase |
@pytorchbot successfully started a rebase job. Check the current status here |
Successfully rebased |
fe5ea40
to
bc4c71f
Compare
@pytorchmergebot rebase |
@pytorchbot successfully started a rebase job. Check the current status here |
Rebase failed due to Command
Raised by https://github.com/pytorch/pytorch/actions/runs/3526151366 |
1b31a5d
to
3b1a8e5
Compare
@pytorchmergebot rebase |
@pytorchbot successfully started a rebase job. Check the current status here |
Successfully rebased |
bb5056d
to
d5784ab
Compare
d5784ab
to
a39a252
Compare
@pytorchmergebot rebase |
@pytorchbot successfully started a rebase job. Check the current status here |
Successfully rebased |
a39a252
to
c08266d
Compare
@pytorchmergebot merge |
Merge startedYour 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 |
…rch#85519) CC @xwang233 @ptrblck @ngimel Pull Request resolved: pytorch#85519 Approved by: https://github.com/ngimel
CC @xwang233 @ptrblck @ngimel