-
Notifications
You must be signed in to change notification settings - Fork 21
[DEV][PROFILER] Case 2: Add for-loop unroll tracking to Profiler #197
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
Conversation
Add functionality to track for-loop iteration counts in the Profiler client to help identify loops that can potentially be unrolled. Changes: - Add disable_for_loop_unroll_check parameter to Profiler.__init__ - Implement register_for_loop_callback to track loop line numbers and step counts - Deduplicate loop tracking by line number (same loop executed in different blocks) - Display loop statistics in finalize() method - Add test_for_loop_statistics test to verify tracking functionality
| result = result + 1.0 | ||
|
|
||
| # Second for-loop: 5 iterations | ||
| for j in range(5): |
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.
How about tl.range and tl.static_range? If already static we don't need to unroll the loop
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.
Done. Now the loop callback returns range type.
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.
For some reason the current for-loop callbacks are not managed by ClientManager but by class _CombinedLoopHooks. I will move those code back to ClientManager in the future refactoring.
- Extended for_loop_test_kernel to include tl.range and tl.static_range loops - Updated test_for_loop_statistics to verify different range types (python_range, tl_range, tl_static_range) - Modified test assertions to match new loop_info structure with range_type and length attributes - Added validation for 4 different loop types with their expected iteration counts
|
@Jokeren Please review the latest code. |
Add functionality to track for-loop iteration counts in the Profiler client to help identify loops that can potentially be unrolled.
Changes: