diff --git a/terminal/setup.py b/terminal/setup.py index 11439bfcbe..3ca59d6934 100644 --- a/terminal/setup.py +++ b/terminal/setup.py @@ -9597,6 +9597,7 @@ def _select_sycl_cards(a, cards: list[dict]) -> list[dict]: return list(cards[:1]) +INTEL_FAST_MIN_RAM_GB = 32 # IQ2_XS / IQ3_S with the DFlash2 drafter on an Intel Arc (the default since 2026-12-03): QFN-B70's B70 box with 32 GB: free RAM down to 10.6 GiB (IQ2_XS) and 6.2 GiB (IQ3_S, commit 44 GiB): said, not refused INTEL_GGUF_MIN_RAM_GB = 24 # an Arc run of a Qwen size keeps about 20 GB of the PC's RAM busy (QFN-B70, the B70 box with 32 GB: 20 GB free at the lowest with IQ3_S): said, not refused @@ -9674,6 +9675,11 @@ def intel_control_setup(a) -> int: sel_cards = _select_sycl_cards(a, cards) if cards else [] vram = max((float(c.get("vram_gb") or 0) for c in (sel_cards or cards)), default=0.0) ok("graphics card: " + (", ".join(f"{c['name']} ({c['vram_gb']:g} GB)" for c in cards) or "an Intel Arc")) + from strata_control import drafting as _drafting + _ram = ram_gb() + if model in ("IQ2_XS", "IQ3_S") and family in ("qwen", "coder") and not _drafting.INTEL_PLAIN_BY_DEFAULT and _ram and _ram < INTEL_FAST_MIN_RAM_GB: + warn(f"this computer has {_ram:.0f} GB of RAM: {model} with the fast drafter (DFlash2) on an Intel Arc needs about {INTEL_FAST_MIN_RAM_GB} GB; with less it may run slowly or not start. " + "Choose drafting Off for the plain mode, which needs less.") if a.check: return 0 SHAPE_ENGINE.clear() diff --git a/terminal/strata_cli/launch/adopt.py b/terminal/strata_cli/launch/adopt.py index 93194f4174..c41b56199b 100644 --- a/terminal/strata_cli/launch/adopt.py +++ b/terminal/strata_cli/launch/adopt.py @@ -317,8 +317,9 @@ def plan(*, family: str, model: str, model_dir: Path, data_dir: Path, src: Path, return None, [f"the expert profile {prof} is missing"] from strata_control import intel_app args += ["--expert-profile", str(prof), "--expert-cache", "auto", "--prefill", "4096", "--spec", "2"] - if not intel_app.QWEN_SYCL_WINDOWS_PACKS.get(str(model), True): # IQ2_XS / IQ3_S: plain decode (a 2-token window with the suffix drafter off; the engine needs T >= 2 for a native pack) - args += ["--suffix-draft", "0"] + from strata_control import drafting as _drafting + if not intel_app.QWEN_SYCL_WINDOWS_PACKS.get(str(model), True) and (_drafting.INTEL_PLAIN_BY_DEFAULT or _drafting.normalize(drafting) == "off"): + args += ["--suffix-draft", "0"] # IQ2_XS / IQ3_S: plain decode (a 2-token window with the suffix drafter off; the engine needs T >= 2 for a native pack), when it is the default or Off was chosen else: args += ["--expert-profile", str(profile), "--expert-cache", "auto", "--prefill", "auto", "--spec", "4", "--spec-min-p", "0.5"] if mtp.exists() and not feed and not win_sycl: # the Flash-Next draft layer is not a feed model's own (a feed entry carries no MTP head yet) diff --git a/terminal/strata_control/drafting.py b/terminal/strata_control/drafting.py index b7db9f1063..010b1af0ec 100644 --- a/terminal/strata_control/drafting.py +++ b/terminal/strata_control/drafting.py @@ -1547,10 +1547,12 @@ def canonical_pack(args: list[Any] | None = None) -> bool: return False -#: Intel Arc (the SYCL engine), Qwen3.8-Flash-Next IQ2_XS and IQ3_S: Auto is NO drafter, the plain decode QFN-B70 gated on the B70. With DFlash2 (Auto's pick wherever the engine has it) the Windows run starts with +#: Owner decision 2026-12-03 09:05: Qwen IQ2_XS and IQ3_S on an Intel Arc on Windows default to FAST mode (DFlash2, --spec 6), the same as Linux Arc, so this is False; plain decode stays available (below). +#: Intel Arc (the SYCL engine), Qwen3.8-Flash-Next IQ2_XS and IQ3_S: True = Auto is NO drafter, the plain decode QFN-B70 gated on the B70. With DFlash2 (Auto's pick wherever the engine has it) the Windows run starts with #: `--spec 6` and the drafter (decode 77-114 tok/s, about twice plain, acceptance 90 %), which was not gated: speculation with this pack is not bit-equal to plain decode (near-tie flips from token 56 to 185 with spec 2). -#: ONE switch: set False and Auto is DFlash2 on Intel again if the owner chooses speed over exact answers (the person can name a drafter in Settings either way). -INTEL_PLAIN_BY_DEFAULT = True +#: ONE switch: False (now) = Auto is DFlash2 on Intel (speed); True = plain decode by default (exact). The person can name a drafter or Off in Settings either way: with Off a Windows Intel IQ2_XS / IQ3_S install is written +#: with `--suffix-draft 0` (strata_cli/launch/adopt.py), which is the plain decode (a 2-token window, no draft proposed). +INTEL_PLAIN_BY_DEFAULT = False #: The platforms it applies to (sys.platform prefixes). Windows only for now: that is where the B70 gate measured it and where the app's Load put DFlash2 on without a gate. Linux Arc keeps its tuned #: DFlash2 default for IQ3_S (CLASS_DEFAULTS, tests/terminal/test_drafting_tuned.py); add "linux" here, and update those tests, if the owner wants the plain decode there too. INTEL_PLAIN_PLATFORMS = ("win",) diff --git a/terminal/tests/terminal/test_intel_download.py b/terminal/tests/terminal/test_intel_download.py index a580fafae8..0b5870c1e6 100644 --- a/terminal/tests/terminal/test_intel_download.py +++ b/terminal/tests/terminal/test_intel_download.py @@ -141,7 +141,8 @@ class ArcInstall(unittest.TestCase): self.assertEqual(self.packed, str(data / "packs" / "iq2_xs")) cfg = json.loads((home / "strata-iq2_xs.json").read_text(encoding="utf-8")) a = cfg["args"] - self.assertEqual((cfg["backend"], a[a.index("--spec") + 1], a[a.index("--suffix-draft") + 1]), ("sycl", "2", "0")) # IQ2_XS on Windows: plain decode + self.assertEqual((cfg["backend"], a[a.index("--spec") + 1]), ("sycl", "2")) + self.assertNotIn("--suffix-draft", a) # IQ2_XS on Windows: fast mode by default (owner, 2026-12-03): the drafting rule adds DFlash2 at Load, nothing forces plain def test_a_pack_that_is_not_gated_on_windows_keeps_the_block_with_its_words(self): with tempfile.TemporaryDirectory() as t: @@ -176,6 +177,19 @@ class ArcInstall(unittest.TestCase): self.run_setup(self.args(), data, home, ram=16.0) self.assertTrue(any(m.startswith("WARN") and "16 GB of RAM" in m for m in self.said), self.said) + def test_the_fast_drafter_ram_note(self): + with tempfile.TemporaryDirectory() as t: + t = Path(t) + data, home = t / "Strata-data", t / "install" + data.mkdir() + home.mkdir() + self.run_setup(self.args(model="IQ3_S"), data, home, ram=16.0) + self.assertTrue(any(m.startswith("WARN") and "32 GB" in m and "DFlash2" in m for m in self.said), self.said) + self.run_setup(self.args(model="IQ3_S"), data, home, ram=64.0) + self.assertFalse(any("DFlash2" in m for m in self.said), self.said) + self.run_setup(self.args(model="IQ2_XS", family="qwen"), data, home, ram=64.0) + self.assertFalse(any("32 GB" in m for m in self.said), self.said) + def test_files_that_are_there_download_nothing(self): with tempfile.TemporaryDirectory() as t: t = Path(t) diff --git a/terminal/tests/terminal/test_qwen_windows_intel.py b/terminal/tests/terminal/test_qwen_windows_intel.py index fa06baba73..c97e78f5cc 100644 --- a/terminal/tests/terminal/test_qwen_windows_intel.py +++ b/terminal/tests/terminal/test_qwen_windows_intel.py @@ -40,11 +40,11 @@ class Tree: for i in (1, 2): (self.models / f"Qwen3.8-Flash-Next-GSQ-RCO-{pack_name.split('-')[-1].upper()}-0000{i}-of-00002.gguf").write_bytes(b"x") - def plan(self, model: str, platform: str, context: int = 32768, vram_gb: float = 32.0): + def plan(self, model: str, platform: str, context: int = 32768, vram_gb: float = 32.0, drafting=None): fam = setup.FAMILIES[self.family] return adopt.plan(family=self.family, model=model, model_dir=self.models, data_dir=self.data, src=self.src, context=context, kv="int8", model_name=f"{fam.get('name', self.family)}-{model.lower()}", family_def=fam, log=self.root / "x.log", backend="sycl", - pack_name=self.pack.name, vram_gb=vram_gb, platform=platform) + pack_name=self.pack.name, vram_gb=vram_gb, platform=platform, drafting=drafting) def value(args, flag): @@ -81,7 +81,14 @@ class WindowsFlags(unittest.TestCase): a = cfg["args"] self.assertEqual(value(a, "--vram-reserve-mib"), "2048") self.assertEqual(value(a, "--expert-profile"), str(t.src / "data" / "expert-profile-sycl.bin")) - self.assertEqual((value(a, "--spec"), value(a, "--prefill"), value(a, "--suffix-draft")), ("2", "4096", "0")) # IQ2_XS: plain decode (a 2-token window, the suffix drafter off: spec 2 with it is not bit-equal to plain decode here) + self.assertEqual((value(a, "--spec"), value(a, "--prefill")), ("2", "4096")) + self.assertNotIn("--suffix-draft", a) # IQ2_XS: fast mode by default (DFlash2 at Load, owner 2026-12-03); plain decode is the Off choice or the constant + cfg2, _p = t.plan("IQ2_XS", "win32", context=65536, drafting="off") + self.assertEqual(value(cfg2["args"], "--suffix-draft"), "0") # Off: the plain decode (a 2-token window, no draft proposed) + from strata_control import drafting + with mock.patch.object(drafting, "INTEL_PLAIN_BY_DEFAULT", True): + cfg3, _p = t.plan("IQ2_XS", "win32", context=65536) + self.assertEqual(value(cfg3["args"], "--suffix-draft"), "0") # the constant: plain by default again self.assertNotIn("--spec-min-p", a) def test_linux_keeps_its_flags(self): @@ -113,8 +120,8 @@ class WindowsRoute(unittest.TestCase): class PlainDecodeOnIntel(unittest.TestCase): - """IQ2_XS and IQ3_S on the SYCL engine on Windows: Auto drafting is NO drafter (the plain decode QFN-B70 gated), in the app's Load and in the Terminal; one constant (drafting.INTEL_PLAIN_BY_DEFAULT) turns - DFlash2 back on, another (INTEL_PLAIN_PLATFORMS) adds Linux.""" + """IQ2_XS and IQ3_S on the SYCL engine on Windows: fast mode (DFlash2) by default since the owner's decision of 2026-12-03 (drafting.INTEL_PLAIN_BY_DEFAULT = False), like Linux Arc. The plain-decode machinery stays behind + the constant (Auto = no drafter on a platform of INTEL_PLAIN_PLATFORMS), and Off is the plain decode in the install's flags.""" NAMES = ("qwen3.8-flash-next-iq2_xs", "qwen3.8-flash-next-iq3_s") @@ -124,43 +131,36 @@ class PlainDecodeOnIntel(unittest.TestCase): p.start() self.addCleanup(p.stop) - def test_auto_means_no_drafter_for_the_two_packs_on_sycl_only(self): + def test_the_default_is_fast_mode_on_windows_intel(self): from strata_control import drafting + self.assertFalse(drafting.INTEL_PLAIN_BY_DEFAULT) for name in self.NAMES: - self.assertTrue(drafting.intel_plain("sycl", name), name) - self.assertEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off") + self.assertFalse(drafting.intel_plain("sycl", name), name) d = drafting.decide("auto", model_name=name, backend="sycl", data_dir=None, mtp_here=False) - self.assertEqual((d.drafter, d.note, d.flags), ("off", "", ())) # no drafter, nothing to say, no --spec 6 - self.assertFalse(drafting.wants_one_request("auto", model_name=name, backend="sycl")) # no "one request at a time" - self.assertFalse(drafting.needs_pack("auto", model_name=name, backend="sycl", data_dir="x")) # nothing is fetched for it - self.assertFalse(drafting.needs_mtp("auto", model_name=name, backend="sycl", mtp_here=False)) - for backend in ("cuda", "hip", "metal", None): - self.assertFalse(drafting.intel_plain(backend, name), (backend, name)) # NVIDIA, AMD and Apple are untouched - for name in ("qwen3.8-flash-next-q2_0", "qwen3.8-flash-next-iq3_xxs", "qwen3.8-flash-next-coder-iq1_m", "qwen3.8-flash-next-unsloth-iq3_s", "swift-iq3_s", None): - self.assertFalse(drafting.intel_plain("sycl", name), name) # the other packs and families keep their rule + self.assertEqual(d.drafter, drafting.decide("auto", model_name=name, backend="sycl", data_dir=None, mtp_here=False).drafter) + self.assertNotEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off") # the engine's own Auto rule: DFlash2 where it runs, else the MTP - def test_linux_keeps_its_rule_until_the_owner_says_otherwise(self): + def test_the_constant_brings_plain_back_and_leaves_the_other_cards_alone(self): from strata_control import drafting - with mock.patch.object(drafting, "_host_platform", lambda: "linux"): + with mock.patch.object(drafting, "INTEL_PLAIN_BY_DEFAULT", True): for name in self.NAMES: - self.assertFalse(drafting.intel_plain("sycl", name)) - self.assertNotEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off") - with mock.patch.object(drafting, "INTEL_PLAIN_PLATFORMS", ("win", "linux")), mock.patch.object(drafting, "_host_platform", lambda: "linux"): - self.assertTrue(drafting.intel_plain("sycl", self.NAMES[0])) # one word adds it + self.assertTrue(drafting.intel_plain("sycl", name), name) + self.assertEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off") + d = drafting.decide("auto", model_name=name, backend="sycl", data_dir=None, mtp_here=False) + self.assertEqual((d.drafter, d.note, d.flags), ("off", "", ())) + for backend in ("cuda", "hip", "metal", None): + self.assertFalse(drafting.intel_plain(backend, name), (backend, name)) + for name in ("qwen3.8-flash-next-q2_0", "qwen3.8-flash-next-coder-iq1_m", "swift-iq3_s", None): + self.assertFalse(drafting.intel_plain("sycl", name), name) + with mock.patch.object(drafting, "_host_platform", lambda: "linux"): + self.assertFalse(drafting.intel_plain("sycl", self.NAMES[0])) # platforms: Windows only def test_a_named_drafter_and_off_are_the_persons_own(self): from strata_control import drafting name = self.NAMES[0] self.assertEqual(drafting.choice_of("mtp", model_name=name, backend="sycl"), "mtp") self.assertEqual(drafting.choice_of("off", model_name=name, backend="sycl"), "off") - self.assertEqual(drafting.choice_of("dflash2", model_name=name, backend="sycl"), "dflash2") # asked for by name: the person's choice (the engine may still refuse it) - - def test_one_constant_turns_dflash2_back_on(self): - from strata_control import drafting - with mock.patch.object(drafting, "INTEL_PLAIN_BY_DEFAULT", False): - for name in self.NAMES: - self.assertFalse(drafting.intel_plain("sycl", name)) - self.assertNotEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off") # back to the engine's own Auto rule (DFlash2 where it runs, else the MTP) + self.assertEqual(drafting.choice_of("dflash2", model_name=name, backend="sycl"), "dflash2") if __name__ == "__main__":