This is an archive of the discontinued LLVM Phabricator instance.

[X86] Support -march=gracemont
ClosedPublic

Authored by FreddyYe on Aug 15 2023, 7:31 PM.

Details

Summary

gracemont has some different tuning features from alderlake.

Diff Detail

Event Timeline

FreddyYe created this revision.Aug 15 2023, 7:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2023, 7:31 PM
FreddyYe requested review of this revision.Aug 15 2023, 7:31 PM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptAug 15 2023, 7:31 PM
Herald added subscribers: llvm-commits, Restricted Project, cfe-commits. · View Herald Transcript
Matt added a subscriber: Matt.Aug 16 2023, 1:15 PM
RKSimon added inline comments.Aug 17 2023, 1:41 AM
clang/lib/Basic/Targets/X86.cpp
551

Why not handle this above (below tremont) as the next in the *mont series?

FreddyYe marked an inline comment as done.Aug 17 2023, 7:27 AM
FreddyYe added inline comments.
clang/lib/Basic/Targets/X86.cpp
551

Good catch. This isn't a short story... In short words, it was to save codes in predefined-arch-macros.c.
If set gracemont as a series of atom processors, macros like corei7(predefined-arch-macros.c:2061-2062) won't be generated by -march=gracemont, and for history reasons, atom series processors defined some extra macros of their names, like "tremont", "goldmont", ... but these macros are not used any longer IIRC. So I decided to define gracemont as a non-atom series one.

RKSimon added inline comments.Aug 17 2023, 8:28 AM
clang/lib/Basic/Targets/X86.cpp
551

Hmm - how about we move it after Tremont and then add a comment explaining that going forward atom/e-cores will share p-core defines?

case CK_Tremont:
    defineCPUMacros(Builder, "tremont");
    break;
case CK_Gracemont:
  // Gracemont and later atom-cores use p-core cpu macros.
  [[fallthrough]];
case CK_Nehalem:
 ...
FreddyYe updated this revision to Diff 551350.Aug 17 2023, 7:10 PM
FreddyYe marked 2 inline comments as done.

Address comment.

clang/lib/Basic/Targets/X86.cpp
551

Looks good! I refined a little bit and updated.

RKSimon accepted this revision.Aug 18 2023, 1:37 AM

LGTM - cheers

This revision is now accepted and ready to land.Aug 18 2023, 1:37 AM
This revision was landed with ongoing or failed builds.Aug 20 2023, 6:41 PM
This revision was automatically updated to reflect the committed changes.