From 5553820d90701455b41daab8ecab7282fba7f1d1 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Fri, 25 Aug 2023 14:00:24 +0100 Subject: [PATCH] Allow disabling unused logit skipping code w/ cmake / make options cmake -DLLAMA_SKIP_UNUSED_LOGITS=OFF ... LLAMA_NO_SKIP_UNUSED_LOGITS=1 make ... --- CMakeLists.txt | 5 +++++ Makefile | 5 +++++ llama.cpp | 6 ------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb63ef98e..de389f350 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,7 @@ option(LLAMA_METAL "llama: use Metal" option(LLAMA_MPI "llama: use MPI" OFF) option(LLAMA_K_QUANTS "llama: use k-quants" ON) option(LLAMA_QKK_64 "llama: use super-block size of 64 for k-quants" OFF) +option(LLAMA_SKIP_UNUSED_LOGITS "llama: skip computation of unused logits" ON) option(LLAMA_BUILD_TESTS "llama: build tests" ${LLAMA_STANDALONE}) option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE}) @@ -352,6 +353,10 @@ if (LLAMA_CLBLAST) endif() endif() +if (LLAMA_SKIP_UNUSED_LOGITS) + add_compile_definitions(LLAMA_SKIP_UNUSED_LOGITS) +endif() + if (LLAMA_ALL_WARNINGS) if (NOT MSVC) set(c_flags diff --git a/Makefile b/Makefile index d31acc450..85e9869c7 100644 --- a/Makefile +++ b/Makefile @@ -302,6 +302,11 @@ k_quants.o: k_quants.c k_quants.h $(CC) $(CFLAGS) -c $< -o $@ endif # LLAMA_NO_K_QUANTS +ifndef LLAMA_NO_SKIP_UNUSED_LOGITS + CFLAGS += -DLLAMA_SKIP_UNUSED_LOGITS + CXXFLAGS += -DLLAMA_SKIP_UNUSED_LOGITS +endif + # # Print build information # diff --git a/llama.cpp b/llama.cpp index 5692ced56..7cb5e158f 100644 --- a/llama.cpp +++ b/llama.cpp @@ -56,12 +56,6 @@ #include // for _fseeki64 #endif -// TODO: Fix unused logit skipping crashes on ROCm -// (see https://github.com/ggerganov/llama.cpp/pull/2700#issuecomment-1689548127) -#ifndef LLAMA_USE_HIPBLAS -#define LLAMA_SKIP_UNUSED_LOGITS -#endif - #include #include #include