From 562fd4d1886f04d21911c1e3305cfac1cb9f4d67 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 10 Jan 2025 13:24:57 +0100 Subject: [PATCH] fix logic for determining field to use to determine CPU flags --- init/arch_specs/eessi_arch_arm.spec | 2 ++ init/eessi_archdetect.sh | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/init/arch_specs/eessi_arch_arm.spec b/init/arch_specs/eessi_arch_arm.spec index 595dddb800..c0d74bd4ad 100755 --- a/init/arch_specs/eessi_arch_arm.spec +++ b/init/arch_specs/eessi_arch_arm.spec @@ -1,4 +1,6 @@ # ARM CPU architecture specifications (see https://gpages.juszkiewicz.com.pl/arm-socs-table/arm-socs.html for guidance) +# CPU implementers: 0x41 (ARM), 0x46 (Fujitsu) - also see https://github.com/hrw/arm-socs-table/blob/main/data/socs.yml + # Software path in EESSI | 'Vendor ID' or 'CPU implementer' | List of defining CPU features "aarch64/a64fx" "0x46" "asimdhp sve" # Fujitsu A64FX "aarch64/neoverse_n1" "ARM" "asimddp" # Ampere Altra diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index cca3764ee8..4fd979cea5 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -118,11 +118,20 @@ cpupath(){ log "DEBUG" "cpupath: CPU vendor of host system: '$cpu_vendor'" # Identify the host CPU flags or features - local cpu_flag_tag='flags' # cpuinfo systems print different line identifiers, eg features, instead of flags - [ "${cpu_vendor}" == "ARM" ] && cpu_flag_tag='flags' - [ "${machine_type}" == "aarch64" ] && [ "${cpu_flag_tag}" == "flags" ] && cpu_flag_tag='features' - [ "${machine_type}" == "ppc64le" ] && cpu_flag_tag='cpu' + local cpu_flag_tag; + if [ "${cpu_vendor}" == "ARM" ]; then + # if CPU vendor field is ARM, then we should be able to determine CPU microarchitecture based on 'flags' field + cpu_flag_tag='flags' + # if 64-bit Arm CPU without "ARM" as vendor ID, we need to take into account 'features' field + elif [ "${machine_type}" == "aarch64" ]; then + cpu_flag_tag='features' + # on 64-bit POWER, we need to look at 'cpu' field + elif [ "${machine_type}" == "ppc64le" ]; then + cpu_flag_tag='cpu' + else + cpu_flag_tag='flags' + fi local cpu_flags=$(get_cpuinfo "$cpu_flag_tag") log "DEBUG" "cpupath: CPU flags of host system: '$cpu_flags'"