mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +00:00
Launcher chunk: the 8 GB and 12 GB NVIDIA classes take 2048, except on Windows in tier C (256, one constant)
chunk_for: the 8 GB class (7.5 up to 9 GiB) moves from 256 to 2048 since L32-SMALL's loader-reserve fix (03006f62ed: the 3060 Ti 8 GB, tier C,
62 GB RAM, Linux: prefill 4K 165 vs 137, 16K 258 vs 151, 32K 232 vs 134 tok/s at 2048 vs 256, no OOM); the 12 GB class keeps 2048. The 6 GB and
the 9 / 10 / 11 GB cards stay at 256 (between the measured classes).
Windows in tier C is the exception: the misses there are real SSD reads (NO_BUFFERING) and the larger scratch takes pool slots from the
expert cache. The owner's 5070 (12 GB, 64 GB Windows PC, tier C, 29.25 GiB pinned), same prompt of 33,784 tokens, same harness:
256 = 407 s (83 tok/s), 2048 = 577 s (58.6), 4096 = 532 s (63.5). So ling32_fit.WINDOWS_TIER_C_CHUNK = 256, the one constant that
decides it. The tier is predicted for the chunk decision only, with the engine's pin cap (half of the system RAM on Windows;
plan(..., pin_half=True), set by the launcher and by setup on Windows); the plan itself keeps the real RAM, so nothing but the chunk
and the pool numbers that follow from it moves. An explicit --chunk is never changed; HIP, Intel and Metal are untouched.
Tests: the chunk by card size, Linux 12 GB and 8 GB in tier C -> 2048, Windows 8 GB / 12 GB at 64 GB in tier C -> the constant, Windows 12 GB
at 192 GB (tier B) -> 2048, the planner fits both classes at 256 / 2048 / 4096 and the constant, and the grid of cards x RAM showing only the
8 GB and 12 GB rows move.
This commit is contained in:
1 parent
ac1d0ddc57
commit
c908bbf7f9
6 files changed
+75
-16
No files matched your search
+2
-2
@@ -10849,11 +10849,11 @@ def ling32_fetch_mtp(a, folder: Path, own: bool, model: Path | None = None, extr
|
||||
|
||||
|
||||
def ling32_engine_args(a, vram_gib, ram_gib, unified, ctx, vision: bool = False, vision_device: str = "auto", gpu_cap_gib: float | None = None, mtp: bool = False,
|
||||
backend: str = "cuda", card_gib: float | None = None) -> tuple[list, dict]:
|
||||
backend: str = "cuda", card_gib: float | None = None, pin_half: bool | None = None) -> tuple[list, dict]:
|
||||
"""The engine arguments of a Ling-3.2-Air start and the plan they come from: the fast path (explicit, so a start never depends on a default that may move), the context and
|
||||
chunk, then the person's tier choices as flags (ling32_fit.tier_args: nothing for `auto`: the engine plans by itself with the same rule). Returns (args, advise()'s dict)."""
|
||||
adv = ling32_fit.advise(vram_gib, ram_gib, unified=unified, tier=getattr(a, "tier", None) or "auto", vram_budget_gib=getattr(a, "vram_budget_gib", None) or 0.0,
|
||||
ram_budget_gib=getattr(a, "ram_budget_gib", None) or 0.0, turbo_ssd=bool(getattr(a, "turbo_ssd", False)), ctx=ctx, vision=vision, vision_device=vision_device, gpu_cap_gib=gpu_cap_gib, mtp=mtp, backend=backend, card_gib=card_gib)
|
||||
ram_budget_gib=getattr(a, "ram_budget_gib", None) or 0.0, turbo_ssd=bool(getattr(a, "turbo_ssd", False)), ctx=ctx, vision=vision, vision_device=vision_device, gpu_cap_gib=gpu_cap_gib, mtp=mtp, backend=backend, card_gib=card_gib, pin_half=WIN if pin_half is None else pin_half)
|
||||
args = ["--ctx", str(ctx), "--chunk", str(adv["plan"]["chunk"]), *ling32_family.ENGINE_FLAGS.get(backend, ling32_family.ENGINE_FLAGS["cuda"])]
|
||||
if backend == "metal": # no tiers on a Mac: the whole model is in memory
|
||||
return args, adv
|
||||
|
||||
@@ -12,6 +12,7 @@ from __future__ import annotations
|
||||
|
||||
import difflib
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from dataclasses import asdict, dataclass, field, fields
|
||||
from typing import Any
|
||||
@@ -436,7 +437,7 @@ def check_ling32(s: LaunchSettings, *, vram_gb: float | None, ram_gb: float | No
|
||||
engine_backend = {"amd": "hip", "intel": "sycl" if ling32_family.sycl_available() else "cuda", "apple": "metal"}.get(str(vendor or "").lower(), "cuda") # the chunk of the card class follows the backend (Intel only once its engine ships: the notice below says it)
|
||||
adv = ling32_fit.advise(vram_gb, float(ram_gb or 0.0), unified=unified, disk_free_gb=disk_free_gb, tier=s.tier or "auto", vram_budget_gib=s.vram_budget or 0.0,
|
||||
ram_budget_gib=s.ram_budget or 0.0, turbo_ssd=bool(s.turbo_ssd), ctx=s.context, vision=s.vision not in ("off", "no"),
|
||||
vision_device=s.vision if s.vision in ("gpu", "cpu") else "auto", mtp="auto" if mtp_mode == "auto" else mtp_mode == "on", backend=engine_backend)
|
||||
vision_device=s.vision if s.vision in ("gpu", "cpu") else "auto", mtp="auto" if mtp_mode == "auto" else mtp_mode == "on", backend=engine_backend, pin_half=sys.platform == "win32")
|
||||
except Exception: # noqa: BLE001 - a plan that cannot be worked out stays silent rather than wrong
|
||||
return out
|
||||
v = str(vendor or "").lower()
|
||||
|
||||
@@ -315,11 +315,22 @@ def describe(p: dict) -> str:
|
||||
#: after the desktop took its share, so each class starts well below its name: 14 GiB and up is a 16 GB card, 20 and up a 24 GB card, 27 and up a 32 GB card, 44 and up a 48 GB card. No card is made in between.
|
||||
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
|
||||
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
|
||||
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."""
|
||||
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
|
||||
|
||||
|
||||
def chunk_for(vram_gib: float | None, unified: bool = False, backend: str | None = None, card_gib: float | None = None) -> int:
|
||||
"""The prompt chunk the launcher starts the engine with, by the card's nominal class. The activation buffers scale with it (0.6 GiB at 256, about 2 GiB at 2048), and on a card that runs the pool
|
||||
layout every byte of them is a pool slot, so a card with little memory takes a small chunk: the 8 and 12 GB classes 256. But the layer-major span prefill runs sub-chunks of `--chunk` rows, so a
|
||||
@@ -329,7 +340,7 @@ def chunk_for(vram_gib: float | None, unified: bool = False, backend: str | None
|
||||
24 % faster than 1024 and a 4K prompt 8 % faster for 0.7 / 2.6 % less decode, 4096 adds only 11 % more for 8 % less decode; a 120K prompt at 2048 ran through with no allocation failure (the lazy
|
||||
KV gives pool slots back as it grows). The pool regrow (f-ling32-int 9d71124e4c: on NVIDIA wherever the chunk is 2048 or more, it gives the bigger chunk's scratch back to the pool after the prefill) took away the decode cost: on an RTX 3090
|
||||
24 GB decode +3.4 % and prefill +13 / +15 % at 4K / 16K, on an RTX A4000 16 GB prefill +21 / +18 % with decode flat (L32-SMALL, greedy ids identical). L32-SMALL then measured the 12 GB class with the regrow: an RTX 5070 on PCIe 5.0 prefill 4K / 16K / 32K 595 / 583 / 493 tok/s at chunk 256 against 915 / 1237 / 1134 at 2048, decode 38.8 against 39.4; the same card on
|
||||
PCIe 4.0 x4 (tier C) 187 / 335 / 350 against 284 / 669 / 777, decode 10.9 against 11.0. So on NVIDIA: the 8 / 10 / 11 GB classes 256, the 12 GB class (11.5 GiB and up) and the 16 GB
|
||||
PCIe 4.0 x4 (tier C) 187 / 335 / 350 against 284 / 669 / 777, decode 10.9 against 11.0. So on NVIDIA: the 6 GB and the 9 / 10 / 11 GB cards 256, the 8 GB class 2048 since L32-SMALL's loader-reserve fix (03006f62ed) and the 12 GB class 2048 (both 256 only on Windows in tier C, where the plan is made with the engine's half-RAM pin cap: the owner's 5070, 33,784 tokens, 83 tok/s at 256 against 54.5 at 2048, real SSD reads for the misses; on Linux the page cache serves them), the 12 GB class (11.5 GiB and up) and the 16 GB
|
||||
class and up the engine's own default 2048, from the 48 GB class the static layout keeps 1024 (a bigger chunk takes hot ranks). AMD keeps 1024 below its 32 GB class (no regrow on a Radeon yet), Intel Arc 1024 below 20 GiB."""
|
||||
if unified or not vram_gib:
|
||||
return 1024
|
||||
@@ -339,6 +350,8 @@ def chunk_for(vram_gib: float | None, unified: bool = False, backend: str | None
|
||||
return 256 if vram_gib < CLASS_16_GIB else 1024
|
||||
if str(backend or "").lower() == "sycl" and vram_gib < CLASS_24_GIB: # Intel Arc (L32-SYCL): 1024 on the 8 to 16 GiB cards (A750, B580); the 20 to 44 GiB class takes 2048 like everywhere
|
||||
return 1024
|
||||
if CLASS_8_GIB <= vram_gib < CLASS_8_TOP_GIB:
|
||||
return 2048
|
||||
if vram_gib < CLASS_12_GIB:
|
||||
return 256
|
||||
return 2048 if vram_gib < CLASS_48_GIB else 1024
|
||||
@@ -415,7 +428,7 @@ def mtp_status_line(spec: str | None, h2d_gbps: float | None, mode: str | None =
|
||||
|
||||
def plan(vram_gib: float | None, ram_gib: float, *, unified: bool = False, tier: str = "auto", vram_budget_gib: float = 0.0, ram_budget_gib: float = 0.0,
|
||||
turbo_ssd: bool = False, ctx: int | None = None, chunk: int | None = None, prefetch: bool = True, vision: bool = False, vision_device: str = "auto",
|
||||
gpu_cap_gib: float | None = None, ram_floor_gib: float | None = None, mtp: bool = False, spec_block: int | None = None, backend: str | None = None, card_gib: float | None = None) -> dict:
|
||||
gpu_cap_gib: float | None = None, ram_floor_gib: float | None = None, mtp: bool = False, spec_block: int | None = None, backend: str | None = None, card_gib: float | None = None, pin_half: bool = False) -> dict:
|
||||
"""The tier plan for a PC. `mtp`: the sidecar is in the start (`mtp_bytes`: the file, its cache for `ctx`, the snapshot ring for `spec_block`, default 4), counted on the card in every tier. `gpu_cap_gib` (a Windows iGPU such as Strix Halo, L32-HIP's measurements; `probe_cap(engine)` gets it: `strata-ling32 --probe-cap`): the most one process can
|
||||
allocate for the GPU in all (about 63 GiB on a 96 GiB carve-out; what DXGI and hipMemGetInfo say is wrong). The rule of the engine's `--tier auto` on such a GPU: the card budget is
|
||||
`min(free, cap - 4 GiB)` (the engine keeps 4 GiB), the RAM tier is the available RAM less 8 GiB (the floor, `ram_floor_gib`) less 1.5 GiB, and the RAM tier is NOT counted against the
|
||||
@@ -469,6 +482,16 @@ def plan(vram_gib: float | None, ram_gib: float, *, unified: bool = False, tier:
|
||||
got = plan_tier(int((vram_gib or 0.0) * GIB), int(ram_hw * GIB), tier=engine_tier, vram_budget=int(vram_budget_gib * GIB), ram_budget=int(ram_budget_gib * GIB),
|
||||
turbo_ssd=turbo_ssd, ctx=n, chunk=ch, prefetch=prefetch, vision_vram=ev, vision_host=eh, pool="auto", kv_init=KV_INIT_ROWS,
|
||||
logits_rows=SERVE_LOGITS_ROWS, mtp_file_bytes=MTP_SIDECAR_BYTES if mtp else 0, mtp_expert_bytes=MTP_EXPERT_BYTES if mtp else 0, mtp_vram=mv)
|
||||
if chunk is None and ch == 2048 and pin_half and small_card_class(vram_gib, card_gib, backend) and plan_tier(
|
||||
int((vram_gib or 0.0) * GIB), int(min(ram_hw, float(ram_gib) / 2.0) * GIB), tier=engine_tier, vram_budget=int(vram_budget_gib * GIB), ram_budget=int(ram_budget_gib * GIB),
|
||||
turbo_ssd=turbo_ssd, ctx=n, chunk=ch, prefetch=prefetch, vision_vram=ev, vision_host=eh, pool="auto", kv_init=KV_INIT_ROWS,
|
||||
logits_rows=SERVE_LOGITS_ROWS, mtp_file_bytes=MTP_SIDECAR_BYTES if mtp else 0, mtp_expert_bytes=MTP_EXPERT_BYTES if mtp else 0, mtp_vram=mv)["mode"] == "C":
|
||||
# Windows (pin_half), the tier predicted with the engine's pin cap (half of the system RAM) is C: the small chunk; the plan itself keeps the real RAM (the chunk is the only change). The misses are real SSD reads there (NO_BUFFERING) and the larger scratch takes pool slots, so the hit rate costs I/O (the owner's 5070, tier C
|
||||
# on a 64 GB Windows PC, 33,784 tokens: 83 tok/s at 256, 54.5 at 2048). On Linux the page cache serves the misses and 2048 wins in tier C too (the 3060 Ti 8 GB, 62 GB RAM: 1.2 to 2.0x)
|
||||
ch = WINDOWS_TIER_C_CHUNK
|
||||
got = plan_tier(int((vram_gib or 0.0) * GIB), int(ram_hw * GIB), tier=engine_tier, vram_budget=int(vram_budget_gib * GIB), ram_budget=int(ram_budget_gib * GIB),
|
||||
turbo_ssd=turbo_ssd, ctx=n, chunk=ch, prefetch=prefetch, vision_vram=ev, vision_host=eh, pool="auto", kv_init=KV_INIT_ROWS,
|
||||
logits_rows=SERVE_LOGITS_ROWS, mtp_file_bytes=MTP_SIDECAR_BYTES if mtp else 0, mtp_expert_bytes=MTP_EXPERT_BYTES if mtp else 0, mtp_vram=mv)
|
||||
if gpu_cap_gib and not unified and got["ok"] and got["mode"] != "A":
|
||||
counted = got["vram_total_planned"] + got["ring_bytes"] # the card part and the ring / staging count against the cap; the RAM tier does not
|
||||
if counted > (gpu_cap_gib - IGPU_CAP_RESERVE_GIB) * GIB:
|
||||
@@ -560,12 +583,12 @@ def disk_gb(vision: bool = True) -> float:
|
||||
|
||||
def advise(vram_gib: float | None, ram_gib: float, *, unified: bool = False, disk_free_gb: float | None = None, ssd_gbps: float | None = None, tier: str = "auto",
|
||||
vram_budget_gib: float = 0.0, ram_budget_gib: float = 0.0, turbo_ssd: bool = False, ctx: int | None = None, vision: bool = True, vision_device: str = "auto", backend: str = "cuda",
|
||||
gpu_cap_gib: float | None = None, mtp: bool = False, card_gib: float | None = None) -> dict:
|
||||
gpu_cap_gib: float | None = None, mtp: bool = False, card_gib: float | None = None, pin_half: bool = False) -> dict:
|
||||
"""What the launcher shows for a PC: the plan, the speed class, the engine flags the choices need and the warnings (never a refusal). `vision` (on by default, like the download
|
||||
set): the picture encoder's memory is in the plan (GPU encoder: 829 MiB of weights + activations on a card of 24 GiB or more; CPU encoder: about 1 GiB of host memory) and the
|
||||
Vision shard is in the disk need. Returns {"plan", "tier", "speed", "args", "warnings", "fits", "download_gb"}."""
|
||||
p = plan(vram_gib, ram_gib, unified=unified, tier=tier, vram_budget_gib=vram_budget_gib, ram_budget_gib=ram_budget_gib, turbo_ssd=turbo_ssd, ctx=ctx, vision=vision,
|
||||
vision_device=vision_device, gpu_cap_gib=gpu_cap_gib, mtp=mtp, backend=backend, card_gib=card_gib)
|
||||
vision_device=vision_device, gpu_cap_gib=gpu_cap_gib, mtp=mtp, backend=backend, card_gib=card_gib, pin_half=pin_half)
|
||||
warns: list[str] = list(p["notes"])
|
||||
if not p["ok"]:
|
||||
warns.append(p["error"])
|
||||
|
||||
@@ -292,17 +292,47 @@ def test_engine_chunk_rule_and_the_launchers_use_of_it():
|
||||
def test_the_launcher_chunk_by_card_size():
|
||||
# L32-CUDA, RTX 5090 tier B: --chunk 256 made a 4062-token prefill 33 % slower and a 32K one 115 % slower than the engine's default; the small chunk stays where memory is the limit
|
||||
assert [F.chunk_for(g) for g in (8, 11.4, 11.5, 11.6, 12, 13.9, 14, 15.0, 15.5, 15.9, 16, 19.9, 20, 22.4, 23.3, 24, 26.9, 27, 29.9, 30, 31.4, 32, 39.5, 43.9, 44, 47.5, 47.9, 48, 96)] == [
|
||||
256, 256, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 1024, 1024, 1024, 1024, 1024]
|
||||
2048, 256, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 1024, 1024, 1024, 1024, 1024]
|
||||
# the nominal classes: a 16 GB card reports 15.9 GiB (an RTX 5070 Ti), a 24 GB card 23.x, a 32 GB card 31.4, a 48 GB card 47.5; the free memory after the desktop is a little less still
|
||||
for reported, nominal in ((15.9, 16), (15.5, 16), (14.4, 16), (23.5, 24), (22.4, 24), (20.5, 24), (31.4, 32), (29.0, 32), (47.5, 48), (45.0, 48)):
|
||||
assert F.chunk_for(reported) == F.chunk_for(nominal), (reported, nominal)
|
||||
assert F.chunk_for(23.5) == 2048 and F.chunk_for(15.9) == 2048 and F.chunk_for(12) == 2048 and F.chunk_for(11.0) == 256 and F.chunk_for(9.8) == 256 # 24 GB: L32-CUDA's 3090 / 4090 sweep; 16 GB: MID2 + L32-SMALL's A4000 gate (prefill +18 to +21 % with the pool regrow, decode flat)
|
||||
assert F.chunk_for(23.5) == 2048 and F.chunk_for(15.9) == 2048 and F.chunk_for(12) == 2048 and F.chunk_for(11.0) == 256 and F.chunk_for(9.8) == 256 and F.chunk_for(7.6) == 2048 and F.chunk_for(8.9) == 2048 and F.chunk_for(5.9) == 256 and F.chunk_for(9.0) == 256 # 24 GB: L32-CUDA's 3090 / 4090 sweep; 16 GB: MID2 + L32-SMALL's A4000 gate (prefill +18 to +21 % with the pool regrow, decode flat)
|
||||
|
||||
assert F.chunk_for(None) == 1024 and F.chunk_for(0) == 1024 and F.chunk_for(96, unified=True) == 1024
|
||||
assert p(32, 128)["chunk"] == 2048 and p(24, 128)["chunk"] == 2048 and p(12, 128)["chunk"] == 2048 and p(8, 128)["chunk"] == 256
|
||||
assert p(32, 128)["chunk"] == 2048 and p(24, 128)["chunk"] == 2048 and p(12, 128)["chunk"] == 2048 and p(8, 128)["chunk"] == 2048
|
||||
# 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, 64, card_gib=11.95)["chunk"] == 2048 and F.advise(10.8, 64, card_gib=11.95)["plan"]["chunk"] == 2048
|
||||
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)
|
||||
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):
|
||||
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"}
|
||||
# the 8 GB class (L32-SMALL's 3060 Ti, tier C, 62 GB RAM, loader-reserve fix 03006f62ed: 2048 beats 256 by 1.2 to 2.0x on Linux): 2048 except Windows in tier C
|
||||
got = F.plan(7.6, 62, ctx=131072, card_gib=8.0)
|
||||
assert (got["mode"], got["chunk"]) == ("C", 2048), (got["mode"], got["chunk"])
|
||||
got = F.plan(7.6, 64, ctx=131072, card_gib=8.0, pin_half=True)
|
||||
assert (got["mode"], got["chunk"]) == ("C", F.WINDOWS_TIER_C_CHUNK), (got["mode"], got["chunk"])
|
||||
# whichever chunk the Windows tier C constant names, the planner (the loader-reserve rule of 03006f62ed) must fit it on the 8 and 12 GB cards at the default context
|
||||
for card in (7.6, 11.95):
|
||||
for chunk in (256, 2048, 4096, F.WINDOWS_TIER_C_CHUNK):
|
||||
fit = F.plan(card, 64, ctx=131072, card_gib=card, pin_half=True, chunk=chunk)
|
||||
assert fit["ok"], (card, chunk, fit.get("notes"))
|
||||
assert F.plan(7.6, 64, ctx=131072, card_gib=8.0, pin_half=True, chunk=2048)["chunk"] == 2048
|
||||
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")
|
||||
# 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"]
|
||||
|
||||
@@ -582,13 +582,14 @@ class FamilyData(unittest.TestCase):
|
||||
def test_intel_cards_get_the_chunk_of_their_class_and_no_cuda_tuning_flags(self):
|
||||
# L32-SYCL: the 20 to 44 GiB class (the 32 GB B70) 2048 like everywhere, the 8 to 16 GiB cards (A750, B580) 1024 (the CUDA rule gives them 256: pool slots), no --tc / --graph / --mla-kernel
|
||||
self.assertEqual([ling32_fit.chunk_for(g, backend="sycl") for g in (8, 12, 15.9, 19.9, 20, 31.16, 43.9, 44, 96)], [1024, 1024, 1024, 1024, 2048, 2048, 2048, 1024, 1024])
|
||||
self.assertEqual([ling32_fit.chunk_for(g) for g in (8, 12, 15.9)], [256, 2048, 2048]) # NVIDIA: the 12 GB class (11.5 GiB and up) and the 16 GB class take 2048 with the pool regrow
|
||||
self.assertEqual([ling32_fit.chunk_for(g) for g in (8, 12, 15.9)], [2048, 2048, 2048]) # NVIDIA: the 12 GB class (11.5 GiB and up) and the 16 GB class take 2048 with the pool regrow
|
||||
self.assertEqual([ling32_fit.chunk_for(g, backend="hip") for g in (8, 15.9, 23.5, 26.9, 27, 31.9, 43.9, 47.5)], [256, 1024, 1024, 1024, 2048, 2048, 2048, 1024]) # AMD: no 2048 below the 32 GB class (no pool regrow on a Radeon yet)
|
||||
self.assertEqual(ling32_fit.plan(23.5, 64.0, backend="hip")["chunk"], 1024)
|
||||
self.assertEqual(ling32_fit.plan(23.5, 64.0)["chunk"], 2048)
|
||||
self.assertEqual(ling32_fit.plan(8.0, 32.0, backend="sycl")["chunk"], 1024)
|
||||
self.assertEqual(ling32_fit.plan(31.16, 64.0, backend="sycl")["chunk"], 2048)
|
||||
self.assertEqual(ling32_fit.plan(8.0, 32.0)["chunk"], 256)
|
||||
self.assertEqual(ling32_fit.plan(8.0, 32.0)["chunk"], 2048) # the 8 GB class: 2048 since the loader-reserve fix (03006f62ed)
|
||||
self.assertEqual(ling32_fit.plan(5.9, 32.0)["chunk"], 256)
|
||||
from strata_cli.launch import adopt
|
||||
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as td:
|
||||
td = Path(td)
|
||||
|
||||
@@ -360,8 +360,12 @@ class EngineArgs(unittest.TestCase):
|
||||
self.assertEqual(args, ["--ctx", "32768", "--chunk", "4096", "--tc", "16", "--tc-moe", "128", "--graph", "--mla-kernel", "simt"])
|
||||
|
||||
def test_a_small_card_gets_a_small_chunk_and_the_plan_is_in_the_result(self):
|
||||
args, adv = setup.ling32_engine_args(ns(), 8.0, 16.0, False, 32768)
|
||||
self.assertEqual(args[args.index("--chunk") + 1], "256")
|
||||
args, adv = setup.ling32_engine_args(ns(), 5.9, 16.0, False, 32768)
|
||||
self.assertEqual(args[args.index("--chunk") + 1], "256") # a 6 GB card: the small chunk
|
||||
args, adv = setup.ling32_engine_args(ns(), 8.0, 16.0, False, 32768, pin_half=False)
|
||||
self.assertEqual(args[args.index("--chunk") + 1], "2048") # the 8 GB class on Linux: 2048 (the loader-reserve fix)
|
||||
args, adv = setup.ling32_engine_args(ns(), 8.0, 64.0, False, 32768, pin_half=True)
|
||||
self.assertEqual(args[args.index("--chunk") + 1], str(setup.ling32_fit.WINDOWS_TIER_C_CHUNK)) # Windows in tier C: the one constant
|
||||
self.assertEqual(adv["tier"], "C")
|
||||
self.assertNotIn("--tier", args) # auto: the engine plans by itself with the same rule
|
||||
|
||||
@@ -715,7 +719,7 @@ class Install(unittest.TestCase):
|
||||
rc, w, says, _ = self.run_install(vram_gb=8.0, ram=16)
|
||||
self.assertEqual(rc, 0)
|
||||
self.assertTrue(any("warn" in s and "read from the SSD" in s for s in says))
|
||||
self.assertEqual(w["cfg"]["args"][w["cfg"]["args"].index("--chunk") + 1], "256")
|
||||
self.assertEqual(w["cfg"]["args"][w["cfg"]["args"].index("--chunk") + 1], str(setup.ling32_fit.WINDOWS_TIER_C_CHUNK) if setup.WIN else "2048") # 8 GB: 2048, Windows tier C the constant
|
||||
|
||||
|
||||
class ConfigAndCatalog(unittest.TestCase):
|
||||
|
||||
Reference in new issue
Block a user