char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
f698a79c6
char/aliceai-t5-moe
1#include "ggml-backend-impl.h" 2 3#if defined(__riscv )&& __riscv_xlen == 64 4#include <asm/hwprobe.h> 5#include <asm/unistd.h> 6#include <unistd.h> 7 8struct riscv64_features { 9bool has_rvv = false; 10 11riscv64_features () { 12struct riscv_hwprobe probe ; 13probe .key = RISCV_HWPROBE_KEY_IMA_EXT_0 ; 14probe .value = 0 ; 15 16int ret = syscall (__NR_riscv_hwprobe ,& probe ,1 ,0 ,NULL ,0 ); 17 18if (0 == ret ) { 19has_rvv = !!(probe .value & RISCV_HWPROBE_IMA_V ); 20 } 21 } 22}; 23 24static int ggml_backend_cpu_riscv64_score () { 25int score = 1 ; 26riscv64_features rf ; 27 28#ifdef GGML_USE_RVV 29if (!rf .has_rvv ) {return 0 ; } 30score += 1 <<1 ; 31#endif 32 33return score ; 34} 35 36GGML_BACKEND_DL_SCORE_IMPL (ggml_backend_cpu_riscv64_score ) 37 38#endif // __riscv && __riscv_xlen == 64