-
Notifications
You must be signed in to change notification settings - Fork 427
[WIP] Document MX FP8 recipe #1350
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
Open
lessw2020
wants to merge
1
commit into
main
Choose a base branch
from
lessw2020/mxfp8_doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+23
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## MXFp8 Training on (G)B200 Blackwell - Experimental but available now for testing | ||
|
||
MXFP8 training can provide substantial training speedups for models running on Nvidia Blackwell architecture (G and B200s+). MX FP8 enables fine grained quantization, where 1 x 32 elements are quantized per a single U8ME0 scaling, and this scaling can be done via hardware. | ||
|
||
We have tested MXFP8 training at 1856 GPU Scale (Crusoe B200 cluster) and for Llama 3 70B model, we observed ~ 19% speedup with near equal or better convergence loss relative to BF16. | ||
|
||
Note that the 19% speedup is a baseline atm - we have work to do to immprove the performance due to bank conflicts in the current kernels. | ||
|
||
|
||
### Usage steps | ||
|
||
Please install latest nightly [TorchAO](https://github.com/pytorch/ao/tree/main/torchao/float8) to support mxfp8 dtype | ||
``` | ||
USE_CPP=0 python -m pip install --pre torchao --index-url https://download.pytorch.org/whl/nightly/cu128 | ||
``` | ||
|
||
For mxfp8 with 1x32 scaling, launch training job with the following command (or alternatively set configs in toml files) | ||
``` | ||
CONFIG_FILE="./torchtitan/models/llama3/train_configs/llama3_8b.toml" ./run_train.sh --model.converters mx --mx.recipe_name "mxfp8" --training.compile | ||
``` | ||
* `--model.converters="mx"`: use mx section for converting the linear layers | ||
* `--mx.recipe_name "mxfp8"`: swap nn.Linears from high precision to mxfp8 for internal computation. | ||
* `--training.compile` (required for competitive performance): use `torch.compile` to fuse the mxfp8 scaling/casting kernels |
Oops, something went wrong.
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.
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.
I think it's better if such claim (and most of this doc) is put in https://github.com/pytorch/torchtitan/tree/main/benchmarks