diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-06-01 04:22:49 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-06-14 08:27:03 +0200 |
| commit | 17a81db4313e6242f233a3300f6ffefc95b50e66 (patch) | |
| tree | 2b81258626b73432a30ff27ce79a45a42d48a8be /main.c | |
| parent | 7014b630c628ba78920aa27a7eae5ead3f2f10f9 (diff) | |
| download | ffwd-17a81db4313e6242f233a3300f6ffefc95b50e66.tar.gz ffwd-17a81db4313e6242f233a3300f6ffefc95b50e66.zip | |
server: reject unsafe mlx model overcommit
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -42,6 +42,8 @@ static void print_usage(const char *prog) " Load model ID from directory for --serve (repeatable)\n" " --backend cpu|mlx\n" " Backend for --serve (default: cpu)\n" + " --allow-memory-overcommit\n" + " Allow an MLX server model set above the host-memory safety budget\n" " --host HOST Server bind host (default: 127.0.0.1)\n" " --port N Server bind port (default: 8000)\n" " --cors Enable CORS headers in --serve mode\n" @@ -507,6 +509,7 @@ int main(int argc, char *argv[]) int stdin_mode = 0; int serve_mode = 0; int dist_worker_mode = 0; + int allow_memory_overcommit = 0; const char *dist_remote = NULL; int layer_start = -1; int layer_end = -1; @@ -567,6 +570,9 @@ int main(int argc, char *argv[]) } else if (!strcmp(f, "--host")) { host = argv[++arg_start]; } else if (!strcmp(f, "--port")) { port = atoi(argv[++arg_start]); } + else if (!strcmp(f, "--allow-memory-overcommit")) { + allow_memory_overcommit = 1; + } else if (!strcmp(f, "--layers")) { if (parse_layers(argv[++arg_start], &layer_start, &layer_end) != 0) { fprintf(stderr, "--layers expects START:END with START < END\n"); @@ -633,6 +639,7 @@ int main(int argc, char *argv[]) .max_batch_tokens = max_batch_tokens, .batch_wait_us = batch_wait_us, .use_mlx = use_mlx, + .allow_memory_overcommit = allow_memory_overcommit, .enable_cors = cors, .api_key = api_key, }; |
