aboutsummaryrefslogtreecommitdiff
path: root/pplx_server.c
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-10 07:30:34 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-14 08:27:03 +0200
commitc14151290df20e1a2ebc9fb06a77b075ca4ad959 (patch)
treed4b53dd131f0e5f5f8f5dd60727cc13a76c42534 /pplx_server.c
parentdcc54e7a267f88ed456209c63f58c7130274e8da (diff)
downloadffwd-c14151290df20e1a2ebc9fb06a77b075ca4ad959.tar.gz
ffwd-c14151290df20e1a2ebc9fb06a77b075ca4ad959.zip
cli: rename flags, add --stream, split serving into pplx-embed-server
Diffstat (limited to 'pplx_server.c')
-rw-r--r--pplx_server.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/pplx_server.c b/pplx_server.c
index 6e7bb22..f8ad5e1 100644
--- a/pplx_server.c
+++ b/pplx_server.c
@@ -2266,29 +2266,26 @@ static int mlx_memory_preflight(const pplx_server_config_t *cfg) {
"skipping MLX memory preflight");
return 0;
}
- uint64_t budget =
- physical / 100 * PPLX_MLX_MEMORY_BUDGET_PERCENT +
- physical % 100 * PPLX_MLX_MEMORY_BUDGET_PERCENT / 100;
+ double utilization = cfg->memory_utilization > 0.0
+ ? cfg->memory_utilization
+ : PPLX_MLX_MEMORY_BUDGET_PERCENT / 100.0;
+ uint64_t budget = (uint64_t)((double)physical * utilization);
const double gib = 1024.0 * 1024.0 * 1024.0;
server_log("pplx-serve: MLX memory preflight: %.1f GiB tensors, "
- "%.1f GiB estimated resident, %.1f GiB safety budget",
+ "%.1f GiB estimated resident, %.1f GiB budget "
+ "(%.2f of physical memory)",
(double)payload / gib, (double)estimated / gib,
- (double)budget / gib);
+ (double)budget / gib, utilization);
if (cfg->mlx_quantize_bits) {
server_log("pplx-serve: MLX %d-bit quantization enabled; preflight "
"uses source payload as a conservative peak estimate",
cfg->mlx_quantize_bits);
}
if (estimated <= budget) return 0;
- if (cfg->allow_memory_overcommit) {
- server_log("pplx-serve: warning: MLX memory estimate exceeds safety "
- "budget; continuing due to --allow-memory-overcommit");
- return 0;
- }
- server_log("pplx-serve: refusing MLX model set above host-memory safety "
+ server_log("pplx-serve: refusing MLX model set above the host-memory "
"budget");
- server_log("pplx-serve: use BF16 artifacts, load fewer models, or pass "
- "--allow-memory-overcommit");
+ server_log("pplx-serve: use BF16 artifacts, load fewer models, or raise "
+ "--memory-utilization (values above 1.0 overcommit)");
return -1;
}