-
Notifications
You must be signed in to change notification settings - Fork 9
Adding prefill decode markers to trace and enable shapes #156
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?
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 pull request adds profiler markers to distinguish between prefill and decode phases in PyTorch profiler traces, and introduces a new environment variable to enable shape recording independently of other detailed profiling features.
Changes:
- Added
ATOM_PROFILER_SHAPESenvironment variable to control shape recording in the profiler - Added nested profiler markers in
run_model()to mark prefill/decode phases, model forward passes, and CUDA graph replays - Added top-level profiler markers in
forward()to mark the entire forward pass phase
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
atom/model_engine/model_runner.py
Outdated
|
|
||
| with torch_profiler.record_function(f"forward_pass_{phase_marker}"): |
Copilot
AI
Jan 20, 2026
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 profiler marker naming is inconsistent between forward() and run_model(). In forward(), the markers are named "forward_pass_PREFILL" and "forward_pass_DECODE", while in run_model() they use "PREFILL_PHASE" and "DECODE_PHASE" with additional suffixes like "_model_forward" or "_cudagraph_replay_bs{graph_bs}". Consider using a consistent naming scheme across both methods for easier trace analysis, such as using "PHASE" suffix consistently or removing it from run_model().
| with torch_profiler.record_function(f"forward_pass_{phase_marker}"): | |
| with torch_profiler.record_function(f"{phase_marker}_PHASE"): |
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
|
thanks your contribution, @HaonanWang98 had a more powerful work on the way, i would l like that one |
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
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| logits = self.run_model(input_ids) | ||
| # Add top-level marker for the entire forward pass | ||
| is_prefill = batch.total_tokens_num_prefill > 0 | ||
| phase_name = "PREFILL" if is_prefill else "DECODE" |
Copilot
AI
Jan 22, 2026
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.
Trailing whitespace detected at the end of this line. Please remove the trailing spaces after the variable assignment.
| phase_name = "PREFILL" if is_prefill else "DECODE" | |
| phase_name = "PREFILL" if is_prefill else "DECODE" |
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist