Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.
Python amdapple-siliconcudadeepseekexl3exllamav3glminferencellmllm-inferencelocal-llmnvidiaopenai-apiquantizationqwenrocmstrix-halo
Merge perf/hy4-strix-193-testfix into 1.9.3 tree
YanissAmz433153152fa9
diff --cc tests/test_hy4_shipped_flags_cpu.pyindex 87d707e,0d39010..9e54978--- a/tests/test_hy4_shipped_flags_cpu.py+++ b/tests/test_hy4_shipped_flags_cpu.py@@@ -46,30 -43,51 +48,73 @@@ def test_every_flag_has_an_env_off_switassert re.search(r'environ\.get\("%s", "0"\)' % flag, src), f"{flag}: {path} must read it from the environment with the 1.9.0 behaviour (0) as code default"- def test_apply_env_keeps_user_values():+ @pytest.fixture+ def env(monkeypatch):+ """apply_env() sets many HY4_* variables: it runs on a private copy of the environment, nothing leaks into the other tests"""+ monkeypatch.setattr(os, "environ", dict(os.environ))+++ def _apply_env():+ """apply_env() and the constants it reads, cut out of serve.py (importing the module would pull the server stack in)"""src = open(os.path.join(TREE, "tools", "hy4", "serve.py")).read()- body = src[src.index("def apply_env"):]- body = body[:body.index("\ndef ", 10)]- assert "os.environ.setdefault(k, v)" in body+ keep = {"SHIPPED_ENV", "SLOTS_OFF"}+ nodes = []+ for node in ast.parse(src).body:+ if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id in keep for t in node.targets):+ nodes.append(node)+ elif isinstance(node, ast.FunctionDef) and node.name == "apply_env":+ nodes.append(node)+ assert len(nodes) == 3, "SHIPPED_ENV, SLOTS_OFF and apply_env must all be found in tools/hy4/serve.py"+ ns = {"os": os, "TREE": TREE}+ exec(compile(ast.Module(body = nodes, type_ignores = []), "serve.py", "exec"), ns)+ return ns+++ def test_apply_env_keeps_user_values(env):+ ns = _apply_env()+ for flag in FLAGS:+ os.environ.pop(flag, None)+ os.environ["HY4_PF_HC2"] = "0" # the rollback to 1.9.0: an explicit value always wins, with one slot or several+ for slots in (1, 4):+ os.environ["HY4_PF_HC2"] = "0"+ ns["apply_env"](4096, slots = slots)+ assert os.environ["HY4_PF_HC2"] == "0"+ assert os.environ["HY4_PF_ROUTER16"] == "1" # an unset flag takes its shipped value+ os.environ.pop("HY4_PF_ROUTER16")+++ def test_apply_env_turns_slot_unsafe_levers_off_with_slots(env):+ ns = _apply_env()+ for flag in ns["SLOTS_OFF"]:+ assert ns["SHIPPED_ENV"].get(flag) == "1", flag+ os.environ.pop(flag, None)+ ns["apply_env"](4096, slots = 1)+ assert os.environ[flag] == "1"+ os.environ.pop(flag)+ ns["apply_env"](4096, slots = 2)+ assert os.environ[flag] == "0"+ os.environ[flag] = "1" # explicit value still wins (MuEngine then refuses it)+ ns["apply_env"](4096, slots = 2)+ assert os.environ[flag] == "1"+++# ---- 1.9.2: opt-in fp8 KV (long context) and the head-blocked attend that reads it+++def _read(path):+ return open(os.path.join(TREE, path)).read()+++def test_kv_fp8_is_off_by_default_and_not_shipped():+ """-c 65536 keeps the fp32 cache: HY4_KV_FP8 is not in SHIPPED_ENV and its code default is 0 (the long-context option is the user's env)"""+ assert "HY4_KV_FP8" not in _shipped_env()+ assert re.search(r'environ\.get\("HY4_KV_FP8", "0"\) == "1"', _read("exllamav3/loader/step_graph.py"))+++def test_head_blocked_attend_defaults_and_switches():+ """HY4_LC_HB defaults on and HY4_LC_HB=0 switches it off; it can only run on the fp8 cache (qf), so it is on by default only when HY4_KV_FP8 is on"""+ src = _read("exllamav3/loader/lc_sparse.py")+ assert re.search(r'HB_ON = os\.environ\.get\("HY4_LC_HB", "1"\) == "1"', src)+ assert re.search(r'HB_SPLIT = int\(os\.environ\.get\("HY4_LC_HB_SPLIT", "-1"\)\)', src)+ assert "HY4_LC_HB" not in _shipped_env() and "HY4_LC_HB_SPLIT" not in _shipped_env()+ assert len(re.findall(r"if qf and HB_ON", src)) == 2, "both head-blocked launches must be gated by the fp8 cache flag qf"