Page MenuHomePhabricator

Added SKL and CNL processors and features to Clang
ClosedPublic

Authored by delena on Jan 31 2016, 7:22 AM.

Details

Summary

Added Skylake Client and Cannonlake Client processors and features to Clang.
Revised features list for Skylake Server and KNL.
The backend already supports these features.

Diff Detail

Event Timeline

delena updated this revision to Diff 46490.Jan 31 2016, 7:22 AM
delena retitled this revision from to Added SKL and CNL processors and features to Clang.
delena updated this object.
delena added reviewers: igorb, DavidKreitzer.
delena set the repository for this revision to rL LLVM.
delena added a subscriber: llvm-commits.
DavidKreitzer added inline comments.
lib/Basic/Targets.cpp
2353–2356

Are the new names "skl" and "cnl" consistent with what gcc is planning/doing? I suspect that cannonlake might be spelled out, and I'm not at all sure about "skl".

I'd rather we not have to change this later, be burdened with more "Legacy name"s, and have to do additional cleanups like this one:


r223776 | chandlerc | 2014-12-09 06:50:25 -0800 (Tue, 09 Dec 2014) | 20 lines

Re-work the Clang system for classifying Intel x86 CPUs to use their
basic microarchitecture names, and add support (with tests) for parsing
all of the masic microarchitecture names for CPUs documented to be
accepted by GCC with -march. I didn't go back through the 32-bit-only
old microarchitectures, but this at least brings the recent architecture
names up to speed. This is essentially the follow-up to the LLVM commit
r223769 which did similar cleanups for the LLVM CPUs.

One particular benefit is that you can now use -march=westmere in Clang
and get the LLVM westmere processor which is a different ISA variant (!)
and so quite significant.

Much like with r223769, I would appreciate the Intel folks carefully
thinking about the macros defined, names used, etc for the atom chips
and newest primary x86 chips. The current patterns seem quite strange to
me, especially here in Clang.

Note that I haven't replicated the per-microarchitecture macro defines
provided by GCC. I'm really opposed to source code using these rather
than using ISA feature macros.

2711

Is this right? Does KNL support RTM?

3253

These additions are in direct conflict with the FIXME and the spirit of r223776. At the very least, there needs to be some discussion before adding them. And like the -march settings, we should make sure we are consistent with what gcc is doing.

I agree with @chandlerc that programmers ought to be using the ISA macros, at least when the intent is to check for the existence of a feature. But I can see the utility of the tuning macros, e.g. _tune_slm_. Going forward, we might choose to add just those, i.e. _tune_cannonlake_ and not _cannonlake_.

3402

Does gcc and/or icc define these same macros? Or at the very least, is there agreement on the the names so that we don't end up with inconsistencies? For example, I don't see any evidence that the MOVBE macro is in use even though the movbe feature has been around for a while.

delena added a subscriber: spatel.Feb 4 2016, 1:24 AM
delena updated this revision to Diff 46891.Feb 4 2016, 3:57 AM

Changed cnl to cannonlake,
skx to skylake-avx512, skx remains as legacy, - Skylake Server
skylake means Skylake Client

sanjoy added a subscriber: sanjoy.
sanjoy added inline comments.
lib/Basic/Targets.cpp
3258

Should these also be "skylake" and "cannonlake"?

DavidKreitzer added inline comments.Feb 13 2016, 2:00 AM
lib/Basic/Targets.cpp
3258

Assuming that we keep them at all, they probably should be renamed. We are trying to get agreement from gcc on the exact spelling of all these pre-defined macros to avoid future headaches.

Elena, has there been any progress on that? I think that's the only thing holding up this patch.

delena updated this revision to Diff 48048.Feb 16 2016, 1:09 AM
delena removed rL LLVM as the repository for this revision.

I removed predefined macros from cannonlake and skylake client.

DavidKreitzer edited edge metadata.Feb 16 2016, 8:31 PM

I would avoid adding any new pre-defined macros until we get agreement from gcc and/or icc on the exact spellings. For all the new feature-based macros that you are adding, e.g. MPX, MOVBE, etc., do we have consensus on the spellings?

Also, why did you remove the tests for -march=skylake and -march=cannonlake from predefined-arch-macros.c? I think you want to keep those.

delena updated this revision to Diff 48282.Feb 18 2016, 12:28 AM
delena edited edge metadata.

Removed all new predefined macros. Reverted macros check for skylake, skylake-512, cannonlake.

Thanks, Elena. This all looks good to me now.

This revision was automatically updated to reflect the committed changes.