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

why close ag overlap when is_grad_enabled is False #1398

Open
sallyjunjun opened this issue Jan 10, 2025 · 1 comment
Open

why close ag overlap when is_grad_enabled is False #1398

sallyjunjun opened this issue Jan 10, 2025 · 1 comment

Comments

@sallyjunjun
Copy link

When I test model with full recomputation, the forward all-gather communication is not overlapped. Because is_grad_enabled is false when forward with full recomputation. I see the following code in _LayerNormLinear class:

    if ub_overlap_ag:
        tp_world_size = get_distributed_world_size(tp_group)
        if tp_world_size == 1 or (not is_grad_enabled):
            ub_overlap_ag = False
    if ub_overlap_ag:
        dim_size = list(inputmat.size())
        dim_size[0] = dim_size[0] * tp_world_size
        ub_obj_lnout = get_ub(ub_name + "_fprop")
        if return_layernorm_output:
            # First prepare LN output in higher precision,
            # which will be later copied to a FP8 UB
            ln_out = torch.empty_like(inputmat, memory_format=torch.contiguous_format)
        else:
            ln_out = ub_obj_lnout.get_ubuf_output(0)

Why ub_overlap_ag is set to False in '(not is_grad_enabled)' condition?

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

No branches or pull requests

2 participants
@sallyjunjun and others