Uh oh!
There was an error while loading. Please reload this page.
[PyTorch] FSDP2 Support for TE with FP8 Model Init - #2245
Conversation
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
for more information, see https://pre-commit.ci
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
…ngine into fsdp2_issue_fix Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
for more information, see https://pre-commit.ci
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
…ngine into fsdp2_issue_fix
for more information, see https://pre-commit.ci
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
for more information, see https://pre-commit.ci
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
for more information, see https://pre-commit.ci
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
…rgst Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
…es when required instead of doing upfront in fwd pass Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
…ling in fsdp hook functions Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com> Signed-off-by: vthumbe1503 <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
for more information, see https://pre-commit.ci
vthumbe1503
commented
Nov 10, 2025
/te-ci L1 pytorch |
for more information, see https://pre-commit.ci
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
vthumbe1503
commented
Nov 10, 2025
/te-ci L1 pytorch |
| out_data.append(scale_inv_out) | ||
| return [ | ||
| MXFP8Tensor( | ||
| shape=splitted_tensor_data[0].size(), |
There was a problem hiding this comment.
logic:AttributeError when only columnwise data exists - splitted_tensor_data[0] will be None when _rowwise_data is None (lines 379-390 append None when data is None), causing .size() to fail
| shape=splitted_tensor_data[0].size(), | |
| shape=splitted_tensor_data[0].size()ifsplitted_tensor_data[0] isnotNoneelsesplitted_tensor_data[1].size(), |
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
for more information, see https://pre-commit.ci
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
…ngine into fsdp2_issue_fix Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
| return [ | ||
| MXFP8Tensor( | ||
| shape=splitted_tensor_data[0].size(), | ||
| dtype=tensor.dtype, | ||
| rowwise_data=splitted_tensor_data[0], | ||
| rowwise_scale_inv=splitted_tensor_data[2], | ||
| columnwise_data=splitted_tensor_data[1], | ||
| columnwise_scale_inv=splitted_tensor_data[3], | ||
| quantizer=tensor._quantizer, | ||
| requires_grad=False, | ||
| fp8_dtype=tensor._fp8_dtype, | ||
| ) | ||
| for splitted_tensor_data in zip(*out_data) | ||
| ] |
There was a problem hiding this comment.
logic:AttributeError when _rowwise_data is None - splitted_tensor_data[0] will be None when only columnwise usage is enabled (lines 383-394 append None when data is None), causing .size() call to fail on line 423
| return [ | |
| MXFP8Tensor( | |
| shape=splitted_tensor_data[0].size(), | |
| dtype=tensor.dtype, | |
| rowwise_data=splitted_tensor_data[0], | |
| rowwise_scale_inv=splitted_tensor_data[2], | |
| columnwise_data=splitted_tensor_data[1], | |
| columnwise_scale_inv=splitted_tensor_data[3], | |
| quantizer=tensor._quantizer, | |
| requires_grad=False, | |
| fp8_dtype=tensor._fp8_dtype, | |
| ) | |
| forsplitted_tensor_datainzip(*out_data) | |
| ] | |
| return [ | |
| MXFP8Tensor( | |
| shape=splitted_tensor_data[0].size()ifsplitted_tensor_data[0] isnotNoneelsesplitted_tensor_data[1].size(), | |
| dtype=tensor.dtype, | |
| rowwise_data=splitted_tensor_data[0], | |
| rowwise_scale_inv=splitted_tensor_data[2], | |
| columnwise_data=splitted_tensor_data[1], | |
| columnwise_scale_inv=splitted_tensor_data[3], | |
| quantizer=tensor._quantizer, | |
| requires_grad=False, | |
| fp8_dtype=tensor._fp8_dtype, | |
| ) | |
| forsplitted_tensor_datainzip(*out_data) | |
| ] |
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
for more information, see https://pre-commit.ci
| splitted_tensor_data[0].size() | ||
| if splitted_tensor_data[0] is not None | ||
| else None |
There was a problem hiding this comment.
logic:AttributeError when only columnwise_usage is enabled - splitted_tensor_data[0] (rowwise_data) will be None when tensor._rowwise_data is None (lines 383-394 append None when data is None), causing .size() to fail
| splitted_tensor_data[0].size() | |
| ifsplitted_tensor_data[0] isnotNone | |
| elseNone | |
| shape=( | |
| splitted_tensor_data[0].size() | |
| ifsplitted_tensor_data[0] isnotNone | |
| elsesplitted_tensor_data[1].size() | |
| ), |
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
…ngine into fsdp2_issue_fix Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Tim Moon <4406448+timmoon10@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Description
Motivation:
What this PR does?
Type of change
Changes
FSDP Allgather Hooks for FP8/MXFP8: Adds fsdp_pre_allgather and fsdp_post_allgather methods for for FP8/MXFP8 tensors, since allgather is only supported for native torch tensors with uint8/fp16/bf16/fp32 data types. fsdp_pre_all_gather method for us would return the uint8 sharded tensors for FP8/MXFP8 that we need to allgather and the metadata that is needed to reconstruct the FP8/MXFP8 tensor post allgather. Post_Allgather reconstructs the Float8/MXFP8 tensor from the allgathered uint8 data.
FP8/MXFP8 Torch Dispatch Functions for FSDP2 to handle ops on both rowwise/columnwise data(MXFP8), data/transpose(FP8). NOTE(Scale Inv Padding also handled for MXFP8 pre and post all gather).
Quantized Tensor Class Issues:
Validating rowwise/columnwise Usages for quantizers/tensors in TE Layers
Resetting Parameters for Deferred Initialization(meta device)
Test and Miscellaneous issues
Checklist:
Summary by CodeRabbit
Release Notes