char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
d38d9f087
char/aliceai-t5-moe
1#include "ggml-backend-impl.h" 2 3#if defined(__s390x__ ) 4#include <sys/auxv.h> 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 15struct s390x_features { 16bool has_vxe2 = false; 17bool has_nnpa = false; 18 19s390x_features () { 20uint32_t hwcap = getauxval (AT_HWCAP ); 21// NOTE: use hwcap2 with DFLT for z17 and later 22// uint32_t hwcap2 = getauxval(AT_HWCAP2); 23 24has_vxe2 = !!(hwcap & HWCAP_VXRS_EXT2 ); 25has_nnpa = !!(hwcap & HWCAP_NNPA ); 26 } 27}; 28 29static int ggml_backend_cpu_s390x_score () { 30int score = 1 ; 31s390x_features sf ; 32 33// IBM z15 / LinuxONE 3 34#ifdef GGML_USE_VXE2 35if (!sf .has_vxe2 ) {return 0 ; } 36score += 1 <<1 ; 37#endif 38 39// IBM z16 / LinuxONE 4 and z17 / LinuxONE 5 40#ifdef GGML_USE_NNPA 41if (!sf .has_nnpa ) {return 0 ; } 42score += 1 <<2 ; 43#endif 44 45return score ; 46} 47 48GGML_BACKEND_DL_SCORE_IMPL (ggml_backend_cpu_s390x_score ) 49 50#endif // __s390x__