mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-10-17 05:11:19 +08:00
e80614fc2d
* feat(sft): support distributed activation reuse policies * feat(sft): add frozen-base INT8 LoRA training * fix(sft): make INT8 expert LoRA rank-zero authoritative * fix(sft): preserve DeepSeek router LoRA routing * feat(sft): enable persistent INT8 LoRA training * perf(sft): accelerate INT8 VNNI with oneDNN BRGEMM * perf(int8): fuse oneDNN compensation into backward repack * [feat]: support BF16 expert LoRA training * [fix]: honor forwarded activation policy in SFT workers * feat(sft): add native block-FP8 routed expert LoRA * feat(sft): expose explicit expert placeholder ownership * fix(sft): publish fused adapter artifacts atomically * feat(sft): own artifact and adapter lifecycle contracts * fix(sft): harden artifact and rank-local contracts * fix(sft): auto-adapt owner before adapter restore * style(sft): keep lifecycle comments concise * fix(sft): require fused adapter manifests * test(sft): use spawn for distributed workers * fix(sft): preserve runtime checkpoint metadata * fix(sft): validate wrapped runtime configuration * fix(sft): preserve expert format provenance * fix(sft): own routed experts during device dispatch * test(sft): lock explicit quantization conflict * fix(cpu): make shared memory buffers lifetime-safe * release: prepare v0.7.0
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
import sys
|
|
from types import SimpleNamespace
|
|
|
|
CPU_DETECT_PATH = Path(__file__).resolve().parents[2] / "python" / "_cpu_detect.py"
|
|
SPEC = importlib.util.spec_from_file_location(
|
|
"kt_cpu_detect_metadata_under_test",
|
|
CPU_DETECT_PATH,
|
|
)
|
|
assert SPEC is not None and SPEC.loader is not None
|
|
cpu_detect = importlib.util.module_from_spec(SPEC)
|
|
sys.modules[SPEC.name] = cpu_detect
|
|
SPEC.loader.exec_module(cpu_detect)
|
|
|
|
|
|
def test_initialize_reports_loaded_extension_variant(monkeypatch):
|
|
extension = SimpleNamespace(__cpu_variant__="avx512_bf16")
|
|
monkeypatch.setattr(cpu_detect, "detect_cpu_features", lambda: "amx")
|
|
monkeypatch.setattr(cpu_detect, "load_extension", lambda _variant: extension)
|
|
|
|
loaded, variant = cpu_detect.initialize()
|
|
|
|
assert loaded is extension
|
|
assert variant == "avx512_bf16"
|
|
|
|
|
|
def test_initialize_rejects_extension_newer_than_host(monkeypatch):
|
|
extension = SimpleNamespace(__cpu_variant__="amx")
|
|
monkeypatch.setattr(cpu_detect, "detect_cpu_features", lambda: "avx512_bf16")
|
|
monkeypatch.setattr(cpu_detect, "load_extension", lambda _variant: extension)
|
|
|
|
try:
|
|
cpu_detect.initialize()
|
|
except RuntimeError as error:
|
|
assert "requires a newer CPU ISA" in str(error)
|
|
else:
|
|
raise AssertionError("AMX extension must be rejected on an AVX512-BF16 host")
|