Inference: Add the embedding and output layer in the full_iteration_inference cuda graph scope for hybrid models - #4440
Conversation
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Does this work when the CUDA graph scope is something other than If not, could you please leave a comment in the code mentioning this, so that it doesn't trip up future users. |
|
This does not capture the Overall, these uncaptured calls add latency and unnecessary memcopies. References:
EDIT: Approved; the other sites will be handled by a different PR. |
mathemakitten
left a comment
There was a problem hiding this comment.
LGTM. Can you document the speedup?
| """ | ||
| if ( | ||
| not self.training | ||
| and hasattr(self, 'cudagraph_manager') |
There was a problem hiding this comment.
Are we sure that and kwargs['attention_mask'] is None is no longer load-bearing? I think it is now superfluous because of the check against inference_context but just double checking.
There was a problem hiding this comment.
attention_mask seems like a superfluous check. On this note, we need a standardized way to check if we are in inference_mode. Every module seems to be doing it's own thing atm :). Some check if torch grad is enabled, other's check for the inference context etc.
|
@mathemakitten we gain around 200-300us with this. |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/24908769581 |
…nference cuda graph scope for hybrid models (NVIDIA#4440)
…nference cuda graph scope for hybrid models (NVIDIA#4440) Signed-off-by: yhgalaxy <yhgalaxy@outlook.com>
…nference cuda graph scope for hybrid models (NVIDIA#4440) Signed-off-by: Jon Barker <jbarker@aws-cmh-slurm-1-vscode-02.cm.cluster>
…nference cuda graph scope for hybrid models (NVIDIA#4440)
Signed-off-by: Teodor-Dumitru Ene <teodord.ene@gmail.com>
What does this PR do ?
Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
Code review
Feel free to message or comment the @mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.
For MRs into `dev` branch
The proposed review process for `dev` branch is under active discussion.MRs are mergable after one approval by either
eharper@nvidia.comorzijiey@nvidia.com.