mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +00:00
Windows NVIDIA: the 12 GB class and up take chunk 2048 in tier C too (no extra flag); the 8 GB class keeps 256 there
With the engine's Windows planner headroom (f-ling32-intc966eccc17, STRATA_L32_WDDM_HEADROOM_MB 1536) the owner's 5070 (12 GB, 64 GB Windows PC, tier C) reads the 33,784-token prompt in 100.1 s at chunk 2048 with the regrow on, the headroom line in the engine log and the shared memory flat (GUI-LING owner-20261203-0747-5743, out-cuda13j, exe hash verified); without it, 577-622 s. So the launcher's Windows exception for the 12 GB class (256 sincec908bbf7f9) is gone: ling32_fit.small_card_class is the 8 GB class only (CLASS_8_GIB up to CLASS_8_TOP_GIB), whose Windows tier-C chunk stays WINDOWS_TIER_C_CHUNK = 256 (untested with the headroom; its loader reserve needs the regrow on). The tier is still predicted with the engine's half-RAM pin cap on Windows (plan(..., pin_half=True), set by setup and the Terminal). No --regrow, no --vram-budget-gib: only --chunk is written. The Terminal's config writer (adopt.plan) takes the chunk from the same plan as setup (the computer's RAM is passed from the launcher), so the app and the TUI write the same chunk on every row. Tests: the fit rows (12 GB and up: 2048 on Windows and Linux, 8 GB Windows tier C: 256), setup and the Terminal writing the same chunk and neither flag, the grid of cards x RAM showing only the 8 GB class's chunk moves with the pin cap, and eight snapshot rows (new test tests/snapshot/test_ling32_chunk_snapshot.py, golden in tests/snapshot/golden_ling32_chunk/chunk_rows.json: 12, 8 and 16 GB cards on Windows and Linux in tier B and C).
This commit is contained in:
1 parent
269e35441b
commit
edec883b5f
7 files changed
+461
-13
No files matched your search
@@ -137,7 +137,7 @@ def model_files(folder: Path, family: str, family_def: dict | None = None) -> li
|
||||
|
||||
def plan(*, family: str, model: str, model_dir: Path, data_dir: Path, src: Path, context: int, kv: str | None, model_name: str, family_def: dict,
|
||||
log: Path, backend: str | None, vram_gb: float = 0.0, notes: list | None = None, pack_name: str | None = None,
|
||||
drafting: str | None = None, platform: str | None = None) -> tuple[dict | None, list[str]]:
|
||||
drafting: str | None = None, platform: str | None = None, ram_gb: float = 0.0, pin_half: bool | None = None) -> tuple[dict | None, list[str]]:
|
||||
"""(config, problems): the config to write, or None with plain-words problems (what is missing). `pack_name`: the pack folder under
|
||||
packs/ (default the model's name in lower case; Gyro's is its tag, gyro-gyro-s)."""
|
||||
problems: list[str] = []
|
||||
@@ -255,6 +255,13 @@ def plan(*, family: str, model: str, model_dir: Path, data_dir: Path, src: Path,
|
||||
if problems:
|
||||
return None, problems
|
||||
chunk = ling32_fit.chunk_for(vram_gb or None, backend=backend)
|
||||
if ram_gb and vram_gb and backend in (None, "cuda"): # NVIDIA: the plan decides the chunk like setup does (Windows, 8 GB class, tier C: 256)
|
||||
import sys as _sys
|
||||
try:
|
||||
got = ling32_fit.plan(float(vram_gb), float(ram_gb), ctx=context, backend=backend, card_gib=float(vram_gb), pin_half=(_sys.platform == "win32") if pin_half is None else pin_half)
|
||||
chunk = int(got["chunk"])
|
||||
except Exception: # noqa: BLE001 - no plan, the card class's chunk
|
||||
pass
|
||||
flags = ling32_family.ENGINE_FLAGS.get(backend or "cuda", ling32_family.ENGINE_FLAGS["cuda"]) if backend in ("hip", "metal", "sycl") else ling32_family.ENGINE_FLAGS["cuda"] # the tuned set of the backend (Intel and Metal: none; HIP: --graph)
|
||||
args = ["--model", str(native), "--ctx", str(context), "--chunk", str(chunk), *flags]
|
||||
cfg = {"exe": f"component:{ling32_family.COMPONENT}", "args": args, "cwd": str(src), "tokenizer": str(tokenizer),
|
||||
|
||||
@@ -2103,7 +2103,7 @@ class Runner:
|
||||
context=s.context or 32768, kv=s.kv, model_name=(custom_alias(s) if s.custom_id else f"{fam.get('name', s.family)}-{s.model.lower()}"), family_def=fam,
|
||||
log=cat.root / f"strata-{tag}.log", backend=backend,
|
||||
vram_gb=float(cat.computer().main_vram_gb or 0), notes=self.notices, pack_name=tag.lower(),
|
||||
drafting=s.drafting)
|
||||
drafting=s.drafting, ram_gb=float(cat.computer().ram_gb or 0))
|
||||
if cfg is None:
|
||||
if backend == "sycl":
|
||||
raise LaunchError("Strata cannot start this model on the Intel Arc card yet: " + "; ".join(problems) + ".",
|
||||
|
||||
@@ -316,7 +316,10 @@ def describe(p: dict) -> str:
|
||||
CLASS_12_GIB = 11.5 # a real 12 GB card (3060 12G, 4070, 5070, 3080 12G: 11.6 to 12.0 GiB); the 11 GB cards (2080 Ti, 1080 Ti) and the 10 GB 3080 stay below it
|
||||
CLASS_16_GIB = 14.0
|
||||
CLASS_8_GIB = 7.5 # a real 8 GB card (3060 Ti, 3070, 4060: 7.6 to 8.0 GiB; the 6 GB cards stay below it). The 8 GB class takes 2048 since L32-SMALL's loader-reserve fix (f-ling32-int 03006f62ed; the 3060 Ti 8 GB, tier C on Linux: prefill 1.2 to 2.0x, no OOM)
|
||||
WINDOWS_TIER_C_CHUNK = 256 # the 8 and 12 GB classes on Windows in tier C (the plan made with the engine's half-RAM pin cap): the chunk the launcher passes there. ONE constant: GUI-LING's owner-PC 5070 runs (33,784 tokens: 256 -> 407 s, 2048 -> 620 s, 4096 -> about 170 s) decide it
|
||||
# Variant (c): with the engine's Windows planner headroom (STRATA_L32_WDDM_HEADROOM_MB 1536, f-ling32-int c966eccc17; WDDM over-commits cudaMalloc when the planner fills the card) the 12 GB class and up take
|
||||
# 2048 with the regrow on in tier C on Windows too (the owner's 5070: 577-622 s at 2048 without the headroom, about 100-117 s with it), so there is no Windows exception for them. The 8 GB class on Windows in tier C
|
||||
# keeps the small chunk (untested with the headroom; its loader reserve needs the regrow on). The plan is made with the engine's half-RAM pin cap on Windows (plan(..., pin_half=True), set by setup and the Terminal).
|
||||
WINDOWS_TIER_C_CHUNK = 256 # the 8 GB class on Windows in tier C: the chunk the launcher passes there. ONE constant
|
||||
CLASS_8_TOP_GIB = 9.0 # the 9 and 10 GB cards are between the measured classes and keep 256
|
||||
CLASS_24_GIB = 20.0
|
||||
CLASS_32_GIB = 27.0
|
||||
@@ -324,11 +327,11 @@ CLASS_48_GIB = 44.0
|
||||
|
||||
|
||||
def small_card_class(vram_gib: float | None, card_gib: float | None = None, backend: str | None = None) -> bool:
|
||||
"""A real 8 GB (CLASS_8_GIB up to CLASS_8_TOP_GIB) or 12 GB (CLASS_12_GIB up to the 16 GB class) NVIDIA card, by the card's own size, else the memory free: the classes whose chunk depends on the plan's tier on Windows."""
|
||||
"""A real 8 GB (CLASS_8_GIB up to CLASS_8_TOP_GIB) NVIDIA card, by the card's own size, else the memory free: the class whose chunk depends on the plan's tier on Windows (the 12 GB class and up take 2048 there too, with the engine's headroom)."""
|
||||
if str(backend or "").lower() in ("hip", "sycl", "metal"):
|
||||
return False
|
||||
size = max(float(vram_gib or 0.0), float(card_gib or 0.0))
|
||||
return CLASS_12_GIB <= size < CLASS_16_GIB or CLASS_8_GIB <= size < CLASS_8_TOP_GIB
|
||||
return CLASS_8_GIB <= size < CLASS_8_TOP_GIB
|
||||
|
||||
|
||||
def chunk_for(vram_gib: float | None, unified: bool = False, backend: str | None = None, card_gib: float | None = None) -> int:
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
{
|
||||
"nv_12gb_linux_tier_b_128gb": {
|
||||
"card_gib": 11.95,
|
||||
"launch": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
]
|
||||
},
|
||||
"platform": "linux",
|
||||
"ram_gib": 128.0,
|
||||
"setup": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
],
|
||||
"chunk": 2048,
|
||||
"regrow_off": false,
|
||||
"tier": "B"
|
||||
},
|
||||
"what": "12 GB card, Linux, 128 GB RAM"
|
||||
},
|
||||
"nv_12gb_linux_tier_c_64gb": {
|
||||
"card_gib": 11.95,
|
||||
"launch": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
]
|
||||
},
|
||||
"platform": "linux",
|
||||
"ram_gib": 64.0,
|
||||
"setup": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
],
|
||||
"chunk": 2048,
|
||||
"regrow_off": false,
|
||||
"tier": "C"
|
||||
},
|
||||
"what": "12 GB card, Linux, 64 GB RAM"
|
||||
},
|
||||
"nv_12gb_win_tier_b_192gb": {
|
||||
"card_gib": 11.95,
|
||||
"launch": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
]
|
||||
},
|
||||
"platform": "windows",
|
||||
"ram_gib": 192.0,
|
||||
"setup": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
],
|
||||
"chunk": 2048,
|
||||
"regrow_off": false,
|
||||
"tier": "B"
|
||||
},
|
||||
"what": "12 GB card, Windows, 192 GB RAM"
|
||||
},
|
||||
"nv_12gb_win_tier_c_64gb": {
|
||||
"card_gib": 11.95,
|
||||
"launch": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
]
|
||||
},
|
||||
"platform": "windows",
|
||||
"ram_gib": 64.0,
|
||||
"setup": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
],
|
||||
"chunk": 2048,
|
||||
"regrow_off": false,
|
||||
"tier": "C"
|
||||
},
|
||||
"what": "RTX 5070 / 3060 12 GB, Windows, 64 GB RAM (the owner's PC)"
|
||||
},
|
||||
"nv_16gb_linux_tier_c_64gb": {
|
||||
"card_gib": 15.9,
|
||||
"launch": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
]
|
||||
},
|
||||
"platform": "linux",
|
||||
"ram_gib": 64.0,
|
||||
"setup": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
],
|
||||
"chunk": 2048,
|
||||
"regrow_off": false,
|
||||
"tier": "C"
|
||||
},
|
||||
"what": "16 GB card, Linux, 64 GB RAM"
|
||||
},
|
||||
"nv_16gb_win_tier_c_64gb": {
|
||||
"card_gib": 15.9,
|
||||
"launch": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
]
|
||||
},
|
||||
"platform": "windows",
|
||||
"ram_gib": 64.0,
|
||||
"setup": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
],
|
||||
"chunk": 2048,
|
||||
"regrow_off": false,
|
||||
"tier": "C"
|
||||
},
|
||||
"what": "RTX 5070 Ti / A4000 16 GB, Windows, 64 GB RAM"
|
||||
},
|
||||
"nv_8gb_linux_tier_c_64gb": {
|
||||
"card_gib": 7.8,
|
||||
"launch": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
]
|
||||
},
|
||||
"platform": "linux",
|
||||
"ram_gib": 64.0,
|
||||
"setup": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"2048",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
],
|
||||
"chunk": 2048,
|
||||
"regrow_off": false,
|
||||
"tier": "C"
|
||||
},
|
||||
"what": "RTX 3060 Ti 8 GB, Linux, 64 GB RAM"
|
||||
},
|
||||
"nv_8gb_win_tier_c_64gb": {
|
||||
"card_gib": 7.8,
|
||||
"launch": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"256",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
]
|
||||
},
|
||||
"platform": "windows",
|
||||
"ram_gib": 64.0,
|
||||
"setup": {
|
||||
"args": [
|
||||
"--ctx",
|
||||
"32768",
|
||||
"--chunk",
|
||||
"256",
|
||||
"--tc",
|
||||
"16",
|
||||
"--tc-moe",
|
||||
"128",
|
||||
"--graph",
|
||||
"--mla-kernel",
|
||||
"simt"
|
||||
],
|
||||
"chunk": 256,
|
||||
"regrow_off": false,
|
||||
"tier": "C"
|
||||
},
|
||||
"what": "RTX 3060 Ti 8 GB, Windows, 64 GB RAM"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
"""The chunk and regrow rules of the Ling-3.2-Air launcher for the NVIDIA cards the machine-class snapshot does not cover (its Ling goldens only record what the host hands to Control, not the engine
|
||||
arguments the launcher's plan writes): for every row below, what setup writes (`setup.ling32_engine_args`: the app's install and the Terminal's setup) and what the Terminal's own config writer
|
||||
writes (`strata_cli.launch.adopt.plan`), as the engine's flags after `--ctx`. Own golden file (golden_ling32_chunk/chunk_rows.json); a change of the plan's chunk, of `--regrow` or of the tier
|
||||
the plan predicts shows up here as a diff.
|
||||
|
||||
Rows: the cards of the 8, 12 and 16 GB classes with the RAM that makes tier B or C, on Linux and on Windows (the engine's pin cap there is half of the system RAM).
|
||||
Nothing real is used: no GPU, no model file, no engine. Write the golden file after an intended change with STRATA_SNAPSHOT_UPDATE=1 and review the diff."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import types
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
GOLDEN = Path(__file__).resolve().parent / "golden_ling32_chunk" / "chunk_rows.json"
|
||||
UPDATE = os.environ.get("STRATA_SNAPSHOT_UPDATE") == "1"
|
||||
|
||||
#: key -> (what it is, the card's own size in GiB as the hardware report gives it, system RAM in GiB, Windows?)
|
||||
ROWS = {
|
||||
"nv_12gb_win_tier_c_64gb": ("RTX 5070 / 3060 12 GB, Windows, 64 GB RAM (the owner's PC)", 11.95, 64.0, True),
|
||||
"nv_12gb_linux_tier_b_128gb": ("12 GB card, Linux, 128 GB RAM", 11.95, 128.0, False),
|
||||
"nv_12gb_linux_tier_c_64gb": ("12 GB card, Linux, 64 GB RAM", 11.95, 64.0, False),
|
||||
"nv_12gb_win_tier_b_192gb": ("12 GB card, Windows, 192 GB RAM", 11.95, 192.0, True),
|
||||
"nv_8gb_linux_tier_c_64gb": ("RTX 3060 Ti 8 GB, Linux, 64 GB RAM", 7.8, 64.0, False),
|
||||
"nv_8gb_win_tier_c_64gb": ("RTX 3060 Ti 8 GB, Windows, 64 GB RAM", 7.8, 64.0, True),
|
||||
"nv_16gb_win_tier_c_64gb": ("RTX 5070 Ti / A4000 16 GB, Windows, 64 GB RAM", 15.9, 64.0, True),
|
||||
"nv_16gb_linux_tier_c_64gb": ("16 GB card, Linux, 64 GB RAM", 15.9, 64.0, False),
|
||||
}
|
||||
|
||||
|
||||
def setup_row(card_gib: float, ram_gib: float, windows: bool) -> dict:
|
||||
import setup
|
||||
a = types.SimpleNamespace(tier=None, vram_budget_gib=None, ram_budget_gib=None, turbo_ssd=False, cpu_coexec=None)
|
||||
args, adv = setup.ling32_engine_args(a, round(card_gib * 0.93, 2), ram_gib, False, 32768, backend="cuda", card_gib=card_gib, pin_half=windows)
|
||||
return {"args": [str(x) for x in args], "tier": adv["tier"], "chunk": adv["plan"]["chunk"], "regrow_off": bool(adv["plan"].get("regrow_off"))}
|
||||
|
||||
|
||||
def launch_row(card_gib: float, ram_gib: float, windows: bool) -> dict:
|
||||
from strata_cli.launch import adopt
|
||||
from strata_control import ling32_family
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
root = Path(d)
|
||||
models = root / "models"
|
||||
models.mkdir()
|
||||
(models / ling32_family.MODEL_FILE).write_bytes(b"x")
|
||||
tok = root / "data" / "packs" / "ling-3.2-air-sq-96" / "tokenizer"
|
||||
tok.mkdir(parents=True)
|
||||
(tok / "vocab.json").write_text("{}")
|
||||
cfg, problems = adopt.plan(family="ling-3.2-air", model="SQ-96", model_dir=models, data_dir=root / "data", src=root, context=32768, kv=None, model_name="Ling",
|
||||
family_def={"name": "ling"}, log=root / "x.log", backend="cuda", vram_gb=card_gib, ram_gb=ram_gib, pin_half=windows, pack_name="ling-3.2-air-sq-96")
|
||||
if cfg is None:
|
||||
return {"problems": problems}
|
||||
args = [str(x) for x in cfg["args"]]
|
||||
return {"args": args[2:]} # without --model <path>
|
||||
|
||||
|
||||
def build_rows() -> dict:
|
||||
out = {}
|
||||
for key, (what, card, ram, windows) in ROWS.items():
|
||||
out[key] = {"what": what, "card_gib": card, "ram_gib": ram, "platform": "windows" if windows else "linux",
|
||||
"setup": setup_row(card, ram, windows), "launch": launch_row(card, ram, windows)}
|
||||
return out
|
||||
|
||||
|
||||
def dump(rows: dict) -> str:
|
||||
return json.dumps(rows, indent=1, sort_keys=True) + "\n"
|
||||
|
||||
|
||||
class Ling32ChunkSnapshot(unittest.TestCase):
|
||||
maxDiff = None
|
||||
|
||||
def test_the_rows_match_the_golden_file(self):
|
||||
got = dump(build_rows())
|
||||
if UPDATE:
|
||||
GOLDEN.parent.mkdir(parents=True, exist_ok=True)
|
||||
GOLDEN.write_text(got, encoding="utf-8", newline="\n")
|
||||
self.assertTrue(GOLDEN.is_file(), f"{GOLDEN} is missing: write it with STRATA_SNAPSHOT_UPDATE=1")
|
||||
self.assertEqual(got, GOLDEN.read_text(encoding="utf-8"))
|
||||
|
||||
def test_setup_and_the_terminal_write_the_same_chunk_and_regrow(self):
|
||||
for key, row in build_rows().items():
|
||||
la = row["launch"]["args"]
|
||||
sa = row["setup"]["args"]
|
||||
self.assertEqual(la[la.index("--chunk") + 1], sa[sa.index("--chunk") + 1], key)
|
||||
self.assertEqual("--regrow" in la, "--regrow" in sa, key)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -303,18 +303,16 @@ def test_the_launcher_chunk_by_card_size():
|
||||
# the card's own size decides the class where it is known: a 12 GB card with 1.2 GiB used by the desktop (10.8 GiB free) still takes 2048, an 11 GB or 10 GB card does not
|
||||
assert F.chunk_for(10.8, card_gib=11.95) == 2048 and F.chunk_for(10.0, card_gib=10.7) == 256 and F.chunk_for(9.0, card_gib=9.8) == 256
|
||||
assert F.plan(10.8, 128, card_gib=11.95)["chunk"] == 2048 and F.advise(10.8, 128, card_gib=11.95)["plan"]["chunk"] == 2048
|
||||
# the 12 GB class: 256 only on Windows (pin_half) in tier C (the owner's 5070, 64 GB: 83 tok/s at 256 against 54.5 at 2048); Linux takes 2048 in tier C too (page cache serves the misses)
|
||||
for ram, pin, mode, chunk in ((32, False, "C", 2048), (64, False, "C", 2048), (96, False, "B", 2048), (128, False, "B", 2048), (64, True, "C", F.WINDOWS_TIER_C_CHUNK), (128, True, "B", F.WINDOWS_TIER_C_CHUNK), (192, True, "B", 2048)): # (the plan keeps the real RAM; the tier is predicted with the pin cap for the chunk only)
|
||||
# variant (c): the 12 GB class and up take 2048 everywhere, Windows tier C included (the engine's planner headroom, f-ling32-int c966eccc17, is what keeps the card from over-committing); no flag besides --chunk
|
||||
for ram, pin in ((32, False), (64, False), (96, False), (128, False), (64, True), (128, True), (192, True)):
|
||||
got = F.plan(11.95, ram, ctx=131072, card_gib=11.95, pin_half=pin)
|
||||
assert (got["mode"], got["chunk"]) == (mode, chunk), (ram, pin, got["mode"], got["chunk"])
|
||||
# the pin cap changes the chunk decision only: no other card class moves, and in the 12 GB class only the chunk and the pool numbers that follow from it
|
||||
for card in (6, 10, 16, 20, 24, 32, 48):
|
||||
assert got["chunk"] == 2048, (ram, pin, got["mode"], got["chunk"])
|
||||
# the pin cap moves nothing but the 8 GB class's chunk (and what follows from it: the pool numbers)
|
||||
for card in (6, 10, 12, 16, 20, 24, 32, 48):
|
||||
for ram in (16, 64, 128, 256):
|
||||
assert F.advise(card * 0.9, ram, ctx=131072, card_gib=float(card)) == F.advise(card * 0.9, ram, ctx=131072, card_gib=float(card), pin_half=True), (card, ram)
|
||||
for ram in (16, 64, 128):
|
||||
a, b = F.advise(7.2, ram, ctx=131072, card_gib=8.0), F.advise(7.2, ram, ctx=131072, card_gib=8.0, pin_half=True)
|
||||
assert {k: v for k, v in a.items() if k != "plan"} == {k: v for k, v in b.items() if k != "plan"}
|
||||
a, b = F.advise(10.8, ram, ctx=131072, card_gib=11.95), F.advise(10.8, ram, ctx=131072, card_gib=11.95, pin_half=True)
|
||||
moved = {k for k in set(a["plan"]) | set(b["plan"]) if a["plan"].get(k) != b["plan"].get(k)}
|
||||
assert moved <= {"chunk", "dyn_bytes", "dyn_slots", "vram_fixed", "vram_gb", "vram_total_planned"}, moved
|
||||
assert {k: v for k, v in a.items() if k != "plan"} == {k: v for k, v in b.items() if k != "plan"}
|
||||
@@ -332,7 +330,7 @@ def test_the_launcher_chunk_by_card_size():
|
||||
assert F.plan(5.6, 62, ctx=131072, card_gib=6.0)["chunk"] == 256 and F.plan(9.4, 62, ctx=131072, card_gib=10.0)["chunk"] == 256
|
||||
assert F.plan(15.9, 64, card_gib=15.9)["chunk"] == 2048 and F.plan(15.9, 64, card_gib=15.9)["mode"] == "C" # the 16 GB class keeps 2048 in tier C (L32-SMALL's A4000 gate)
|
||||
assert F.plan(11.95, 64, card_gib=11.95, chunk=2048)["chunk"] == 2048 # an explicit chunk is never changed
|
||||
assert F.small_card_class(11.95) and F.small_card_class(10.8, 11.95) and F.small_card_class(7.6, 8.0) and not F.small_card_class(10.8) and not F.small_card_class(15.9) and not F.small_card_class(5.9) and not F.small_card_class(11.95, None, "hip")
|
||||
assert F.small_card_class(7.6, 8.0) and F.small_card_class(7.0, 8.0) and not F.small_card_class(11.95) and not F.small_card_class(15.9) and not F.small_card_class(5.9) and not F.small_card_class(10.8) and not F.small_card_class(7.6, None, "hip")
|
||||
# the bigger chunk costs pool slots (its activation buffers), a few percent on a 24 GB card
|
||||
small, big = F.plan(24, 128, chunk=256, ctx=32768), F.plan(24, 128, chunk=1024, ctx=32768)
|
||||
assert 0 < small["dyn_slots"] - big["dyn_slots"] < 0.1 * small["dyn_slots"]
|
||||
|
||||
@@ -333,6 +333,35 @@ class Mtp(unittest.TestCase):
|
||||
self.assertTrue(with_mtp)
|
||||
|
||||
|
||||
class WindowsChunkInTheTerminal(unittest.TestCase):
|
||||
"""Variant (c): the Terminal writes the same chunk as setup: 2048 for the 12 GB class and up on Windows too (no extra flag), 256 for the 8 GB class on Windows in tier C."""
|
||||
|
||||
def plan(self, vram, ram, pin_half):
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from strata_cli.launch import adopt
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
root = Path(d)
|
||||
model = root / "models"
|
||||
model.mkdir()
|
||||
(model / ling32_family.MODEL_FILE).write_bytes(b"x")
|
||||
tok = root / "data" / "packs" / "ling-3.2-air-sq-96" / "tokenizer"
|
||||
tok.mkdir(parents=True)
|
||||
(tok / "vocab.json").write_text("{}")
|
||||
cfg, problems = adopt.plan(family="ling-3.2-air", model="SQ-96", model_dir=model, data_dir=root / "data", src=root, context=32768, kv=None, model_name="Ling", family_def={"name": "ling"},
|
||||
log=root / "x.log", backend="cuda", vram_gb=vram, ram_gb=ram, pin_half=pin_half, pack_name="ling-3.2-air-sq-96")
|
||||
self.assertEqual(problems, [])
|
||||
return cfg["args"]
|
||||
|
||||
def test_the_windows_rows(self):
|
||||
for vram, ram, pin, chunk in ((11.95, 64.0, True, "2048"), (15.9, 64.0, True, "2048"), (23.5, 64.0, True, "2048"), (11.95, 64.0, False, "2048"), (11.95, 192.0, True, "2048"),
|
||||
(7.8, 64.0, True, "256"), (7.8, 64.0, False, "2048"), (47.5, 64.0, True, "1024")):
|
||||
a = self.plan(vram, ram, pin)
|
||||
self.assertEqual(a[a.index("--chunk") + 1], chunk, (vram, ram, pin))
|
||||
self.assertNotIn("--regrow", a)
|
||||
self.assertNotIn("--vram-budget-gib", a)
|
||||
|
||||
|
||||
class Flags(unittest.TestCase):
|
||||
def parse(self, *argv):
|
||||
ap = argparse.ArgumentParser()
|
||||
|
||||
Reference in new issue
Block a user