Skip to content

Leverage TE wgrad accumulation fusion in MFSDP v2 #6942

Description

@wujingyue

MFSDP v2 currently materializes local wgrads, then copies them into the reduce-scatter input buffer.

In experimental/module.py::_reduce_gradient_groups(), MFSDP v2 allocates the partial-gradient buffer and calls copy_gradients_to_partial_buffer(). experimental/parameter_group.py::copy_gradients_to_partial_buffer() then copies each unsharded.grad into the corresponding partial-buffer view before reduce-scatter.

Transformer Engine wgrad accumulation fusion can write wgrads directly into a preallocated destination buffer. Using the MFSDP v2 reduce-scatter input views as that destination should eliminate this extra full-gradient copy, as well as the separate transient autograd-gradient buffer.

TE enables this through its wgrad-accumulation option and a preallocated main_grad-style destination.

Done when: supported TE linear layers write directly to MFSDP v2’s reduce-scatter input buffer; gradients match the existing path; and a benchmark reports memory and step-time impact.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions