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/s390/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 / s390 / cpu-feats.cpp` 50 lines ยท 1017 bytes Raw Blame History 1 #include "ggml-backend-impl.h" 2 3 #if defined(__s390x__) 4 #include 5 6 // find hwcap bits in asm/elf.h 7 #ifndef HWCAP_VXRS_EXT2 8 #define HWCAP_VXRS_EXT2 (1 << 15) 9 #endif 10 11 #ifndef HWCAP_NNPA 12 #define HWCAP_NNPA (1 << 20) 13 #endif 14 15 struct s390x_features { 16 bool has_vxe2 = false; 17 bool has_nnpa = false; 18 19 s390x_features() { 20 uint32_t hwcap = getauxval(AT_HWCAP); 21 // NOTE: use hwcap2 with DFLT for z17 and later 22 // uint32_t hwcap2 = getauxval(AT_HWCAP2); 23 24 has_vxe2 = !!(hwcap & HWCAP_VXRS_EXT2); 25 has_nnpa = !!(hwcap & HWCAP_NNPA); 26 } 27 }; 28 29 static int ggml_backend_cpu_s390x_score() { 30 int score = 1; 31 s390x_features sf; 32 33 // IBM z15 / LinuxONE 3 34 #ifdef GGML_USE_VXE2 35 if (!sf.has_vxe2) { return 0; } 36 score += 1 << 1; 37 #endif 38 39 // IBM z16 / LinuxONE 4 and z17 / LinuxONE 5 40 #ifdef GGML_USE_NNPA 41 if (!sf.has_nnpa) { return 0; } 42 score += 1 << 2; 43 #endif 44 45 return score; 46 } 47 48 GGML_BACKEND_DL_SCORE_IMPL(ggml_backend_cpu_s390x_score) 49 50 #endif // __s390x__