| // find hwcap bits in asm/elf.h | |
| struct s390x_features { | |
| bool has_vxe2 = false; | |
| bool has_nnpa = false; | |
| s390x_features() { | |
| uint32_t hwcap = getauxval(AT_HWCAP); | |
| // NOTE: use hwcap2 with DFLT for z17 and later | |
| // uint32_t hwcap2 = getauxval(AT_HWCAP2); | |
| has_vxe2 = !!(hwcap & HWCAP_VXRS_EXT2); | |
| has_nnpa = !!(hwcap & HWCAP_NNPA); | |
| } | |
| }; | |
| static int ggml_backend_cpu_s390x_score() { | |
| int score = 1; | |
| s390x_features sf; | |
| // IBM z15 / LinuxONE 3 | |
| if (!sf.has_vxe2) { return 0; } | |
| score += 1 << 1; | |
| // IBM z16 / LinuxONE 4 and z17 / LinuxONE 5 | |
| if (!sf.has_nnpa) { return 0; } | |
| score += 1 << 2; | |
| return score; | |
| } | |
| GGML_BACKEND_DL_SCORE_IMPL(ggml_backend_cpu_s390x_score) | |