Skip to content

Conversation

azahed98
Copy link
Contributor

@azahed98 azahed98 commented Jun 12, 2025

Copy link

pytorch-bot bot commented Jun 12, 2025

🔗 Helpful Links

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

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

⏳ 1 Pending, 1 Unrelated Failure

As of commit c1de92d with merge base b4442f4 (image):

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

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

try:
if grad_enabled:
torch._C._set_grad_enabled(False)
record_runtime_wrapper_prologue_exit(cm)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm at first I was going to ask you to use the context manager directly, so we don't need to worry about carefully making sure that the enter/exit line up in all the various branches.

I guess this is actually a pain to do though, since you need different global state to be toggled in the different branches, and you want to capture that inside of the recorded region

def record_runtime_wrapper_prologue_enter() -> AbstractContextManager[None]:
cm: AbstractContextManager[None] = (
torch._C._profiler._RecordFunctionFast("AOTDispatcher Runtime Wrapper Prologue")
if torch.autograd.profiler._is_profiler_enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

@anijain2305 I saw that you have an additional config.record_pre_graph_bytecode_in_traces that you branch on in your case. Did you add that because you're worried about the extra overhead even in this case where profiling is off? https://github.com/pytorch/pytorch/pull/154769/files#diff-0bb1756725c4426408938314b0c9d3988ae5bf49994892d7038ad7746e209e9fR617

Copy link
Contributor

@bdhirsh bdhirsh left a comment

Choose a reason for hiding this comment

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

nice work!

@azahed98 azahed98 marked this pull request as ready for review June 13, 2025 21:14
@azahed98 azahed98 force-pushed the feat/aotdispatcher_prologue_profiler branch from af4604f to c843fc9 Compare June 17, 2025 20:28
@azahed98
Copy link
Contributor Author

@pytorchbot merge -r

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jun 18, 2025
@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Rebase failed due to Command git -C /home/runner/work/pytorch/pytorch rebase refs/remotes/origin/viable/strict pull/155785/head returned non-zero exit code 1

Rebasing (1/53)
Rebasing (2/53)
Rebasing (3/53)
Auto-merging test/dynamo/test_repros.py
CONFLICT (content): Merge conflict in test/dynamo/test_repros.py
error: could not apply 57d296a1085... Add test_aot_autograd_runtime_wrapper_prologue_profiled to test_repros
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply 57d296a1085... Add test_aot_autograd_runtime_wrapper_prologue_profiled to test_repros

Raised by https://github.com/pytorch/pytorch/actions/runs/15742581401

@azahed98
Copy link
Contributor Author

@pytorchbot merge -r

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Rebase failed due to Command git -C /home/runner/work/pytorch/pytorch rebase refs/remotes/origin/viable/strict pull/155785/head returned non-zero exit code 1

Rebasing (1/12)
Rebasing (2/12)
Rebasing (3/12)
Auto-merging test/dynamo/test_repros.py
CONFLICT (content): Merge conflict in test/dynamo/test_repros.py
error: could not apply 57d296a1085... Add test_aot_autograd_runtime_wrapper_prologue_profiled to test_repros
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply 57d296a1085... Add test_aot_autograd_runtime_wrapper_prologue_profiled to test_repros

Raised by https://github.com/pytorch/pytorch/actions/runs/15768102447

@pytorchmergebot
Copy link
Collaborator

Successfully rebased feat/aotdispatcher_prologue_profiler onto refs/remotes/origin/main, please pull locally before adding more changes (for example, via git checkout feat/aotdispatcher_prologue_profiler && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the feat/aotdispatcher_prologue_profiler branch from 13581a7 to f92f250 Compare June 20, 2025 17:53
@azahed98
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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: inductor-rocm / rocm-py3.10-inductor / build

Details for Dev Infra team Raised by workflow job

@azahed98 azahed98 force-pushed the feat/aotdispatcher_prologue_profiler branch from f92f250 to 13581a7 Compare June 20, 2025 18:39
@azahed98
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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@azahed98
Copy link
Contributor Author

@pytorchbot merge -r

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased feat/aotdispatcher_prologue_profiler onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout feat/aotdispatcher_prologue_profiler && git pull --rebase)

@pytorchmergebot
Copy link
Collaborator

This PR updates submodules third_party/eigen

If those updates are intentional, please add "submodule" keyword to PR title/description.

@azahed98 azahed98 force-pushed the feat/aotdispatcher_prologue_profiler branch from db38892 to 13581a7 Compare June 20, 2025 20:43
@azahed98 azahed98 force-pushed the feat/aotdispatcher_prologue_profiler branch from 13581a7 to 140d34e Compare June 20, 2025 20:56
@azahed98
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add runtime profiler info for AOTDispatcher prologue
3 participants