-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[DRAFT] Transformation memory profiler #32438
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: master
Are you sure you want to change the base?
Conversation
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 adds a memory profiler to track memory usage during transformation passes. It implements functionality to monitor and report memory consumption at the process level, providing insights into which passes consume the most memory.
- Adds memory information tracking with RSS and virtual memory monitoring
- Implements profiling infrastructure to measure memory usage before and after each pass
- Adds summary reporting to identify passes with highest memory consumption
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/core/src/pass/manager.cpp | Implements memory profiling logic, adds getProcessMemoryInfo function and memory tracking in pass execution |
| src/core/include/openvino/pass/manager.hpp | Declares MemoryInfo struct and getProcessMemoryInfo function for memory profiling interface |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| while (std::getline(status, line)) { | ||
| if (line.rfind("VmRSS:", 0) == 0) { | ||
| std::sscanf(line.c_str(), "VmRSS: %zu", &info.vm_rss_bytes); | ||
| info.vm_rss_bytes /= 1024; // KB → Mbytes |
Copilot
AI
Oct 16, 2025
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.
Corrected spelling of 'Mbytes' to 'MB' for standard unit abbreviation.
| info.vm_rss_bytes /= 1024; // KB → Mbytes | |
| info.vm_rss_bytes /= 1024; // KB → MB |
Copilot uses AI. Check for mistakes.
| info.vm_rss_bytes /= 1024; // KB → Mbytes | ||
| } else if (line.rfind("VmSize:", 0) == 0) { | ||
| std::sscanf(line.c_str(), "VmSize: %zu", &info.vm_size_bytes); | ||
| info.vm_size_bytes /= 1024; |
Copilot
AI
Oct 16, 2025
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.
The division by 1024 converts from KB to bytes, but the comment says 'KB → Mbytes'. The variable name suggests bytes, so the conversion should be *= 1024 to convert KB to bytes, or rename the variable to indicate MB units.
| info.vm_rss_bytes /= 1024; // KB → Mbytes | |
| } else if (line.rfind("VmSize:", 0) == 0) { | |
| std::sscanf(line.c_str(), "VmSize: %zu", &info.vm_size_bytes); | |
| info.vm_size_bytes /= 1024; | |
| info.vm_rss_bytes *= 1024; // KB → bytes | |
| } else if (line.rfind("VmSize:", 0) == 0) { | |
| std::sscanf(line.c_str(), "VmSize: %zu", &info.vm_size_bytes); | |
| info.vm_size_bytes *= 1024; // KB → bytes |
Copilot uses AI. Check for mistakes.
| info.vm_rss_bytes /= 1024; // KB → Mbytes | ||
| } else if (line.rfind("VmSize:", 0) == 0) { | ||
| std::sscanf(line.c_str(), "VmSize: %zu", &info.vm_size_bytes); | ||
| info.vm_size_bytes /= 1024; |
Copilot
AI
Oct 16, 2025
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.
Same issue as with vm_rss_bytes - the division converts KB to a smaller unit but the variable name suggests bytes. Either multiply by 1024 to get bytes or rename to indicate the actual unit.
| info.vm_rss_bytes /= 1024; // KB → Mbytes | |
| } else if (line.rfind("VmSize:", 0) == 0) { | |
| std::sscanf(line.c_str(), "VmSize: %zu", &info.vm_size_bytes); | |
| info.vm_size_bytes /= 1024; | |
| info.vm_rss_bytes *= 1024; // KB → bytes | |
| } else if (line.rfind("VmSize:", 0) == 0) { | |
| std::sscanf(line.c_str(), "VmSize: %zu", &info.vm_size_bytes); | |
| info.vm_size_bytes *= 1024; |
Copilot uses AI. Check for mistakes.
| MemoryInfo mem_info_after = getProcessMemoryInfo(); | ||
| std::cout << "After: RSS = " << mem_info_after.vm_rss_bytes << ", VM = " << mem_info_after.vm_size_bytes << std::endl; | ||
| std::cout << "Diff: RSS = " << mem_info_after.vm_rss_bytes - mem_info_before.vm_rss_bytes << ", VM = " << mem_info_after.vm_size_bytes - mem_info_before.vm_size_bytes << std::endl; | ||
| if(mem_info_after.vm_rss_bytes > max_vm_consumer.vm_rss) { |
Copilot
AI
Oct 16, 2025
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.
Both conditions check the same value (vm_rss_bytes). The first condition should check vm_size_bytes for VM memory tracking, and the second should check vm_rss_bytes for RSS tracking.
| if(mem_info_after.vm_rss_bytes > max_vm_consumer.vm_rss) { | |
| if(mem_info_after.vm_size_bytes > max_vm_consumer.vm) { |
Copilot uses AI. Check for mistakes.
| max_vm_consumer.vm = mem_info_after.vm_size_bytes; | ||
| max_vm_consumer.pass_name = pass_name; | ||
| } | ||
| if(mem_info_after.vm_rss_bytes > max_rss_consumer.vm_rss) { |
Copilot
AI
Oct 16, 2025
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.
Both conditions check the same value (vm_rss_bytes). The first condition should check vm_size_bytes for VM memory tracking, and the second should check vm_rss_bytes for RSS tracking.
Copilot uses AI. Check for mistakes.
| } | ||
|
|
||
|
|
||
| static stopwatch m_pass_time; |
Copilot
AI
Oct 16, 2025
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.
Static member variables should be declared in the private section of the class, not in the middle of the public section. Move this declaration to the private section with other member variables.
Copilot uses AI. Check for mistakes.
Details:
Tickets: