From cb1672be6a54cc8ebcc76f38ebb8b18e72a368ec Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 13 Jun 2024 20:59:15 +0200 Subject: [PATCH 1/6] add support for detecting A64FX to archdetect --- .github/workflows/tests_archdetect.yml | 1 + init/arch_specs/eessi_arch_arm.spec | 1 + tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.cpuinfo | 8 ++++++++ tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.output | 1 + 4 files changed, 11 insertions(+) create mode 100644 tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.cpuinfo create mode 100644 tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.output diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index bee348995d..f057251050 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -15,6 +15,7 @@ jobs: - x86_64/amd/zen3/Azure-CentOS7-7V73X - x86_64/amd/zen4/Azure-Alma8-9V33X - x86_64/amd/zen4/Shinx-RHEL8-9654 + - aarch64/a64fx/Deucalion-Rocky85 - aarch64/neoverse_n1/Azure-Ubuntu20-Altra - aarch64/neoverse_n1/AWS-awslinux-graviton2 - aarch64/neoverse_v1/AWS-awslinux-graviton3 diff --git a/init/arch_specs/eessi_arch_arm.spec b/init/arch_specs/eessi_arch_arm.spec index 8c1bc34d20..476d3d6119 100755 --- a/init/arch_specs/eessi_arch_arm.spec +++ b/init/arch_specs/eessi_arch_arm.spec @@ -1,5 +1,6 @@ # ARM CPU architecture specifications (see https://gpages.juszkiewicz.com.pl/arm-socs-table/arm-socs.html for guidance) # Software path in EESSI | Vendor ID | List of defining CPU features +"aarch64/a64fx" "" "asimdhp sve" # Fujitsu A64FX "aarch64/neoverse_n1" "ARM" "asimddp" # Ampere Altra "aarch64/neoverse_n1" "" "asimddp" # AWS Graviton2 "aarch64/neoverse_v1" "ARM" "asimddp svei8mm" diff --git a/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.cpuinfo b/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.cpuinfo new file mode 100644 index 0000000000..2484dbe3e7 --- /dev/null +++ b/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.cpuinfo @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 200.00 +Features : fp asimd evtstrm sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm fcma dcpop sve +CPU implementer : 0x46 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0x001 +CPU revision : 0 diff --git a/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.output b/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.output new file mode 100644 index 0000000000..13b6c575c1 --- /dev/null +++ b/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.output @@ -0,0 +1 @@ +aarch64/a64fx From 5bad2d9b5b6d11e481f0c5f36f4c1ad00ba483cf Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 10 Jan 2025 11:00:26 +0100 Subject: [PATCH 2/6] use 0x46 as 'CPU implementer' field for A64FX --- init/arch_specs/eessi_arch_arm.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/arch_specs/eessi_arch_arm.spec b/init/arch_specs/eessi_arch_arm.spec index 476d3d6119..7f7dc7330b 100755 --- a/init/arch_specs/eessi_arch_arm.spec +++ b/init/arch_specs/eessi_arch_arm.spec @@ -1,6 +1,6 @@ # ARM CPU architecture specifications (see https://gpages.juszkiewicz.com.pl/arm-socs-table/arm-socs.html for guidance) -# Software path in EESSI | Vendor ID | List of defining CPU features -"aarch64/a64fx" "" "asimdhp sve" # Fujitsu A64FX +# 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 "aarch64/neoverse_n1" "" "asimddp" # AWS Graviton2 "aarch64/neoverse_v1" "ARM" "asimddp svei8mm" From e53ac16396afe46154e20a2a72819cbdff948d4b Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 10 Jan 2025 11:01:54 +0100 Subject: [PATCH 3/6] fall back to 'CPU implementer' field from /proc/cpuinfo if 'Vendor ID' field is not available --- init/eessi_archdetect.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 2b1534ce62..cca3764ee8 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -111,15 +111,17 @@ cpupath(){ update_arch_specs "$base_dir/arch_specs/${spec_file}" # Identify the host CPU vendor - local cpu_vendor_tag="vendor[ _]id" - local cpu_vendor=$(get_cpuinfo "$cpu_vendor_tag") + local cpu_vendor=$(get_cpuinfo "vendor[ _]id") + if [ "${cpu_vendor}" == "" ]; then + cpu_vendor=$(get_cpuinfo "cpu[ _]implementer") + fi 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_vendor}x" == "x" ] && cpu_flag_tag='features' + [ "${machine_type}" == "aarch64" ] && [ "${cpu_flag_tag}" == "flags" ] && cpu_flag_tag='features' [ "${machine_type}" == "ppc64le" ] && cpu_flag_tag='cpu' local cpu_flags=$(get_cpuinfo "$cpu_flag_tag") From f1124066502152b71f48b672d3a446593b608ec2 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 10 Jan 2025 11:34:27 +0100 Subject: [PATCH 4/6] add Deucalion-Rocky85.all.output for archdetect tests --- tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.all.output | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.all.output diff --git a/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.all.output b/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.all.output new file mode 100644 index 0000000000..f6f97c2aaa --- /dev/null +++ b/tests/archdetect/aarch64/a64fx/Deucalion-Rocky85.all.output @@ -0,0 +1 @@ +aarch64/a64fx:aarch64/generic From d82a188865503fb177e1555d0ddb208c5c39aa18 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 10 Jan 2025 13:08:23 +0100 Subject: [PATCH 5/6] set correct 'CPU implementer' for graviton2/graviton3 --- init/arch_specs/eessi_arch_arm.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/arch_specs/eessi_arch_arm.spec b/init/arch_specs/eessi_arch_arm.spec index 7f7dc7330b..595dddb800 100755 --- a/init/arch_specs/eessi_arch_arm.spec +++ b/init/arch_specs/eessi_arch_arm.spec @@ -2,6 +2,6 @@ # 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 -"aarch64/neoverse_n1" "" "asimddp" # AWS Graviton2 +"aarch64/neoverse_n1" "0x41" "asimddp" # AWS Graviton2 "aarch64/neoverse_v1" "ARM" "asimddp svei8mm" -"aarch64/neoverse_v1" "" "asimddp svei8mm" # AWS Graviton3 +"aarch64/neoverse_v1" "0x41" "asimddp svei8mm" # AWS Graviton3 From 562fd4d1886f04d21911c1e3305cfac1cb9f4d67 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 10 Jan 2025 13:24:57 +0100 Subject: [PATCH 6/6] 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'"