Repository navigation
Description
Summary
I am working on NVIDIA Arm HPC Developer Kit (https://developer.nvidia.com/arm-hpc-devkit) which is equipped with Ampere Computing 'Altra' CPU.
When running spack (any recent released tags and giot head), the CPU is recornised as graviton2 despite it is not. This is what I get on an internal deployment:
[filippos@amp001 ~]$ spack arch -f
linux-rocky8-graviton2
[filippos@amp001 ~]$ spack arch -b
linux-rocky8-graviton2
Spack version: 0.17.1-1338-fddc58387c
Rationale
graviton2 is not the only Arm-based CPU supporting Arm Neoverse N1 core IP. See https://www.anandtech.com/show/15578/cloud-clash-amazon-graviton2-arm-against-intel-and-amd and https://www.anandtech.com/show/15575/amperes-altra-80-core-n1-soc-for-hyperscalers-against-rome-and-xeon
Since two Arm-based CPUs are based on the same Arm Core IP, it is very hard to distinguish them based on what linux reports. Spack does nothing wrong here, it looks at "Features" listed in /proc/cpuinfo. However the list of supported CPU uarch features support by AWS Graviton2 and Ampere Compouting Altra are the same
Graviton2:
$ cat /proc/cpuinfo | grep "Features"
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
Ampere Computing Altra:
$ cat /proc/cpuinfo | grep "Features"
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
Description
Rename target graviton2 to neoverse-n1.
Additional information
In practice, nothing breaks at the moment. However it can be confusing for a non-experienced user to see spack recornising "graviton2" as target when running on system with Ampere Computing Altra CPU.
General information
- I have run
spack --versionand reported the version of Spack - I have searched the issues of this repo and believe this is not a duplicate
Activity
fspiga commentedon Mar 28, 2022
cc @alalazo for visibility
fspiga commentedon Mar 28, 2022
In this repo, the
linux-amazon-gravitonandlinux-amazon-graviton2use names of products (graviton) while the equivalent in x86 use names of architectures (haswell, sandybridge, cascadelake)If we were to use the name of Arm Core IP architectures, names should looks like
linux-amazon-graviton->linux-cortex-A72(https://en.wikichip.org/wiki/annapurna_labs/alpine/al73400)linux-amazon-graviton2->linux-neoverse-N1(also compatible with Ampere Computing Altra CPU)linux-amazon-graviton3->linux-neoverse-??(no official announcement made by AWS AFAIK but ... https://www.nextplatform.com/2022/01/04/inside-amazons-graviton3-arm-server-processor/)Special case is A64FX since it is a custom uarch from Fujitsu. But I do not see a target files for that.
alalazo commentedon May 16, 2022
I have been revisiting this issue, to cut a release at the end of the week and port it to Spack. I think our current labeling is ok since:
graviton2seems to expose the same feature asampere altra, according to the exceprts of/proc/cpuinfoyou posted (so no way to distinguish the two)neoverse-n1doesn't havecryptoextensions by defaultWe might want to add a "label alias" later, to say that
graviton2andampere altrashare the same features and flags.For reference, here's what I obtain with GCC 9.4.0 using our current optimization line for
graviton2and usingneoverse-n1fspiga commentedon Jun 2, 2022
Question: since
cryptodoes not seem to be captured by/proc/cpuinfo, how can you differentiate one CPU from the other?giordano commentedon Jun 2, 2022
Crypto isn't really a separate feature, it's an alias for aes + sha2
boegel commentedon Sep 9, 2022
Similar problem on the Azure Arm instances powered by Ampere Altra which went GA on 1 Sept 2022:
An interesting difference here is that here
archspecreportsgraviton(rather thangraviton2).It seems like that's due to
sbssnot being listed in theFeatureslist in/proc/cpuinfo?I think @fspiga's argument for microarchitectures vs product names is compelling.
It's also why we use
zen2andzen3rather thanromeandmilan(despite the latter being perhaps more intuitive).There are also advantages between discriminating AWS Graviton and Ampere Altra though: although a binary compiled on one may run fine on the other, compiler optimizations being used may be different (depending on the exact compiler flags being used), which could impact performance.
That may be beyond the scope of archspec though, unless we add support for another mode (ISA vs uarch?)
alalazo commentedon Oct 6, 2022
Can somebody post a cat of
/proc/cpuinfo? We can't distinguish the two by features, but we might be able to distinguish them using other fieldsboegel commentedon Oct 6, 2022
AWS Graviton2, Amazon Linux:
Ampere Altra (Azure), Ubuntu:
alalazo commentedon Oct 6, 2022
@boegel Can you post
/proc/cpuinfofor Ampere Altra? If I am not wrong that seems the output oflscpu, right?boegel commentedon Oct 6, 2022
I took the Ampere Altra bit from https://github.com/EESSI/software-layer/pull/187/files#diff-d35bee727b3c563d7a3faf81cbe1ce6fda4d1167ef18e3b6d0f4d9c622e9e413, so maybe @hmeiland can clarify whether this is indeed
/proc/cpuinfoorlscpu?fspiga commentedon Oct 6, 2022
fspiga commentedon Oct 6, 2022
Adding on the list above. It is now public that AWS Graviton3 is Arm Neoverse V1 (armv8). Same core IP will be SiPearl Rhea. NVIDIA Grace is Arm Neoverse V2 (armv9).
tgamblin commentedon Oct 6, 2022
Are there additional instructions going from
armv8toneoverse-v1or fromarmv9toneoverse-v2? And is it justarmv8or one of the minor version bumps?tgamblin commentedon Oct 6, 2022
@alalazo: my recommendation here, unless we can find a way to meaningfully differentiate between
neoverse-n1andgraviton2, is to do the rename. We do not want this to be partial to any one cloud/vendor/etc, and we definitely do not want to deter Azure people from using the library.For backward compatibility in Spack we have two options, I think:
graviton2as a node or an alias that just doesn't get detected, but that is recognized as compatible withneoverse-n1I think the only current (major?) consumer of the
graviton*targets is Spack and the various builds we have in AWS right now. I think we can pretty easily rebuild those asneoverse-n1binaries and just replace the whole cache, and we can also implement something like (1) or (2) so that peoples' workflows (e.g. preferences inspack.yaml) continue to work. I think forspack.yamlto continue to work we'll need to do (1).I also don't see why we can't move upstream on while we work these things out in Spack -- I think it would be good to do.
alalazo commentedon Oct 6, 2022
Renaming is doable. The issue here is if we should go with
-mcpu=neoverse-n1or the other optimization line we have:which adds also
sha2andaes. Basically, bothgraviton2andaltraareneoverse-n1 +aes +sha2.tgamblin commentedon Oct 6, 2022
@OliverPerks @stephenmsachs any advice on the flag recommendation here?
alalazo commentedon Oct 6, 2022
Further data point, I am in a
ubuntu:latestcontainer and trying systemclangandgcc. It seemsclangaddsaesandsha2by default toneoverse-n1, whilegccdoes not:and
willlovett-arm commentedon Oct 17, 2022
Hi all. @fspiga pointed me to this thread. I manage the compiler & library technical roadmaps here at Arm.
There's a long backstory here - crypto features such as AES and SHA2 aren't universally available, largely due to export constraints.
This has led to an unfortunate wrinkle that you've just fallen upon, where they're enabled by default in clang, and not in gcc.
gcc's behaviour is more correct, but it's non-trivial to change this in clang for v8 cores, as it creates a backwards compatibility headache.
For all future v9 cores (eg Neoverse N2, V2, Cortex-X2), clang should not enable this by default
*The easiest way of ensuring that clang and gcc do the same thing here is with one of the following:
-mcpu=neoverse-n1+nocrypto-mcpu=neoverse-n1+cryptohth,
Will Lovett
*I say 'should' here - I've just discovered a bug in Neoverse N2, whereby it enables them. I'm going to ask the team to fix.