Skip to content

Commit

Permalink
only append to cpu string if not initialized (#125)
Browse files Browse the repository at this point in the history
* only append to cpu string if not initialized

* Fix code style

---------

Co-authored-by: Alex <saharNooby@users.noreply.github.com>
  • Loading branch information
marty1885 and saharNooby committed Aug 20, 2023
1 parent 84f34c5 commit 2d3cdd7
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions rwkv.cpp
Expand Up @@ -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();
}

0 comments on commit 2d3cdd7

Please sign in to comment.