LLVM target triple for Graviton2 CPUs

I am using TVM on the AWS ARM machines and am wondering the correct target triple is for them (I have been using -mcpu=cortex-a76 -mattr=+neon). Specifically the Graviton CPUs use the 64-bit ARM Neoverse N1 cores. Thanks!

1 Like

Hmmm it should just follow the LLVM’s convention

-mcpu=neoverse-n1 should be fine depending on the version of llvm . I can’t remember if you need anything in the -mattr to specifically allow for the dot product or fp16 .

@giuseros has probably some experience here

Ramana

Hello @pratikfegade,

This is what I always use (which also enables the dot-product support. If you don’t want it, just remove the +dotprod):

"llvm -device=arm_cpu -mtriple=aarch64-linux-gnu -mattr=+neon,+v8.2a,+dotprod"

A good source for me was this tutorial.

Hope this helps

This is the one we used on EC2 m6g:

llvm -device=arm_cpu -mtriple=aarch64-linux-gnu -mattr=+v8.2a,+fullfp16,+fp-armv8,+dotprod,+crc,+crypto,+neon

3 Likes

Thanks all for the suggestions. I’ll try these.

How do I know add those parameters? for example, gcc -v , I can know triple parameter.

I found that

  • Graviton 2 uses Neoverse N1 cores
  • Graviton 3 uses Neoverse V1 cores

LLVM knows these cores (mcpu)

  • LLVM 10 supports -mcpu=neoverse-n1
  • LLVM 12 supports -mcpu=neoverse-v1

We do not need to enumerate mattr manually, better to use mcpu. The mattr list above is wrong anyway,

I’d use the following target strings:

TARGET_MAP = {
    'c6g'   : 'llvm -device=arm_cpu -mtriple=aarch64-linux-gnu -mcpu=neoverse-n1',
    'c7g'   : 'llvm -device=arm_cpu -mtriple=aarch64-linux-gnu -mcpu=neoverse-v1',
}