Pass normalized speed mode to fp16 accumulation gate

The raw speed_mode string was forwarded to _enable_fp16_accumulation, so a
case-variant like MAX failed the speed_mode != SPEED_MAX check and wrongly
disabled fp16 accumulation on float16 pipelines. Forward the normalized mode
and cover the case-insensitive path in the test.
This commit is contained in:
Daniel Han 2026-07-05 00:06:38 +00:00
commit fec66a5392
2 changed files with 2 additions and 2 deletions

View file

@ -218,7 +218,7 @@ def apply_speed_optims(
# and the UNSLOTH_DISABLE_FP16_ACCUM kill switch.
if on_cuda:
applied["fp16_accum"] = _enable_fp16_accumulation(
family, logger, dtype = getattr(target, "dtype", None), speed_mode = speed_mode
family, logger, dtype = getattr(target, "dtype", None), speed_mode = mode
)
# --- the compile lever, remapped per tier ----------------------------------------

View file

@ -485,7 +485,7 @@ def test_fp16_accum_allowed_on_fp16_dtype_under_max(monkeypatch):
_target(dtype = "float16"),
is_gguf = True,
family = _family(),
speed_mode = "max",
speed_mode = "MAX",
)
assert applied["fp16_accum"] is True
assert torch.backends.cuda.matmul.allow_fp16_accumulation is True