Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

FP8 inductor fullgraph test: allow one ulp on GPUs where Inductor fuses the dequant (#15107)

Daniel Hane5c2cd6a3c4c
diff --git a/tests/test_fp8_scale_dequant_one_pass.py b/tests/test_fp8_scale_dequant_one_pass.py
index 0cc033e914a..827faf079ce 100644
--- a/tests/test_fp8_scale_dequant_one_pass.py
+++ b/tests/test_fp8_scale_dequant_one_pass.py
@@ -214,4 +214,9 @@ def test_inductor_fullgraph_dequant_matches_eager(F, dtype, layout):
ref = _reference(q, s.view(1, 1) if layout == "tensor" else s, dtype)
torch._dynamo.reset()
out = torch.compile(lambda a, b: F.weight_dequant(a, b, dtype), fullgraph = True)(q, s)
- _assert_same_bits(out, ref)
+ if F._fp8_e4m3fn_unsupported_in_trace(q):
+ _assert_same_bits(out, ref)
+ else:
+ # sm89+: Inductor fuses the torch expression itself and may round bf16 one ulp from eager.
+ ulp = 2.0**-7 if dtype == torch.bfloat16 else 2.0**-10
+ torch.testing.assert_close(out, ref, rtol = ulp, atol = 0, equal_nan = True)