Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recognition of modern Intel processors to port library and compiler #7350

Merged
merged 2 commits into from
May 30, 2024

Conversation

0xdaryl
Copy link
Contributor

@0xdaryl 0xdaryl commented May 28, 2024

  • Improve readability of X86 CPU model and processor macros
  • Add recognition of modern Intel processors to port library and compiler

Add underscores for improved readability.

Signed-off-by: Daryl Maier <maier@ca.ibm.com>
@0xdaryl
Copy link
Contributor Author

0xdaryl commented May 28, 2024

@BradleyWood : please review

@vijaysun-omr : FYI

@vijaysun-omr vijaysun-omr self-assigned this May 28, 2024
TR_ASSERT_FATAL(comp->compileRelocatableCode() || comp->isOutOfProcessCompilation() || comp->compilePortableCode() || comp->target().cpu.is(OMR_PROCESSOR_X86_AMDOPTERON) == cg()->getX86ProcessorInfo().isAMDOpteron(), "isAMDOpteron failed\n");
TR_ASSERT_FATAL(comp->compileRelocatableCode() || comp->isOutOfProcessCompilation() || comp->compilePortableCode() || comp->target().cpu.is(OMR_PROCESSOR_X86_INTEL_CORE2) == cg()->getX86ProcessorInfo().isIntelCore2(), "isIntelCore2 failed\n");
TR_ASSERT_FATAL(comp->compileRelocatableCode() || comp->isOutOfProcessCompilation() || comp->compilePortableCode() || comp->target().cpu.is(OMR_PROCESSOR_X86_INTEL_NEHALEM) == cg()->getX86ProcessorInfo().isIntelNehalem(), "isIntelNehalem failed\n");
TR_ASSERT_FATAL(comp->compileRelocatableCode() || comp->isOutOfProcessCompilation() || comp->compilePortableCode() || comp->target().cpu.is(OMR_PROCESSOR_X86_INTEL_WESTMERE) == cg()->getX86ProcessorInfo().isIntelWestmere(), "isIntelWestmere failed\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these asserts really necessary?

Copy link
Contributor Author

@0xdaryl 0xdaryl May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, tbh. It has been decades since I looked at this code, but I think there used to be performance considerations for choosing instructions on various processors. But asserts aren't the way to enforce that.

Given what I've come to understand of the CPUID code as part of this PR, it can only be one of those exact processors coming through this path or the assertion will trip. Most of those processors are fairly old, so it seems this path is not taken very frequently (or never at all). (Upon reading the code more closely, I'm not sure this statement is true).

Your question is much broader than what this PR is attempting to address. I'd say it be revisited separately.

And if there is value to keeping these asserts for some reason, we should be able to come up with a more efficient way of expressing these conditions. There is a lot of redundant overhead here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created an issue: #7352

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these asserts were added when, at least in openJ9, we switched to using the portlib for the processor info instead of the X86ProcessorInfo class; I guess it was to ensure that the two sources agreed on all queries.

I doubt these asserts are still needed.

_processorDescription |= TR_ProcessorIntelIceLake; break;
case 0x55: // Skylake_X
case 0x4e: // Skylake_L
case 0x5e: // Skylake
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the meaning behind the suffix in your comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment in my latest forced push. I borrowed the suffix conventions for the processors we recognize from the Linux kernel.

_processorDescription |= TR_ProcessorIntelSapphireRapids; break;
case 0x6a: // IceLake_X
case 0x6c: // IceLake_D
case 0x7d: // IceLake
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find 7D documented. I assume its a client processor?

For the client ice lake processors I see

Processor Family Extended Family Model
Ice Lake Client (U) 0x6 0x7 0xe
Ice Lake Client (Y) 0x6 0x7 0xe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, see Vol 4., Table 2-1

case 0x7d: // IceLake
case 0x7e: // IceLake_L
_processorDescription |= TR_ProcessorIntelIceLake; break;
case 0x55: // Skylake_X
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how skylake 0x55 will be differentiated from Cooper lake and Cascade lake. The model numbers overlap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are considered "optimizations" on Skylake. I believe the stepping is what distinguishes them. I didn't include them because I did not find a verifiable stepping value for both, and distinguishing the processor with that much refinement was not my goal (it may be part of your future CPUID refactoring work).

Nevertheless I have since found a stepping value for Cascade Lake, and I modified the PR to support it.

@@ -247,6 +269,7 @@ omrsysinfo_get_x86_description(struct OMRPortLibrary *portLibrary, OMRProcessorD
char vendor[12];
uint32_t familyCode = 0;
uint32_t processorSignature = 0;
uint32_t processorStepping = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation issues here (mixed tabs and spaces)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest push. Thanks.

* Cascade Lake
* Ice Lake
* Sapphire Rapids
* Emerald Rapids

Signed-off-by: Daryl Maier <maier@ca.ibm.com>
@vijaysun-omr
Copy link
Contributor

Jenkins build win,xlinux

@vijaysun-omr vijaysun-omr merged commit 0f74862 into eclipse:master May 30, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants