Intel/AMD GPU telemetry in benchmark runs (hwmon power/temperature, amdgpu sysfs, Intel VRAM/utilization from DRM fdinfo via a minimal host-PID probe container), temperature for all GPUs, VRAM estimate for NVIDIA and Intel/AMD in the deployment form, /dev/dri group IDs added to Intel/AMD runtime containers, Intel llama.cpp presets seeded on first detection, ZES_ENABLE_SYSMAN=1 for the SYCL preset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee6c623e2a
commit
e007a35143
16 files changed
+781
-98
No files matched your search
@@ -128,6 +128,37 @@ export const LLAMA_DEFAULT_CACHE_RAM_MB = 8192;
|
||||
|
||||
const KV_TYPE_FACTOR: Record<string, number> = { f32: 2, f16: 1, bf16: 1, q8_0: 0.53, q5_0: 0.34, q5_1: 0.38, q4_0: 0.28, q4_1: 0.31, iq4_nl: 0.28 };
|
||||
|
||||
/** llama.cpp KV cache in MiB for a model of `modelMb`: the per-token heuristic below, scaled by the cache type. */
|
||||
function kvCacheMb(modelMb: number, contextSize: number, o: Pick<DeploymentOptions, "cacheTypeK" | "cacheTypeV">): number {
|
||||
const perTokenKiB = 96 + 24 * Math.sqrt(modelMb / 1024);
|
||||
const kvFactor = ((KV_TYPE_FACTOR[o.cacheTypeK ?? "f16"] ?? 1) + (KV_TYPE_FACTOR[o.cacheTypeV ?? "f16"] ?? 1)) / 2;
|
||||
return (contextSize * perTokenKiB * kvFactor) / 1024;
|
||||
}
|
||||
|
||||
/** llama.cpp compute buffers and runtime state on the GPU (measured order of magnitude, not exact). */
|
||||
const GPU_OVERHEAD_MB = 1024;
|
||||
|
||||
/**
|
||||
* Rough VRAM need of a GPU deployment in MiB, for NVIDIA and Intel/AMD (/dev/dri) alike; null when it
|
||||
* can't be told without reading the model (only some layers or the MoE experts offloaded).
|
||||
* - vLLM reserves --gpu-memory-utilization (default 0.9) of each GPU's VRAM up front.
|
||||
* - llama.cpp with all layers on the GPU ("auto" fits as many as there is room for): weights + KV
|
||||
* cache + compute buffers.
|
||||
*/
|
||||
export function estimateVramMb(
|
||||
fileBytes: number,
|
||||
contextSize: number,
|
||||
engine: RuntimeEngine,
|
||||
o: Pick<DeploymentOptions, "gpuLayers" | "cacheTypeK" | "cacheTypeV" | "cpuMoe" | "nCpuMoe" | "gpuMemoryUtilization">,
|
||||
vramTotalMb: number | null,
|
||||
): number | null {
|
||||
if (engine === "vllm") return vramTotalMb ? Math.ceil(vramTotalMb * (o.gpuMemoryUtilization ?? 0.9)) : null;
|
||||
const layers = o.gpuLayers ?? "auto";
|
||||
if ((layers !== "auto" && layers !== "all") || o.cpuMoe || (o.nCpuMoe ?? 0) > 0) return null;
|
||||
const model = fileBytes / 2 ** 20;
|
||||
return Math.ceil(model + kvCacheMb(model, contextSize, o) + GPU_OVERHEAD_MB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rough RAM need of a deployment in MiB, for the memory limit. Without the GGUF header the KV size
|
||||
* per token is a heuristic: ~110 KiB (f16) for sub-1B models up to ~250 KiB around 70B with GQA.
|
||||
@@ -144,9 +175,7 @@ export function estimateMemoryMb(
|
||||
// vLLM CPU: API server, engine core and worker each load torch (~3 GiB measured with v0.31.0).
|
||||
// On a GPU the weights and KV cache live in VRAM; RAM holds the processes.
|
||||
if (engine === "vllm") return Math.ceil(gpu ? 6144 : model + (o.kvCacheGb ?? 4) * 1024 + 3072);
|
||||
const perTokenKiB = 96 + 24 * Math.sqrt(model / 1024);
|
||||
const kvFactor = ((KV_TYPE_FACTOR[o.cacheTypeK ?? "f16"] ?? 1) + (KV_TYPE_FACTOR[o.cacheTypeV ?? "f16"] ?? 1)) / 2;
|
||||
const kv = (contextSize * perTokenKiB * kvFactor) / 1024;
|
||||
const kv = kvCacheMb(model, contextSize, o);
|
||||
const cache = o.cacheRamMb == null ? LLAMA_DEFAULT_CACHE_RAM_MB : o.cacheRamMb < 0 ? LLAMA_DEFAULT_CACHE_RAM_MB : o.cacheRamMb;
|
||||
// The memory-mapped model counts against the container's limit (page cache), even when offloaded.
|
||||
return Math.ceil(model + (gpu ? 0 : kv) + cache + 768);
|
||||
|
||||
Reference in new issue
Block a user