|
20 | 20 | import pytest |
21 | 21 |
|
22 | 22 | from megatron.bridge.perf_recipes.llama.gb200.llama3 import ( |
| 23 | + llama3_8b_pretrain_8gpu_gb200_nvfp4_config, |
23 | 24 | llama3_70b_pretrain_64gpu_gb200_nvfp4_config, |
24 | 25 | ) |
25 | 26 | from megatron.bridge.perf_recipes.llama.h100.llama3 import ( |
@@ -139,3 +140,28 @@ def test_llama3_70b_gb200_nvfp4_captures_whole_transformer_layer(monkeypatch: py |
139 | 140 | assert cfg.model.pipeline_model_parallel_size == 4 |
140 | 141 | assert cfg.model.virtual_pipeline_model_parallel_size == 5 |
141 | 142 | assert cfg.train.global_batch_size == 256 |
| 143 | + |
| 144 | + |
| 145 | +@pytest.mark.unit |
| 146 | +def test_llama3_8b_gb200_nvfp4_runs_dpa_in_fp8_current_scaling(monkeypatch: pytest.MonkeyPatch) -> None: |
| 147 | + """The 8-GPU GB200 NVFP4 recipe runs dot-product attention in FP8 current scaling. |
| 148 | +
|
| 149 | + NVFP4BlockScaling takes ``fp8_dpa`` from ``fp8_dot_product_attention`` independently of |
| 150 | + ``config.fp8``, so the flag is live under the FP4 recipe rather than inert. |
| 151 | + ``NVTE_DPA_FP8_RECIPE`` selects the FP8 recipe TE uses for that attention path, and must be |
| 152 | + part of the inline ``env_vars`` dict so the recipe-environment test sees it. |
| 153 | + """ |
| 154 | + patch_recipe_construction_dependencies(monkeypatch) |
| 155 | + |
| 156 | + cfg = llama3_8b_pretrain_8gpu_gb200_nvfp4_config() |
| 157 | + |
| 158 | + assert cfg.mixed_precision.fp8_dot_product_attention is True |
| 159 | + assert cfg.mixed_precision.fp4 == "e2m1" |
| 160 | + assert cfg.mixed_precision.fp4_recipe == "nvfp4" |
| 161 | + assert cfg.env_vars["NVTE_DPA_FP8_RECIPE"] == "Float8CurrentScaling" |
| 162 | + |
| 163 | + # Parallelism and batch are unchanged by this setting. |
| 164 | + assert cfg.model.tensor_model_parallel_size == 1 |
| 165 | + assert cfg.model.pipeline_model_parallel_size == 1 |
| 166 | + assert cfg.train.global_batch_size == 128 |
| 167 | + assert cfg.train.micro_batch_size == 4 |
0 commit comments