| struct riscv64_features { | |
| bool has_rvv = false; | |
| riscv64_features() { | |
| struct riscv_hwprobe probe; | |
| probe.key = RISCV_HWPROBE_KEY_IMA_EXT_0; | |
| probe.value = 0; | |
| int ret = syscall(__NR_riscv_hwprobe, &probe, 1, 0, NULL, 0); | |
| if (0 == ret) { | |
| has_rvv = !!(probe.value & RISCV_HWPROBE_IMA_V); | |
| } | |
| } | |
| }; | |
| static int ggml_backend_cpu_riscv64_score() { | |
| int score = 1; | |
| riscv64_features rf; | |
| if (!rf.has_rvv) { return 0; } | |
| score += 1 << 1; | |
| return score; | |
| } | |
| GGML_BACKEND_DL_SCORE_IMPL(ggml_backend_cpu_riscv64_score) | |