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

x86: Add disableAVX2/512 options and check XCR0 for OS support #7602

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BradleyWood
Copy link
Contributor

No description provided.

@BradleyWood
Copy link
Contributor Author

FYI, @0xdaryl

OMR::X86::CPU::is_feature_disabled(uint32_t feature)
{
TR_CompilationOptions option = (TR_CompilationOptions) 0;
TR::Compilation *comp = TR::comp();
Copy link
Contributor

Choose a reason for hiding this comment

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

I need to be convinced this is the best way to do this because pulling the compilation object from TLS has never proven to be cheaper than retrieving it from elsewhere or passing it in as a parameter. It is really useful for debugging, in places where compile-time performance is not a concern (e.g., the ASSERT macro), or in code that is difficult to modify to introduce a compilation object. supports_feature (which immediately calls this function) is called from a number of places, so some compile-time benchmarking is required.

Did you consider passing in the compilation object to supports_feature or caching the compilation object in the CPU object itself? If so, please comment why forgoing those alternatives justifies the compile-time cost of using TR::comp().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passing the compilation object to supports_feature would require changes in both OpenJ9 and OMR, including at every call to to this function. That would introduce a large number of changes that would need to introduced with a coordinated merge between OpenJ9 and OMR.

I don't think I makes sense for TR::CPU to cache the compilation object either. It would need to change with compilation and my understanding is that environment information is shared across all compilations.

The only other thing I can thing of is use TR::comp(), cache the result to comp->getOption() in a static field and hope that gcc can optimize it. But doing this would have other drawbacks, in that you cant disable features for specific methods only and the CLI would probably need to verify that these options are only applied globally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants