Skip to content
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

Adding the new feature of FPDT #6462

Open
wants to merge 70 commits into
base: master
Choose a base branch
from
Open

Conversation

YJHMITWEB
Copy link
Collaborator

@YJHMITWEB YJHMITWEB commented Aug 29, 2024

FPDT can only be used with this version of Megatron-DeepSpeed.

return out, lse


def single_all_to_all(input_, scatter_idx, gather_idx, group):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @YJHMITWEB is this single_all_to_all the same as the one in

def single_all_to_all(input, scatter_idx, gather_idx, batch_dim_idx, group, async_op=False, handle=None, type=None):
?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not tested the non-blocking All2all with our FPDT design, therefore, we use the original non-blocking version. If this is preferred, we can test this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed. We will now use the single_all_to_all from layer.py


compute_stream.wait_stream(offload_stream)
compute_stream.synchronize()
with torch.cuda.stream(offload_stream):
Copy link
Collaborator

@delock delock Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

torch.cuda.stream(stream) should be replaced by get_accelerator().stream(stream), same of other occurance in this file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

grad_qkv_linear_bias = torch.zeros(qkv_linear_bias.shape, device=qkv_linear_weight.device, dtype=torch.float)

grad_global_attn_output_chunk = single_all_to_all(grad_output[:, :chunk_size].contiguous(), scatter_idx, gather_idx, spg)
torch.cuda.synchronize()
Copy link
Collaborator

@delock delock Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is should be get_accelerator().synchronize()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is solved.

@@ -168,7 +196,8 @@ def __init__(
self.gather_idx = gather_idx
self.sp_overlap_comm = False
self.overlap_handles = None
self.sp_stream = sp_stream
self.sp_stream = None
# self.sp_stream = sp_stream
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment out this line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is solved.

@tohtana tohtana requested a review from loadams as a code owner October 10, 2024 15:49
@tohtana tohtana self-requested a review November 6, 2024 16:45
- '.github/workflows/nv-flash-attn.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a cron trigger as well to this? And perhaps the Nightly CI failure issue creation from here - that way if a PR doesn't trigger this we will still know if it fails?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @loadams for the suggestion! I added both. Can you check them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants