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.

Tests: FP8 routing tests pin the NVIDIA path so they pass on ROCm runners (#15838)

Daniel Han338616d87190
diff --git a/tests/test_fp8_dequant_max_rows.py b/tests/test_fp8_dequant_max_rows.py
index 44ef0662f02..11bffe98a06 100644
--- a/tests/test_fp8_dequant_max_rows.py
+++ b/tests/test_fp8_dequant_max_rows.py
@@ -16,6 +16,8 @@ LARGE = (14336, 4096) # Llama-3.1-8B MLP: 112 MiB in bf16
@pytest.fixture
def route(monkeypatch):
+ # NVIDIA routing; on ROCm the direct path is off and every call keeps the compiled path.
+ monkeypatch.setattr(torch.version, "hip", None, raising = False)
monkeypatch.setattr(F8, "_fp8_rowwise_backend", lambda device: "scaled_mm")
monkeypatch.setattr(F8, "_FP8_ROWWISE_DIRECT", True)
diff --git a/tests/test_fp8_rowwise_direct_route.py b/tests/test_fp8_rowwise_direct_route.py
index 891444b1ed9..28c1cc1b314 100644
--- a/tests/test_fp8_rowwise_direct_route.py
+++ b/tests/test_fp8_rowwise_direct_route.py
@@ -13,6 +13,8 @@ from unsloth.kernels import fp8 as F8
@pytest.fixture
def spies(monkeypatch):
calls = []
+ # NVIDIA routing; ROCm runners report a HIP version and keep the compiled path (tested below).
+ monkeypatch.setattr(torch.version, "hip", None, raising = False)
monkeypatch.setattr(F8, "_fp8_rowwise_backend", lambda device: "scaled_mm")
monkeypatch.setattr(F8, "_FP8_ROWWISE_DIRECT", True)
monkeypatch.setattr(
@@ -142,3 +144,11 @@ def test_compile_disabled_keeps_the_eager_wrapper():
assert F8._fp8_rowwise_direct_enabled("1", compile_disabled = False) is True
for off in ("0", "false", "No", " off "):
assert F8._fp8_rowwise_direct_enabled(off, compile_disabled = False) is False
+
+
+def test_rocm_keeps_the_compiled_path(spies, monkeypatch):
+ monkeypatch.setattr(torch.version, "hip", "7.0", raising = False)
+ with FakeTensorMode(), torch.no_grad():
+ assert F8.fbgemm_fp8_linear(*_args(32)) == "compiled"
+ assert F8.fbgemm_fp8_linear(*_args(128)) == "compiled"
+ assert spies == ["compiled", "compiled"]