From b9e99c69e8208a7b36755db449dade1c8f5a6feb Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Tue, 26 Nov 2024 22:06:55 +0800 Subject: [PATCH] fixed build --- CMakeLists.txt | 1 + Makefile | 4 ++-- gpttype_adapter.cpp | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a63fbf021..80fe5bb73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) add_compile_definitions(LOG_DISABLE_LOGS) +add_compile_definitions(GGML_USE_CPU) file(GLOB GGML_SOURCES_CUDA "ggml/src/ggml-cuda/*.cu") list(APPEND GGML_SOURCES_CUDA "ggml/src/ggml-cuda/ggml-cuda.cu") diff --git a/Makefile b/Makefile index 0b55b8f6e..551e052aa 100644 --- a/Makefile +++ b/Makefile @@ -48,8 +48,8 @@ ifdef KCPP_DEBUG CFLAGS = -g -O0 CXXFLAGS = -g -O0 endif -CFLAGS += -I. -Iggml/include -Iggml/src -Iggml/src/ggml-cpu -Iinclude -Isrc -I./include -I./include/CL -I./otherarch -I./otherarch/tools -I./otherarch/sdcpp -I./otherarch/sdcpp/thirdparty -I./include/vulkan -O3 -fno-finite-math-only -std=c11 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -CXXFLAGS += -I. -Iggml/include -Iggml/src -Iggml/src/ggml-cpu -Iinclude -Isrc -I./common -I./include -I./include/CL -I./otherarch -I./otherarch/tools -I./otherarch/sdcpp -I./otherarch/sdcpp/thirdparty -I./include/vulkan -O3 -fno-finite-math-only -std=c++11 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE +CFLAGS += -I. -Iggml/include -Iggml/src -Iggml/src/ggml-cpu -Iinclude -Isrc -I./include -I./include/CL -I./otherarch -I./otherarch/tools -I./otherarch/sdcpp -I./otherarch/sdcpp/thirdparty -I./include/vulkan -O3 -fno-finite-math-only -std=c11 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -DGGML_USE_CPU +CXXFLAGS += -I. -Iggml/include -Iggml/src -Iggml/src/ggml-cpu -Iinclude -Isrc -I./common -I./include -I./include/CL -I./otherarch -I./otherarch/tools -I./otherarch/sdcpp -I./otherarch/sdcpp/thirdparty -I./include/vulkan -O3 -fno-finite-math-only -std=c++11 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -DGGML_USE_CPU ifndef KCPP_DEBUG CFLAGS += -DNDEBUG -s CXXFLAGS += -DNDEBUG -s diff --git a/gpttype_adapter.cpp b/gpttype_adapter.cpp index d967bdacf..4afbe2dd3 100644 --- a/gpttype_adapter.cpp +++ b/gpttype_adapter.cpp @@ -496,6 +496,37 @@ void ContextRewind(std::vector &embd, std::vector ¤t_context_tok } } +const char * kcpp_print_system_info(void) { + ggml_cpu_init(); // some ARM features are detected at runtime + + static std::string s; + + s = ""; + s += "AVX = " + std::to_string(ggml_cpu_has_avx()) + " | "; + s += "AVX_VNNI = " + std::to_string(ggml_cpu_has_avx_vnni()) + " | "; + s += "AVX2 = " + std::to_string(ggml_cpu_has_avx2()) + " | "; + s += "AVX512 = " + std::to_string(ggml_cpu_has_avx512()) + " | "; + s += "AVX512_VBMI = " + std::to_string(ggml_cpu_has_avx512_vbmi()) + " | "; + s += "AVX512_VNNI = " + std::to_string(ggml_cpu_has_avx512_vnni()) + " | "; + s += "AVX512_BF16 = " + std::to_string(ggml_cpu_has_avx512_bf16()) + " | "; + s += "AMX_INT8 = " + std::to_string(ggml_cpu_has_amx_int8()) + " | "; + s += "FMA = " + std::to_string(ggml_cpu_has_fma()) + " | "; + s += "NEON = " + std::to_string(ggml_cpu_has_neon()) + " | "; + s += "SVE = " + std::to_string(ggml_cpu_has_sve()) + " | "; + s += "ARM_FMA = " + std::to_string(ggml_cpu_has_arm_fma()) + " | "; + s += "F16C = " + std::to_string(ggml_cpu_has_f16c()) + " | "; + s += "FP16_VA = " + std::to_string(ggml_cpu_has_fp16_va()) + " | "; + s += "RISCV_VECT = " + std::to_string(ggml_cpu_has_riscv_v()) + " | "; + s += "WASM_SIMD = " + std::to_string(ggml_cpu_has_wasm_simd()) + " | "; + s += "SSE3 = " + std::to_string(ggml_cpu_has_sse3()) + " | "; + s += "SSSE3 = " + std::to_string(ggml_cpu_has_ssse3()) + " | "; + s += "VSX = " + std::to_string(ggml_cpu_has_vsx()) + " | "; + s += "MATMUL_INT8 = " + std::to_string(ggml_cpu_has_matmul_int8()) + " | "; + s += "LLAMAFILE = " + std::to_string(ggml_cpu_has_llamafile()) + " | "; + + return s.c_str(); +} + // KCPP SAMPLING FUNCTIONS void sample_softmax(llama_token_data_array * cur_p) { GGML_ASSERT(cur_p->size > 0); @@ -1811,7 +1842,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in int cu_parseinfo_maindevice = inputs.cublas_info<=0?0:inputs.cublas_info; - printf("System Info: %s\n", llama_print_system_info()); + printf("System Info: %s\n", kcpp_print_system_info()); #if defined(GGML_USE_CUDA) if(file_format!=FileFormat::GGUF_GENERIC) {