Skip to content

Add profiler and Perfetto UI link with comprehensive tests #1995

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jainapurva
Copy link
Contributor

This PR adds profiler support and Perfetto UI link with comprehensive tests.

Verified

This commit was signed with the committer’s verified signature.
timlegge Timothy Legge
)
Copy link

pytorch-bot bot commented Apr 1, 2025

🔗 Helpful Links

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

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

❌ 3 New Failures

As of commit 8ef520b with merge base 70fc520 (image):

NEW FAILURES - The following jobs have failed:

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

@jainapurva jainapurva requested a review from Copilot April 1, 2025 20:23
@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 1, 2025
Copy link

@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.

Pull Request Overview

This PR adds profiler support and a Perfetto UI link to the benchmark utilities along with comprehensive tests to validate the functionality. Key changes include:

  • New utility functions for uploading trace files, generating Perfetto UI URLs, and generating both model and memory profiling data.
  • Enhancements to the BenchmarkConfig and benchmark runner to support profiler and memory profiling, with corresponding tests.
  • Updates to the configuration YAML to enable profiling for selected models.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
benchmarks/microbenchmarks/utils.py Added functions upload_trace_file, print_perfetto_ui_url, generate_model_profile, and generate_memory_profile; updated BenchmarkConfig to include profiler settings.
benchmarks/microbenchmarks/test/test_benchmark_profiler.py Added comprehensive tests for profiler functionality on both CPU and CUDA devices.
benchmarks/microbenchmarks/test/benchmark_config.yml Updated YAML to enable profiler and memory profiling for selected models.
benchmarks/microbenchmarks/benchmark_runner.py Improved error handling in benchmark execution and CSV/result generation.
benchmarks/microbenchmarks/benchmark_inference.py Wrapped profiler and memory profiling execution in try/except blocks and refined model compilation formatting.
Comments suppressed due to low confidence (1)

benchmarks/microbenchmarks/utils.py:243

  • Usage of the private API torch.cuda.memory._record_memory_history may lead to breakage in future PyTorch releases; consider switching to a supported public API if one is available.
torch.cuda.memory._record_memory_history(True, trace_alloc_max_entries=250000, trace_alloc_record_context=True)

DEFAULT_TTL_SEC = 28 * 24 * 60 * 60
file_name = os.path.basename(local_path)
manifold_path = os.path.join(
MANIFOLD_FOLDER, f"{os.getlogin()}_{str(uuid.uuid4())}_{file_name}"
Copy link
Preview

Copilot AI Apr 1, 2025

Choose a reason for hiding this comment

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

os.getlogin() may raise an OSError in non-interactive environments; consider using getpass.getuser() for improved reliability.

Suggested change
MANIFOLD_FOLDER, f"{os.getlogin()}_{str(uuid.uuid4())}_{file_name}"
MANIFOLD_FOLDER, f"{getpass.getuser()}_{str(uuid.uuid4())}_{file_name}"

Copilot uses AI. Check for mistakes.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants