Download ggml/src/ggml-cpu/arch/arm/cpu-feats.cpp from Brunobkr/llama.cpp_AlgMor24_github: direct link, hf CLI and curl.
- Browser
- Download file 2.85 kB
-
https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github/resolve/main/ggml/src/ggml-cpu/arch/arm/cpu-feats.cpp
- Command line
-
hf download hf://datasets/Brunobkr/llama.cpp_AlgMor24_github/ggml/src/ggml-cpu/arch/arm/cpu-feats.cpp
-
curl -L -o cpu-feats.cpp https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github/resolve/main/ggml/src/ggml-cpu/arch/arm/cpu-feats.cpp
2.85 kB
| struct aarch64_features { | |
| // has_neon not needed, aarch64 has NEON guaranteed | |
| bool has_dotprod = false; | |
| bool has_fp16 = false; | |
| bool has_sve = false; | |
| bool has_sve2 = false; | |
| bool has_i8mm = false; | |
| bool has_sme = false; | |
| bool has_sme2 = false; | |
| aarch64_features() { | |
| uint32_t hwcap = getauxval(AT_HWCAP); | |
| uint32_t hwcap2 = getauxval(AT_HWCAP2); | |
| has_dotprod = !!(hwcap & HWCAP_ASIMDDP); | |
| has_fp16 = !!(hwcap & HWCAP_FPHP) && !!(hwcap & HWCAP_ASIMDHP); | |
| has_sve = !!(hwcap & HWCAP_SVE); | |
| has_sve2 = !!(hwcap2 & HWCAP2_SVE2); | |
| has_i8mm = !!(hwcap2 & HWCAP2_I8MM); | |
| has_sme = !!(hwcap2 & HWCAP2_SME); | |
| int oldp = 0; | |
| size_t size = sizeof(oldp); | |
| if (sysctlbyname("hw.optional.arm.FEAT_DotProd", &oldp, &size, NULL, 0) == 0) { | |
| has_dotprod = static_cast<bool>(oldp); | |
| } | |
| if (sysctlbyname("hw.optional.arm.FEAT_I8MM", &oldp, &size, NULL, 0) == 0) { | |
| has_i8mm = static_cast<bool>(oldp); | |
| } | |
| if (sysctlbyname("hw.optional.arm.FEAT_SME", &oldp, &size, NULL, 0) == 0) { | |
| has_sme = static_cast<bool>(oldp); | |
| } | |
| if (sysctlbyname("hw.optional.arm.FEAT_SME2", &oldp, &size, NULL, 0) == 0) { | |
| has_sme2 = static_cast<bool>(oldp); | |
| } | |
| // Apple apparently does not implement SVE yet | |
| } | |
| }; | |
| static int ggml_backend_cpu_aarch64_score() { | |
| int score = 1; | |
| aarch64_features af; | |
| if (!af.has_dotprod) { return 0; } | |
| score += 1<<1; | |
| if (!af.has_fp16) { return 0; } | |
| score += 1<<2; | |
| if (!af.has_sve) { return 0; } | |
| score += 1<<3; | |
| if (!af.has_i8mm) { return 0; } | |
| score += 1<<4; | |
| if (!af.has_sve2) { return 0; } | |
| score += 1<<5; | |
| if (!af.has_sme) { return 0; } | |
| score += 1<<6; | |
| return score; | |
| } | |
| GGML_BACKEND_DL_SCORE_IMPL(ggml_backend_cpu_aarch64_score) | |