From 0b736f7702aa9693e4bbcf422ca78c74cd271cb4 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Tue, 20 Oct 2026 18:37:04 +0200 Subject: [PATCH] Gyro on the Mac: model list tests, resident wrap span without the n-gram table, trellis gate/up tile --- metal/src/engine/window.cpp | 9 +++++++-- tools/test_strata_mcp.py | 10 +++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/metal/src/engine/window.cpp b/metal/src/engine/window.cpp index 25a89290..db875e8b 100644 --- a/metal/src/engine/window.cpp +++ b/metal/src/engine/window.cpp @@ -459,7 +459,9 @@ bool Window::init(const strata::core::ModelGeometry& g, strata::core::SessionSta // the chunks of a model bigger than one Metal buffer overlap by the largest range bound at one offset: a tensor, // or a layer's routed experts (gate, up and down, bound together at the first of them: moe_rebase) size_t span = 0; - for (const auto& kv : f_.tensors) span = std::max(span, kv.second.bytes); + // (not the n-gram table: the host reads it from the SSD, the GPU never binds it - in a Gyro file it is 28.8 GB of the one file) + for (const auto& kv : f_.tensors) + if (kv.first != "per_layer_token_embd.weight") span = std::max(span, kv.second.bytes); for (int l = 0; l < 48; ++l) { const std::string b = "blk." + std::to_string(l) + "."; const gguf::Tensor *g = f_.find(b + "ffn_gate_exps.weight"), *u = f_.find(b + "ffn_up_exps.weight"), @@ -896,7 +898,10 @@ void Window::layer(std::vector& ds, int l, int ntok, int64_t pos0 a.topk = TOPK; a.n_expert = NEXP; const bool dq2 = td.type == ref::Q2_0; - const int gl = 32, gr = 1, gs = 4, ds_ = 4; + // the trellis gate/up: 16 lanes a row, 2 rows a lane (expert_parity --bench --sweep, M4, TQK6, 10 experts: 166.6 us a layer + // against 174.5 for 32,2,4 and 196.8 for 32,1,4; also the fastest at 2 and 3 tokens) + const bool tq_ = tg_.type >= 144; + const int gl = tq_ ? 16 : 32, gr = tq_ ? 2 : 1, gs = 4, ds_ = 4; // the down tile: Q2_0 8,1; else 4,2 - but on the M4 (no M5 layout) Q5_1 4,1 and Q8_0 8,1 (4,2 spills there: // 24-36 GB/s, mac-kern 513fc615) const bool m4 = !m5_layout(); diff --git a/tools/test_strata_mcp.py b/tools/test_strata_mcp.py index 7634c8d7..df5be39b 100644 --- a/tools/test_strata_mcp.py +++ b/tools/test_strata_mcp.py @@ -726,18 +726,22 @@ class MacCatalog(unittest.TestCase): def test_the_model_list_is_the_macs_sizes_with_unified_memory_verdicts(self): s, hw = self.hw(32) fams = s.model_table(hw) - self.assertEqual([f["family"] for f in fams], ["qwen"], "no Unsloth, Swift or NVFP4 on a Mac in the app") + self.assertEqual([f["family"] for f in fams], ["qwen", "gyro"], "no Unsloth, Swift or NVFP4 on a Mac in the app; Gyro after the regular sizes") by = {x["model"]: x for x in fams[0]["sizes"]} self.assertEqual(list(by), ["Q2_0", "IQ3_XXS", "IQ3_S"]) + gy = {x["model"]: x for x in fams[1]["sizes"]} + self.assertEqual(list(gy), ["Gyro-S", "Gyro-M"]) + self.assertEqual(gy["Gyro-S"]["download_gb"], 58.5) + self.assertTrue(all(v["on_this_pc"] and "SSD" in v["on_this_pc"] for v in gy.values()), "32 GB: both stream (said, not refused)") self.assertIn("read from the SSD", by["Q2_0"]["on_this_pc"]) self.assertIn("slower", by["Q2_0"]["on_this_pc"]) self.assertIn("~14 tok/s", by["Q2_0"]["on_this_pc"]) self.assertTrue(by["IQ3_S"]["on_this_pc"].startswith("slow here")) self.assertTrue(all(x["images"] for x in by.values()), "the Mac engine carries the Metal picture reader: pictures are on") s, hw = self.hw(128) - self.assertEqual({x["on_this_pc"] for x in s.model_table(hw)[0]["sizes"]}, {"fits"}) + self.assertEqual({x["on_this_pc"] for f in s.model_table(hw) for x in f["sizes"]}, {"fits"}) s, hw = self.hw(8) - self.assertEqual({x["on_this_pc"] for x in s.model_table(hw)[0]["sizes"]}, {"does not fit"}) + self.assertEqual({x["on_this_pc"] for f in s.model_table(hw) for x in f["sizes"]}, {"does not fit"}) def test_the_install_plan_on_a_mac_has_no_card_kv_or_ram_options(self): s, hw = self.hw(32)