Skip to content

Add profiling to benchmarking #2032

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 7 commits into from
Apr 18, 2025
Merged

Add profiling to benchmarking #2032

merged 7 commits into from
Apr 18, 2025

Conversation

jainapurva
Copy link
Contributor

@jainapurva jainapurva commented Apr 9, 2025

Add profiler support to benchmarks. The new config param enable_profiler enable profiling on a model. The chrome trace for a model is stored in /profiles in the output directory.

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Apr 9, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 3441bf9 with merge base a96eeb1 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 9, 2025
@jainapurva jainapurva added the topic: performance Use this tag if this PR improves the performance of a feature label Apr 9, 2025
@jainapurva jainapurva requested a review from Copilot April 9, 2025 18:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

benchmarks/microbenchmarks/utils.py:477

  • [nitpick] The two adjacent f-strings are concatenated without a delimiter, which may result in an improperly formatted output. Consider adding a separator or splitting the information into separate columns to align with the header.
f"{result.config.shape_name} ({result.config.m}, {result.config.k}, {result.config.n})" f"{result.model_inference_time_in_ms:.2f}",

benchmarks/microbenchmarks/benchmark_inference.py:97

  • The generate_model_profile function currently returns only one value (profile_file_path), but the calling code expects a tuple with two elements. Please update the function to return the expected tuple or adjust the caller accordingly.
result.profiler_json_path, result.perfetto_url = generate_model_profile(m_copy, input_data, config.profiler_file_name)

@jainapurva jainapurva requested a review from Copilot April 10, 2025 18:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

benchmarks/microbenchmarks/benchmark_inference.py:96

  • The function generate_model_profile returns a single value (profile_file_path) whereas this line expects a tuple; either update the function to return a tuple or assign the return value to a single variable.
result.profiler_json_path, result.perfetto_url = generate_model_profile(m_copy, input_data, config.profiler_file_name)

@jainapurva
Copy link
Contributor Author

Please refer the PR stack #1997 for complete picture.

@jainapurva jainapurva marked this pull request as ready for review April 10, 2025 21:02
@jainapurva jainapurva mentioned this pull request Apr 10, 2025
Copy link
Contributor

@HDCharles HDCharles left a comment

Choose a reason for hiding this comment

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

looks good, do the generated profiles make sense?

@jainapurva jainapurva merged commit 25034e5 into main Apr 18, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: performance Use this tag if this PR improves the performance of a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants