From fb59488b7f2ca16899adc75e50bf252ca3e597af Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 22 Nov 2024 21:55:33 -0800 Subject: [PATCH] Upgrade to Cosmo v3.9.7 --- build/config.mk | 6 +++--- llama.cpp/llama-bench/main.cpp | 2 +- llama.cpp/main/main.cpp | 9 +++------ llamafile/server/main.cpp | 2 +- llamafile/tokenize.cpp | 2 +- whisper.cpp/main.cpp | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/build/config.mk b/build/config.mk index 5ec2947560..77e116caa0 100644 --- a/build/config.mk +++ b/build/config.mk @@ -2,7 +2,7 @@ #── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘ PREFIX = /usr/local -COSMOCC = .cosmocc/3.9.6 +COSMOCC = .cosmocc/3.9.7 TOOLCHAIN = $(COSMOCC)/bin/cosmo CC = $(TOOLCHAIN)cc @@ -52,5 +52,5 @@ clean:; rm -rf o .PHONY: distclean distclean:; rm -rf o .cosmocc -.cosmocc/3.9.6: - build/download-cosmocc.sh $@ 3.9.6 cb9611df6aa156f0bd94a10976dbd694cf137985d70a963be717e1cfb66fa19e +.cosmocc/3.9.7: + build/download-cosmocc.sh $@ 3.9.7 3f559555d08ece35bab1a66293a2101f359ac9841d563419756efa9c79f7a150 diff --git a/llama.cpp/llama-bench/main.cpp b/llama.cpp/llama-bench/main.cpp index c02a190946..8ea908ff9e 100644 --- a/llama.cpp/llama-bench/main.cpp +++ b/llama.cpp/llama-bench/main.cpp @@ -150,7 +150,7 @@ int main(int argc, char ** argv) { llamafile_check_cpu(); ShowCrashReports(); - LoadZipArgs(&argc, &argv); + argc = cosmo_args("/zip/.args", &argv); launch_sigint_thread(); if (!llamafile_has(argv, "--cli") && diff --git a/llama.cpp/main/main.cpp b/llama.cpp/main/main.cpp index 1926524279..cbf4eede5a 100644 --- a/llama.cpp/main/main.cpp +++ b/llama.cpp/main/main.cpp @@ -37,9 +37,6 @@ static std::vector * g_output_tokens; static bool is_interacting = false; static bool need_insert_eot = false; -extern "C" int nsync_futex_wake_(int *, int, char); -extern "C" int nsync_futex_wait_(int *, int, char, int, const struct timespec *); - static bool file_exists(const std::string & path) { std::ifstream f(path.c_str()); return f.good(); @@ -100,7 +97,7 @@ static int is_killed; static void *safe_sigint_handler(void *arg) { while (!is_killed) - nsync_futex_wait_(&is_killed, 0, 0, 0, 0); + cosmo_futex_wait(&is_killed, 0, 0, 0, 0); console::cleanup(); printf("\n"); llama_print_timings(*g_ctx); @@ -125,7 +122,7 @@ static void sigint_handler(int signo) { is_interacting = true; } else { is_killed = true; - nsync_futex_wake_(&is_killed, 1, 0); + cosmo_futex_wake(&is_killed, 1, 0); for (;;) { } } @@ -191,7 +188,7 @@ int main(int argc, char ** argv) { llamafile_check_cpu(); ShowCrashReports(); - LoadZipArgs(&argc, &argv); + argc = cosmo_args("/zip/.args", &argv); enum Program prog = determine_program(argv); diff --git a/llamafile/server/main.cpp b/llamafile/server/main.cpp index b7b0beaada..4f0ad4e260 100644 --- a/llamafile/server/main.cpp +++ b/llamafile/server/main.cpp @@ -56,7 +56,7 @@ main(int argc, char* argv[]) } // get config - LoadZipArgs(&argc, &argv); + argc = cosmo_args("/zip/.args", &argv); llamafile_get_flags(argc, argv); // initialize subsystems diff --git a/llamafile/tokenize.cpp b/llamafile/tokenize.cpp index e9039bbd03..1b10dad504 100644 --- a/llamafile/tokenize.cpp +++ b/llamafile/tokenize.cpp @@ -36,7 +36,7 @@ int main(int argc, char **argv) { FLAG_log_disable = true; - LoadZipArgs(&argc, &argv); + argc = cosmo_args("/zip/.args", &argv); llamafile_get_flags(argc, argv); llama_model_params mparams = { diff --git a/whisper.cpp/main.cpp b/whisper.cpp/main.cpp index 9a138f8727..dc3901755b 100644 --- a/whisper.cpp/main.cpp +++ b/whisper.cpp/main.cpp @@ -963,7 +963,7 @@ int main(int argc, char ** argv) { __builtin_unreachable(); } - LoadZipArgs(&argc, &argv); + argc = cosmo_args("/zip/.args", &argv); if (!llamafile_has(argv, "--cli") && (llamafile_has(argv, "--server") ||