Files
vllm-omni/tests/benchmarks/test_hw_emulation.py
T
tzhouamandClaude Fable 5.1 55192de984 [Edge][WP4] Add hardware adaptation: probe, derived overrides, auto profile, calibration
* vllm_omni/edge/hardware_probe.py: HardwareProfile from /proc, /sys and torch
  (ISA flags incl. AVX-512/AMX and NEON/dotprod/i8mm/SVE, physical cores,
  big.LITTLE clusters, NUMA, RAM, CUDA discrete vs Tegra unified memory, NPU
  via override), hardware classes jetson / cuda_discrete / arm64_cpu / x86_cpu /
  npu_phone; VLLM_OMNI_HW_PROFILE=<json> overrides the probe (emulation, tests).
* vllm_omni/edge/adapt.py: derive_overrides -> dtype, absolute KV budgets from
  available memory minus weights, max_num_seqs, per-stage disjoint CPU thread
  ranges on the big cluster, eager/graph switches for small or unified memory,
  adaptive-chunk parameters, timeouts from a load cost model.
* vllm_omni/edge/calibrate.py: chunk-schedule calibration from measured chunk
  arrivals with a per-hardware-fingerprint cache under VLLM_CACHE_ROOT.
* vllm_omni/edge/auto_profile.py + deploy_profile="auto": edge/<model>.yaml ->
  edge/hardware/<class>.yaml -> derived overrides -> cached calibration,
  materialized as a temp deploy YAML (platform overlays are superseded).
* benchmarks/tts/hw_emulation.py: emulated classes (ATEN_CPU_CAPABILITY,
  taskset, profile overrides) driving stream_latency_bench with auto profiles.
* CPU-only tests for probe snapshots, derivation rules, calibration and auto.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 11:01:40 +08:00

44 lines
1.3 KiB
Python

"""Tests for benchmarks/tts/hw_emulation.py case construction (CPU)."""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent.parent / "benchmarks" / "tts"))
import hw_emulation as hw # noqa: E402
from vllm_omni.edge.hardware_probe import hardware_class # noqa: E402
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
def test_cases_map_to_expected_classes():
expected = {
"x86_cpu_avx2": "x86_cpu",
"x86_cpu_avx512": "x86_cpu",
"x86_cpu_amx": "x86_cpu",
"arm64_cpu_logic": "arm64_cpu",
"jetson_orin_8g": "jetson",
"jetson_orin_32g": "jetson",
"cuda_discrete_8g": "cuda_discrete",
}
for name, cls in expected.items():
prof = hw.build_profile(hw.CASES[name])
assert hardware_class(prof) == cls, name
assert prof.source == "emulation"
def test_avx2_case_disables_bf16_and_pins_cores():
case = hw.CASES["x86_cpu_avx2"]
prof = hw.build_profile(case)
assert prof.supports_bf16 is False and prof.n_logical == 4
assert case.env["ATEN_CPU_CAPABILITY"] == "avx2" and case.cpus == [0, 1, 2, 3]
def test_table_render_handles_missing_metrics():
table = hw.render_table([{"case": "x", "returncode": -1, "note": "timeout"}])
assert "| x | -1 |" in table and "timeout" in table