Files
leleka/engine/strata/tests/sycl/test_setup_intel_prefill.py
T
Pavlo RatushnyiandClaude Sonnet 5.5 87e2633afe engine/strata: bring the Strata subtree to upstream 41cf05a0 (engine 0.1.50) with the local patches re-applied
Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree
(570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base =
the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main).

Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR
experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details,
conflict table and left-out files are in docs/upstream.md.

Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61),
docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out.

scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run").
Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR
macros on. No GPU run, no quality gate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:49:15 +01:00

53 lines
2.2 KiB
Python

"""sycl/setup_intel.py: the prompt chunk size setup recommends for an Intel card (--prefill).
A Battlemage card (xe driver, not an A-series) with 24 GB or more and a context over 32K (the prompt borrows cache slots) gets
8192; everything else keeps 4096; a chunk size the user put in the config is kept."""
import importlib.util
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent.parent
sys.path.insert(0, str(ROOT))
_spec = importlib.util.spec_from_file_location("setup_intel", ROOT / "sycl" / "setup_intel.py")
si = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(si)
B70 = dict(vram_gb=32.0, driver="xe", devid="e223")
A770 = dict(vram_gb=16.0, driver="xe", devid="56a0")
A750 = dict(vram_gb=8.0, driver="i915", devid="56a1")
def prefill_of(ctx, card, extra=()):
cfg = {"args": ["--max-context", str(ctx), "--kv", "int8", "--prefill", "auto", *extra]}
out = si.to_sycl(cfg, ROOT / "build-sycl-aot" / "strata", 64.0, {}, **card)
return si.flag(out["args"], "--prefill")
def test_helper_values():
assert si.recommended_prefill(32.0, 131072, "xe", "e223")[0] == 8192
assert si.recommended_prefill(32.0, 131072, "xe", "e223")[1] # a plain line says why
assert si.recommended_prefill(24.0, 65536, "xe", "e221")[0] == 8192
assert si.recommended_prefill(32.0, 32768, "xe", "e223") == (4096, "") # own prompt buffers: a bigger chunk costs cache slots
assert si.recommended_prefill(16.0, 131072, "xe", "e212")[0] == 4096 # under 24 GB
assert si.recommended_prefill(16.0, 131072, "xe", "56a0")[0] == 4096 # Alchemist
assert si.recommended_prefill(8.0, 131072, "i915", "56a1")[0] == 4096
def test_config_battlemage_long_context():
assert prefill_of(131072, B70) == "8192"
def test_config_battlemage_32k_keeps_4096():
assert prefill_of(32768, B70) == "4096"
def test_config_other_cards_unchanged():
assert prefill_of(131072, A770) == "4096"
assert prefill_of(131072, A750) == "4096"
def test_user_pick_is_kept():
cfg = {"args": ["--max-context", "131072", "--kv", "int8", "--prefill", "16384"]}
out = si.to_sycl(cfg, ROOT / "build-sycl-aot" / "strata", 64.0, {}, **B70)
assert si.flag(out["args"], "--prefill") == "16384"