From 2d3cdd72fde0f20b94798eb0b0fa1327dbfd5457 Mon Sep 17 00:00:00 2001 From: Martin Chang Date: Sun, 20 Aug 2023 14:26:47 +0800 Subject: [PATCH] only append to cpu string if not initialized (#125) * only append to cpu string if not initialized * Fix code style --------- Co-authored-by: Alex --- rwkv.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/rwkv.cpp b/rwkv.cpp index 5fe0466..8ace275 100644 --- a/rwkv.cpp +++ b/rwkv.cpp @@ -1931,19 +1931,21 @@ bool rwkv_quantize_model_file(const char * in_path, const char * out_path, const const char * rwkv_get_system_info_string(void) { static std::string s; - s = ""; - s += "AVX=" + std::to_string(ggml_cpu_has_avx()) + " "; - s += "AVX2=" + std::to_string(ggml_cpu_has_avx2()) + " "; - s += "AVX512=" + std::to_string(ggml_cpu_has_avx512()) + " "; - s += "FMA=" + std::to_string(ggml_cpu_has_fma()) + " "; - s += "NEON=" + std::to_string(ggml_cpu_has_neon()) + " "; - 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 += "WASM_SIMD=" + std::to_string(ggml_cpu_has_wasm_simd()) + " "; - s += "BLAS=" + std::to_string(ggml_cpu_has_blas()) + " "; - s += "SSE3=" + std::to_string(ggml_cpu_has_sse3()) + " "; - s += "VSX=" + std::to_string(ggml_cpu_has_vsx()); + if (s.empty()) { + s = ""; + s += "AVX=" + std::to_string(ggml_cpu_has_avx()) + " "; + s += "AVX2=" + std::to_string(ggml_cpu_has_avx2()) + " "; + s += "AVX512=" + std::to_string(ggml_cpu_has_avx512()) + " "; + s += "FMA=" + std::to_string(ggml_cpu_has_fma()) + " "; + s += "NEON=" + std::to_string(ggml_cpu_has_neon()) + " "; + 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 += "WASM_SIMD=" + std::to_string(ggml_cpu_has_wasm_simd()) + " "; + s += "BLAS=" + std::to_string(ggml_cpu_has_blas()) + " "; + s += "SSE3=" + std::to_string(ggml_cpu_has_sse3()) + " "; + s += "VSX=" + std::to_string(ggml_cpu_has_vsx()); + } return s.c_str(); }