This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
[wip] make all 3 gemms in float8 linear configurable #258
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This PR ensures each of the 3 gemms in fw+bw of the float8 linear can have its own configuration.
The user interface is clean: the float8 module has separate configs for each of the gemms. Configuring this can be exposed in module utilites in a future PR.
The implementation is a bit ugly. given the 3 gemms in fw+bw
and the fact that a
torch.mm
doesn't have access to any global state other than its arguments, we need to ensure that the matmul arguments contain the right state to map to the right config. We adopt a simple set of rules to do this:3a. set X's config for arg0 to config_Y
3b. set W's config for arg0 and arg1 to None
3c. set gradY's config for arg0 to config_gradX, and for arg1 to
config_gradW
If 3 is done correctly, following 1 and 2 will lead to the right config being used for each gemm. It's ugly, but it works.
Test Plan:
for now, works on single GPU
just a question of eng time to also make the distributed tests pass
Reviewers:
Subscribers:
Tasks:
Tags: