-
Notifications
You must be signed in to change notification settings - Fork 251
Memory profiler #2061
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
base: main
Are you sure you want to change the base?
Memory profiler #2061
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2061
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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.
Pull Request Overview
This PR introduces memory profiling capabilities to the microbenchmarking framework, enabling CUDA memory profiling and visualization alongside the standard profiling functionality. Key changes include the implementation of memory profiling functions in profiler.py, updates to configuration files and utility classes to support new profiling options, and the addition of comprehensive tests to validate the functionality.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
benchmarks/microbenchmarks/utils.py | Added new fields and updated to_dict to carry memory profiling info |
benchmarks/microbenchmarks/test/test_benchmark_profiler.py | Added tests for memory profile generation and visualization |
benchmarks/microbenchmarks/test/benchmark_config.yml | Updated YAML config to include enable_memory_profiler flags |
benchmarks/microbenchmarks/profiler.py | Added generate_memory_profile and visualize_memory_profile functions, including pickle file validation |
benchmarks/microbenchmarks/benchmark_inference.py | Integrated memory profiling functions to run alongside model profiler |
benchmarks/microbenchmarks/README.md | Documented new memory profiling options and usage |
Co-authored-by: Copilot <[email protected]>
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.
lgtm
This pull request introduces memory profiling capabilities to the microbenchmarking framework, alongside enhancements to the existing profiling infrastructure. Key changes include the addition of a memory profiler, updates to configuration files to enable memory profiling, and new test cases to validate the functionality.
Memory Profiling Enhancements:
generate_memory_profile
andvisualize_memory_profile
functions inbenchmarks/microbenchmarks/profiler.py
to enable CUDA memory profiling and visualization. This includes memory snapshots, stats collection, and HTML visualizations of memory usage._validate_pickle_file
inprofiler.py
to ensure memory profile files are valid and readable.Configuration Updates:
benchmarks/microbenchmarks/README.md
andbenchmarks/microbenchmarks/test/benchmark_config.yml
to includeenable_memory_profiler
as a configuration option. This allows users to enable memory profiling for specific models.Benchmarking Framework Changes:
benchmark_inference.py
to run memory profiling whenenable_memory_profiler
is set. Results include memory stats and visualization paths.enable_memory_profiler
toBenchmarkConfig
and memory profiling-related fields (memory_profile_path
,memory_visualization_path
,memory_stats
) toBenchmarkResult
inutils.py
.These changes enhance the profiling capabilities of the benchmarking framework, providing deeper insights into memory usage during inference, especially for CUDA-enabled devices.Add support for memory profiler