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: run the RoPE 64-bit indexing metadata check on CPU-only runners (#16226)

Daniel Hane64e494220ea
diff --git a/tests/test_decode_fused_rope.py b/tests/test_decode_fused_rope.py
index b6957c6f924..05bca1d0fd7 100644
--- a/tests/test_decode_fused_rope.py
+++ b/tests/test_decode_fused_rope.py
@@ -256,25 +256,6 @@ def test_decode_rope_on_another_device_orders_with_the_copy():
assert (k0.cpu().float() - ku.cpu().float()).abs().max().item() <= 2 * ulp
-def test_a_cos_table_past_int32_offsets_takes_64_bit_indexing():
- # Meta tensors and a launch stub: only the constexprs the launcher picks are read.
- def launched(rows):
- seen = {}
-
- class _Grid:
- def __getitem__(self, grid):
- return lambda *args, **kwargs: seen.update(kwargs)
-
- cos = torch.empty(rows, 128, device = "meta", dtype = torch.float16)
- q = torch.empty(2, 8, 1, 128, device = "meta", dtype = torch.float16)
- k = torch.empty(2, 2, 1, 128, device = "meta", dtype = torch.float16)
- RE._rope_launch(q, q, k, k, cos, cos, None, False, False, False, lambda fn: _Grid())
- return seen["LONG_INDEXING"]
-
- assert launched(2**31 // 128 + 4)
- assert not launched(4096)
-
-
@pytest.mark.gpu
def test_decode_rope_past_int32_cache_offsets_matches_the_reference():
head_dim = 128
diff --git a/tests/test_rope_long_indexing_meta.py b/tests/test_rope_long_indexing_meta.py
new file mode 100644
index 00000000000..80321a54603
--- /dev/null
+++ b/tests/test_rope_long_indexing_meta.py
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved.
+
+"""RoPE launch constexprs via meta tensors + a launch stub: no device, so CPU-only runners collect it."""
+
+import pytest
+import torch
+
+pytest.importorskip("triton")
+
+import unsloth # noqa: F401
+from unsloth.kernels import rope_embedding as RE
+
+
+def test_a_cos_table_past_int32_offsets_takes_64_bit_indexing():
+ def launched(rows):
+ seen = {}
+
+ class _Grid:
+ def __getitem__(self, grid):
+ return lambda *args, **kwargs: seen.update(kwargs)
+
+ cos = torch.empty(rows, 128, device = "meta", dtype = torch.float16)
+ q = torch.empty(2, 8, 1, 128, device = "meta", dtype = torch.float16)
+ k = torch.empty(2, 2, 1, 128, device = "meta", dtype = torch.float16)
+ RE._rope_launch(q, q, k, k, cos, cos, None, False, False, False, lambda fn: _Grid())
+ return seen["LONG_INDEXING"]
+
+ assert launched(2**31 // 128 + 4)
+ assert not launched(4096)