Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/src/ggml-cpu/arch/riscv/cpu-feats.cpp # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / src / ggml-cpu / arch / riscv / cpu-feats.cpp` 38 lines ยท 807 bytes Raw Blame History 1 #include "ggml-backend-impl.h" 2 3 #if defined(__riscv) && __riscv_xlen == 64 4 #include 5 #include 6 #include 7 8 struct riscv64_features { 9 bool has_rvv = false; 10 11 riscv64_features() { 12 struct riscv_hwprobe probe; 13 probe.key = RISCV_HWPROBE_KEY_IMA_EXT_0; 14 probe.value = 0; 15 16 int ret = syscall(__NR_riscv_hwprobe, &probe, 1, 0, NULL, 0); 17 18 if (0 == ret) { 19 has_rvv = !!(probe.value & RISCV_HWPROBE_IMA_V); 20 } 21 } 22 }; 23 24 static int ggml_backend_cpu_riscv64_score() { 25 int score = 1; 26 riscv64_features rf; 27 28 #ifdef GGML_USE_RVV 29 if (!rf.has_rvv) { return 0; } 30 score += 1 << 1; 31 #endif 32 33 return score; 34 } 35 36 GGML_BACKEND_DL_SCORE_IMPL(ggml_backend_cpu_riscv64_score) 37 38 #endif // __riscv && __riscv_xlen == 64