This is an archive of the discontinued LLVM Phabricator instance.

[X86] AMD Zen 4 Initial enablement
ClosedPublic

Authored by GGanesh on Nov 30 2022, 9:32 PM.

Details

Summary

This patch has the initial skeleton that enables AMD znver4!

AMD znver4 belongs to Family 19h with model numbers as below
Models 0x10 to 0x1f
Models 0x60 to 0x74
Models 0x78 to 0x7b
Models 0xA0 to 0xAf

The patch

  1. Includes ISAs that already have target descriptions are added.
  2. Uses no scheduler model as of now. (We have an update to this)
  3. Updates few tests as per the initial enablement.
  4. ISAs that are added are

avx512f,
avx512dq,
avx512ifma,
avx512cd,
avx512bw,
avx512vl,
avx512_bf16,
avx512vbmi,
avx512vbmi2,
avx512vl,
avx512_vnni,
avx512_bitalg,
avx512_vpopcntdq/vl

Diff Detail

Event Timeline

GGanesh created this revision.Nov 30 2022, 9:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 30 2022, 9:32 PM
GGanesh requested review of this revision.Nov 30 2022, 9:32 PM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptNov 30 2022, 9:32 PM
Herald added subscribers: llvm-commits, Restricted Project, cfe-commits. · View Herald Transcript
RKSimon added a comment.EditedDec 1 2022, 10:15 AM

Thank you @GGanesh I thought you'd forgotten about LLVM :)

Please add znver4 test coverage to:

llvm/test/CodeGen/X86/cpus-amd.ll
llvm/test/CodeGen/X86/slow-unaligned-mem.ll

llvm/lib/Target/X86/X86.td
1619

This might sound strange - but its probably better to use either the IceLake or SkylakeServer model initially - as they have AVX512 instruction coverage, the znver3 model will assert in llvm-mca etc when it encounters an unsupported instruction (any of the Z sched classes).

Matt added a subscriber: Matt.Dec 7 2022, 6:10 PM
jbhateja removed a subscriber: jbhateja.

@GGanesh reverse-ping

llvm/lib/Target/X86/X86.td
1619

If the use of an Intel model isn't acceptable, using the Proc<> macro (no model) would be the most straightforward - but if you wish to use the znver3 model as a stopgap then I don't want to stop you, just bear in mind that it will cause breaks, particularly where the models are used for codegen analysis etc.

@GGanesh reverse-ping

@RKSimon Thanks a lot! We were trying to get the libpfm patch posted and subsequently enabling the zen4 scheduler model. Probably a week or two from there. The intel model isn't approved for obvious reasons. Yes I will post a stopgap patch!

GGanesh updated this revision to Diff 483092.Dec 15 2022, 1:31 AM

Update to use 'no' processor model.
Fixed the below tests
tools/llvm-mca/X86/cpus.s
tools/llvm-mca/X86/read-after-ld-1.s
tools/llvm-mca/X86/register-file-statistics.s
tools/llvm-mca/X86/scheduler-queue-usage.s

Addressed comments from @RKSimon

RKSimon accepted this revision.Dec 15 2022, 3:08 AM

Thanks @GGanesh - LGTM with one minor - the orphan ZNVER4 checks from the llvm-mca tests need removing

This revision is now accepted and ready to land.Dec 15 2022, 3:08 AM

Thanks @GGanesh - LGTM with one minor - the orphan ZNVER4 checks from the llvm-mca tests need removing

Thank you! I left them intentionally as this is a stop-gap patch. Agreed! Will remove them.

GGanesh updated this revision to Diff 483141.Dec 15 2022, 5:28 AM

Fixed the tests

tools/llvm-mca/X86/cpus.s
tools/llvm-mca/X86/read-after-ld-1.s
tools/llvm-mca/X86/register-file-statistics.s
tools/llvm-mca/X86/scheduler-queue-usage.s

GGanesh edited the summary of this revision. (Show Details)Dec 15 2022, 5:29 AM
RKSimon accepted this revision.Dec 15 2022, 5:41 AM

cheers

This revision was landed with ongoing or failed builds.Dec 17 2022, 3:04 AM
This revision was automatically updated to reflect the committed changes.