archspec / archspec-json

Other
20 stars 33 forks source link

Remove `pmull` feature from A64FX #59

Closed giordano closed 1 year ago

giordano commented 1 year ago

With this change in Spack I finally get on Ookami

$ spack arch
linux-rocky8-a64fx

This was missed in #44. Should fix #23. Again.

alalazo commented 1 year ago

Can you add a sample of that system /proc/cpuinfo for the tests?

giordano commented 1 year ago

I added the test. I get exactly the same on both Isambard 2 and Ookami, which are both HPE Apollo 80, maybe that's the difference as suggested by @christopheredsall in https://github.com/archspec/archspec-json/issues/23#issuecomment-803377603.

giordano commented 1 year ago

For reference, on Fugaku I get

diff --git a/tests/targets/linux-rocky8-a64fx b/tests/targets/linux-rocky8-a64fx
index 2484dbe..2c383c7 100644
--- a/tests/targets/linux-rocky8-a64fx
+++ b/tests/targets/linux-rocky8-a64fx
@@ -1,6 +1,6 @@
 processor       : 0
 BogoMIPS        : 200.00
-Features        : fp asimd evtstrm sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm fcma dcpop sve
+Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm fcma dcpop sve
 CPU implementer : 0x46
 CPU architecture: 8
 CPU variant     : 0x1

so the difference is really aes+pmull. Quite worryingly, they show the same midr, which makes it impossible to distinguish the two CPUs in a proper way without looking at the individual features.

giordano commented 1 year ago

Actually, with this change in Spack on Isambard

$ git diff
diff --git a/lib/spack/external/archspec/json/cpu/microarchitectures.json b/lib/spack/external/archspec/json/cpu/microarchitectures.json
index 15d32e9fa0..493f4d2278 100644
--- a/lib/spack/external/archspec/json/cpu/microarchitectures.json
+++ b/lib/spack/external/archspec/json/cpu/microarchitectures.json
@@ -2302,7 +2302,6 @@
         "fp",
         "asimd",
         "evtstrm",
-        "pmull",
         "sha1",
         "sha2",
         "crc32",

I still get

$ spack arch
cray-rhel8-aarch64

So this change seems to do the trick only on Ookami, but not Isambard, but now I'm running out of ideas :disappointed:

alalazo commented 1 year ago

If you can add (or post in a comment) a /proc/cpuinfo for Isambard too, we can have a look at that too.

giordano commented 1 year ago

It's identical to Ookami :slightly_smiling_face:

giordano commented 1 year ago

We found offline that

$ spack python -c "import archspec.cpu;str(archspec.cpu.host())"
'a64fx'

so the problem might be in Spack how it detects the microarchitecture for Cray system, but archspec should be doing its job correctly :partying_face:

alalazo commented 1 year ago

@fspiga Another case where clang activates more features than gcc:

root@af353b147339:/# gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@af353b147339:/# gcc -dM -E - -mcpu=a64fx < /dev/null | grep __ARM_FEATURE_ | sort
#define __ARM_FEATURE_ATOMICS 1
#define __ARM_FEATURE_CLZ 1
#define __ARM_FEATURE_CRC32 1
#define __ARM_FEATURE_FMA 1
#define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
#define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
#define __ARM_FEATURE_IDIV 1
#define __ARM_FEATURE_NUMERIC_MAXMIN 1
#define __ARM_FEATURE_QRDMX 1
#define __ARM_FEATURE_SVE 1
#define __ARM_FEATURE_SVE_BITS 0
#define __ARM_FEATURE_SVE_VECTOR_OPERATORS 1
#define __ARM_FEATURE_UNALIGNED 1

root@af353b147339:/# clang --version
Ubuntu clang version 14.0.0-1ubuntu1
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
root@af353b147339:/# clang -dM -E - -mcpu=a64fx < /dev/null | grep __ARM_FEATURE_ | sort             
#define __ARM_FEATURE_AES 1
#define __ARM_FEATURE_ATOMICS 1
#define __ARM_FEATURE_CLZ 1
#define __ARM_FEATURE_CRC32 1
#define __ARM_FEATURE_CRYPTO 1
#define __ARM_FEATURE_DIRECTED_ROUNDING 1
#define __ARM_FEATURE_DIV 1
#define __ARM_FEATURE_FMA 1
#define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
#define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
#define __ARM_FEATURE_IDIV 1
#define __ARM_FEATURE_LDREX 0xF
#define __ARM_FEATURE_NUMERIC_MAXMIN 1
#define __ARM_FEATURE_QRDMX 1
#define __ARM_FEATURE_SHA2 1
#define __ARM_FEATURE_SVE 1
#define __ARM_FEATURE_UNALIGNED 1