-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
support for fp8 allgather FSDP #109654
support for fp8 allgather FSDP #109654
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3342,11 +3342,20 @@ c10::intrusive_ptr<Work> ProcessGroupNCCL::_allgather_base( | |
c10::cuda::CUDACachingAllocator::recordStream( | ||
output.storage().data_ptr(), stream); | ||
} | ||
|
||
ncclDataType_t nccl_dtype; | ||
if (input.scalar_type() == at::kFloat8_e5m2 || | ||
input.scalar_type() == at::kFloat8_e4m3fn) { | ||
nccl_dtype = ncclInt8; | ||
} else { | ||
nccl_dtype = getNcclDataType(input.scalar_type()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just curious, why not add the type mapping into Are we wanting to potentially have different behavior for the type depending on which collective we're in? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this is based on feedback from someone in the PyTorch team (I think it was in workplace chat). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
return ncclAllGather( | ||
input.data_ptr(), | ||
output.data_ptr(), | ||
input.numel(), | ||
getNcclDataType(input.scalar_type()), | ||
nccl_dtype, | ||
comm, | ||
stream.stream()); | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC for other types that aren't standard C++ types (i.e. float16, bfloat16) we just fill out the numerics_limit so this code works throughout the codebase and we don't need to special case each place.