Skip to content

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

Merged
0xdaryl merged 2 commits into
eclipse-omr:masterfrom
BradleyWood:xcro_flags2
Jan 20, 2025
Merged

0xdaryl merged 2 commits into
eclipse-omr:masterfrom
BradleyWood:xcro_flags2

Conversation

@BradleyWood

Copy link
Copy Markdown
Contributor

No description provided.

@BradleyWood

Copy link
Copy Markdown
Contributor Author

FYI, @0xdaryl

Comment thread compiler/x/env/OMRCPU.cpp Outdated
OMR::X86::CPU::is_feature_disabled(uint32_t feature)
{
TR_CompilationOptions option = (TR_CompilationOptions) 0;
TR::Compilation *comp = TR::comp();

Copy link
Copy Markdown
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
Copy Markdown
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.

@BradleyWood
BradleyWood marked this pull request as draft January 13, 2025 15:52
@BradleyWood
BradleyWood marked this pull request as ready for review January 13, 2025 16:00
@BradleyWood

Copy link
Copy Markdown
Contributor Author

@0xdaryl Any thoughts on this change?

@0xdaryl

0xdaryl commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

Jenkins build xlinux,osx,win,x32linux

@0xdaryl 0xdaryl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor nits only.

Comment thread compiler/x/env/OMRCPU.cpp Resolved
Comment thread compiler/x/runtime/X86Runtime.hpp Resolved
Comment thread compiler/x/env/OMRCPU.cpp Resolved
Comment thread compiler/x/env/OMRCPU.hpp Resolved
Bradley Wood added 2 commits January 20, 2025 10:44
Signed-off-by: Bradley Wood <bradley.wood@ibm.com>
Signed-off-by: Bradley Wood <bradley.wood@ibm.com>
@BradleyWood

Copy link
Copy Markdown
Contributor Author

@0xdaryl See the force-push

@0xdaryl

0xdaryl commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

Jenkins build xlinux

@0xdaryl
0xdaryl merged commit d6f1e2e into eclipse-omr:master Jan 20, 2025
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.

2 participants