-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Add torch.profile benchmarking function to feedback_fns #153579
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
Closed
Closed
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
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
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
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
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
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
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
Oops, something went wrong.
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 suggestio
2CBB
n.
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.
Sorry, this part I can't quite figure out.. For
profile_bandwidth_with_do_bench_using_profiling=True
, I don't understand why you need to check this config in many of the changes above. This looks like an existing config. If you're overriding the config here, then isn't there some underlying do_bench function that's already being configured to use profiling? Why do you need, e.g.,For
autotune_in_subproc=False
, it seems a bit weird to me to quietly not use the subproc-based method if the user requested it. Seems like we should assert that this feature is just not compatible with do_bench_using_profiling?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.
So
profile_bandwidth_with_do_bench_using_profiling
basically tells theCachingAutotuner
to use the profiler. TheAlgorithmSelectorCache
doesn't use theCachingAutotuner
, it calls the benchmark method ofChoiceCallers
, which is why it's necessary to change this in many spots. The do_bench function is InductorBenchmarker/TritonBenchmarker.bench in this case, so we're replacing that with do_bench_using_profiling.I can support autotune_in_subproc, but I would need to signal to the
TuningProcess
that it should use the benchmarker somehow, because the subprocs are all created at startup so just setting the envvar doesn't work. In status quo, they're all doing profiler benchmarking or none of them are. I can make this refactor but I don't think it's worth complicatingTuningProcess
. I'd rather just run them in the single process, since this change is mainly focused on data collection/logging.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.
Right. I wasn't proposing to support it. Isn't the new feature you're adding optional, or did I misread and it's active by default? I was just saying that we could fail if user wants both profiling and subprocs rather than quietly doing something else.
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 made the subprocs respect the flag, it should work fine, but we can't change it later on.
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.
Does that mean you can remove
autotune_in_subproc=False,
here?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.
no, because for this logging code, we need it to switch between profiler and not-profiler, which only works if it's not using the subprocs
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.
Which is why the code is passed in as an unevaluated function. It might run slower obviously, but the logging code can run the function if it wants the information, but it doesn't get run otherwise.