Repository navigation
[MFU] Skip MFU display when FP8/MX quantization is active and add GB200/GB3… - #2451
Conversation
| # (FP8/MX) is active, so we skip it in that case. | ||
| tflops = self.num_flops_per_token * tps / 1e12 | ||
| if self.has_quantization: | ||
| mfu = None |
There was a problem hiding this comment.
can we set it to "N/A" here to avoid the
self.logger.log({k: v for k, v in metrics.items() if v is not None}, step) below? Not sure if it can be "logged"
There was a problem hiding this comment.
"N/A" cannot be handled by TensorBoard so I propose to put mfu into metrics dict only when it is not None.
| # Check if any converter uses quantization (FP8, MX, etc.) | ||
| has_quantization = any( | ||
| getattr(cc, "_quantization_type", None) is not None | ||
| for cc in config.model_converters.converters | ||
| ) |
There was a problem hiding this comment.
This is too hacky. A less hacky way is to let all quantization converters inherit QuantizationConverter parent class, and use isinstance(..., QuantizationConverter.Config) to test here.
There was a problem hiding this comment.
Sounds great. Built a wrapper config QuantizationConverter(Configurable).
| model_param_count, | ||
| self.metrics_processor.num_flops_per_token, | ||
| ) = model_config.get_nparams_and_flops(model, config.training.seq_len) | ||
| self.metrics_processor.has_quantization = has_quantization |
There was a problem hiding this comment.
let's put it in build arg, instead of doing this direct setter. Things can become hard to read / debug if we use too many direct setter.
| # BF16 dense per GPU: 2,500 TFLOPS (half of 5,000 TFLOPS with sparsity) | ||
| # data from https://www.nvidia.com/en-us/data-center/dgx-gb300 | ||
| return 2.5e15 | ||
| elif "GB200" in device_name: |
There was a problem hiding this comment.
let's consolidate the two entries
| ... | ||
|
|
||
|
|
||
| class QuantizationConverter(Configurable): |
There was a problem hiding this comment.
Because of proximity, let's put this in quantization folder, maybe quantization/init.py
| qt = getattr(config, "_quantization_type", None) | ||
| if qt is not None: | ||
| if isinstance(config, QuantizationConverter.Config): | ||
| qt = config._quantization_type |
There was a problem hiding this comment.
Can we just use the type of the config, instead of this extra string? If so, let's deprecate _quantization_type.
There was a problem hiding this comment.
Good suggestion. This is a little bit tricky. For example Float8GroupedMMConverter and Float8LinearConverter have the same quantization type float8. If we only compare the config types, these legitimate combination would be rejected. What do you think? There are ways to check this by using config's module, but i guess this is hacky.
There was a problem hiding this comment.
Oh good point. One way to do this is to let Float8 converters share an intermediate level of parent, e.g. Float8Converter. That seems not necessary for now, so let's keep what you are doing.
…00/GB3… (#2451) Hide MFU when quantization is active and add peak tflops for GB200 and GB300. This is a short-term answer to #560. Before this pr, when fp8 is enabled. MFU is displayed but over bf16 peak flops. <img width="968" height="320" alt="1-26 2311505,123 - го61 -" src="https://github.com/user-attachments/assets/0e77c8c4-c287-419e-a11f-a1afeadf1b67" /> After this pr, when fp8/mx quantization is active, MFU is shown to be N/A. <img width="1133" height="270" alt="6 71148 gred 10rk 2 445" src="https://github.com/user-attachments/assets/ce68464a-a1c2-4cfd-888b-595a41a7bf49" />
…00/GB3… (#2451) Hide MFU when quantization is active and add peak tflops for GB200 and GB300. This is a short-term answer to #560. Before this pr, when fp8 is enabled. MFU is displayed but over bf16 peak flops. <img width="968" height="320" alt="1-26 2311505,123 - го61 -" src="https://github.com/user-attachments/assets/0e77c8c4-c287-419e-a11f-a1afeadf1b67" /> After this pr, when fp8/mx quantization is active, MFU is shown to be N/A. <img width="1133" height="270" alt="6 71148 gred 10rk 2 445" src="https://github.com/user-attachments/assets/ce68464a-a1c2-4cfd-888b-595a41a7bf49" />
…00/GB3… (pytorch#2451) Hide MFU when quantization is active and add peak tflops for GB200 and GB300. This is a short-term answer to pytorch#560. Before this pr, when fp8 is enabled. MFU is displayed but over bf16 peak flops. <img width="968" height="320" alt="1-26 2311505,123 - го61 -" src="https://github.com/user-attachments/assets/0e77c8c4-c287-419e-a11f-a1afeadf1b67" /> After this pr, when fp8/mx quantization is active, MFU is shown to be N/A. <img width="1133" height="270" alt="6 71148 gred 10rk 2 445" src="https://github.com/user-attachments/assets/ce68464a-a1c2-4cfd-888b-595a41a7bf49" />
…00/GB3… (pytorch#2451) Hide MFU when quantization is active and add peak tflops for GB200 and GB300. This is a short-term answer to pytorch#560. Before this pr, when fp8 is enabled. MFU is displayed but over bf16 peak flops. <img width="968" height="320" alt="1-26 2311505,123 - го61 -" src="https://github.com/user-attachments/assets/0e77c8c4-c287-419e-a11f-a1afeadf1b67" /> After this pr, when fp8/mx quantization is active, MFU is shown to be N/A. <img width="1133" height="270" alt="6 71148 gred 10rk 2 445" src="https://github.com/user-attachments/assets/ce68464a-a1c2-4cfd-888b-595a41a7bf49" />
Hide MFU when quantization is active and add peak tflops for GB200 and GB300. This is a short-term answer to #560.
Before this pr, when fp8 is enabled. MFU is displayed but over bf16 peak flops.

After this pr, when fp8/mx quantization is active, MFU is shown to be N/A.
