Renamed from vllm-embedding: nothing here is about embeddings, and the name had come from the parent working directory. edge-infer says what it does. The GitHub repository is renamed to match; nothing had been pushed yet. The audit found the packaging was incomplete in two ways. Scripts: 56 of them produced results that are published in this repo but were not included, so the numbers could be read and not checked. Added under benchmarks/edge_harness/experiments/ (one-off drivers: the AI Hub on-device runs, the 4-bit GEMM microbenchmark, fidelity and parity checks, checkpoint build and round-trip, activation capture, and the load generator used to prove the contention guard actually refuses) and benchmarks/edge_harness/runs/ (the 24 shell drivers behind published grids). Both directories carry a README saying plainly that they are a record of what was run rather than a supported interface -- most hardcode absolute paths from the machine they ran on. The supported entry points remain the tools one level up. One broken relative link fixed (comparison.md is under docs/engines/, not docs/analysis/). All other links and every script reference in the docs now resolve inside the repo. Secret scan: the token in ~/.qai_hub/client.ini is absent from the worktree and from all 61 commits. Worth noting that an earlier version of my own check reported a false positive, because `grep -rl ... | head` takes its exit status from head, which always succeeds -- the same class of mistake as the measurement errors this project keeps recording. The AI Hub scripts authenticate by reading that file at runtime and contain no credential. README reframed for the new name and the wider scope: the repository is the engine changes, the harness, the raw results, the baselines and the analyses, not just a patch set. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1ax5wYLA6XbqEL1i8L9gZ
56 lines
2.7 KiB
Bash
Executable File
56 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Final matched comparison, strictly sequential on the same pinned cores with
|
|
# nothing else running: llama.cpp Q4_K_M against both vLLM 4-bit paths.
|
|
# W4A16 group-wise weights, bf16 activations, tinygemm kernel (cpu_int4)
|
|
# W4A8 group-wise weights, int8 activations, AMX kernel (gptq)
|
|
# W4A8 is the arithmetic llama.cpp's Q4_K_M actually does (Q4_K x Q8_K).
|
|
#
|
|
# The OMP team is kept hot between regions (KMP_BLOCKTIME/OMP_WAIT_POLICY),
|
|
# which is the one thread-fan-out knob that survived measurement. Forcing
|
|
# inductor's small elementwise kernels single-threaded (cpp.min_chunk_size)
|
|
# was tried and dropped: -6% decode and -19% prefill, because it also
|
|
# serialises the kernels that have real work at prefill.
|
|
set -u
|
|
HERE=/data/zhoutaichang/embedding_infer/analysis/experiments/spark_edge
|
|
V=/data/zhoutaichang/embedding_infer/.venvs/omni-cpu
|
|
G=/data/zhoutaichang/.cache/huggingface/hub/models--XHToken--Spark-X2.5-1.7B-GGUF/snapshots/23e1fcac55e7dd71e4c12a23723cc228ba0e5e85
|
|
B=/data/zhoutaichang/embedding_infer/llama.cpp/build/bin/llama-bench
|
|
M=/data/zhoutaichang/embedding_infer/models
|
|
W4A16=$M/spark2_5-int4-g64
|
|
W4A8=$M/spark2_5-gptq-g64
|
|
OUT=$HERE/final_grid.jsonl
|
|
cd $HERE
|
|
|
|
run_vllm () { # tag model threads [--cc json] [env...]
|
|
local tag=$1 model=$2 t=$3; shift 3
|
|
local cc=""
|
|
if [ "${1:-}" = "--cc" ]; then cc="$2"; shift 2; fi
|
|
local last=$((t-1))
|
|
env "$@" LD_PRELOAD="$V/lib/python3.12/site-packages/vllm/libs/libtcmalloc_minimal.so.4:$V/lib/libiomp5.so" \
|
|
CUDA_VISIBLE_DEVICES= VLLM_TARGET_DEVICE=cpu VLLM_CPU_KVCACHE_SPACE=4 VLLM_ENABLE_V1_MULTIPROCESSING=0 \
|
|
OMP_NUM_THREADS=$t VLLM_CPU_OMP_THREADS_BIND=0-$last \
|
|
taskset -c 0-$last timeout 2400 $V/bin/python bench_cpu_vllm.py --model "$model" \
|
|
--tag "$tag" --reps 3 --out $OUT ${cc:+--compilation-config "$cc"} 2>&1 \
|
|
| grep -E '"(tag|pp_tps|tg_tps|rss_mb)"'
|
|
}
|
|
|
|
llamacpp () {
|
|
local t=$1 last=$((t-1))
|
|
taskset -c 0-$last $B -m $G/Spark-X2.5-1.7B-Q4_K_M.gguf -p 512 -n 128 -t $t -o json 2>/dev/null \
|
|
> $HERE/final_llamacpp_t$t.json
|
|
python3 -c "
|
|
import json;d=json.load(open('$HERE/final_llamacpp_t$t.json'))
|
|
print(' llama.cpp Q4_K_M t=$t ', {('pp512' if r['n_prompt'] else 'tg128'): round(1e9*(r['n_prompt'] or r['n_gen'])/r['avg_ns'],2) for r in d})"
|
|
}
|
|
|
|
for t in 32 16; do
|
|
echo "######## threads=$t"
|
|
llamacpp $t
|
|
run_vllm "w4a16-t$t" $W4A16 $t KMP_BLOCKTIME=infinite OMP_WAIT_POLICY=active
|
|
run_vllm "w4a8-t$t" $W4A8 $t KMP_BLOCKTIME=infinite OMP_WAIT_POLICY=active
|
|
run_vllm "w4a16-g128-t$t" $M/spark2_5-int4-g128 $t KMP_BLOCKTIME=infinite OMP_WAIT_POLICY=active
|
|
done
|
|
echo "######## bf16 control t=32"
|
|
run_vllm "bf16-t32" XHToken/Spark-X2.5-1.7B 32 KMP_BLOCKTIME=infinite OMP_WAIT_POLICY=active
|
|
echo "######## FINAL GRID DONE"
|