-
Notifications
You must be signed in to change notification settings - Fork 396
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
Make target environment local to the compiler #4518
Comments
It not the case of RISC-V, either. |
Does it make sense to support the equivalent of gcc's |
Yeah the discussion more or less went along the lines of eventually having the ability to specify particular feature sets, as I described the motivation on the OpenJ9 side. As a first step, the consensus was to go ahead with first refactoring the code to make the target a compilation local entity to facilitate the ability to specify feature sets. |
Proper cross compilation support has not been architected into OMR or downstream projects yet (see #1674 for a starting point). There are currently baked-in assumptions about the homogeneity of the target by each compilation thread and by compiler initialization and runtime code. Your PR relaxes those somewhat for the CPU capability questions on the target for individual compilation threads, but there are still places in the code outside of a compilation context (e.g., compiler initialization or compilation runtime) that assume a level of consistency in the environment. For just one example, only one code cache is allocated and managed and its configuration is based on an assumption of the target environment (e.g., that all the code will be for a particular processor architecture and will be of the same bitness). Until broader cross compilation support is in place, I believe the assumption needs to be that for a given build of the compiler that the environment (the target OS, target bitness, number of processors) needs to be consistent across all compilation threads and for the runtime parts outside of compilation threads. The target CPU architecture (and endianness) should be fixed, but the exact family of processor and the capabilities available on those processors can vary between compilation threads. Hence, as long as the target CPU question isn't about whether a particular processor feature is available I think it is safe to ask the global environment for the answer (e.g., number of processors, target architecture, etc.). |
Assuming my changes go in, how would we enforce that new code does not use EDIT: Actually the assert wouldn't even work, the target isn't accessed via a query. I guess we could change it so that it was accessed via a query. |
Issue: eclipse-omr#4518 Signed-off-by: Harry Yu <harryyu1994@gmail.com>
Introduce relocatableTarget environment to be used by portable AOT. Disable cpu tests for relocatable compilations (i.e. AOT). The cpu tests are used for testing the new api's against old api's on a single target processor. The tests became invalid when there are multiple targets. Issue: eclipse-omr#4518 Signed-off-by: Harry Yu <harryyu1994@gmail.com>
The compiler uses the
TR::Compiler
singleton to query against theTR::Environment target
which is used to determine the environment the native generated code is targeting. This approach works fine for when the compiler is always going to generate code for a particular target. However, in dynamic runtimes that want to provide the ability to have optional dynamic relocatable compilations1, the compiler needs to have the ability to switch between at least two different target environments: 1. where the target environment matches the host environment, and 2. where the target environment does not.One way of going forward would be:
TR::Environment
member toOMR::CompilerEnv
, say (for lack of a better name)relocatableTarget
.TR::Environment
member toOMR::Compilation
TR::Compiler->target
tocomp()->target()
Further considerations
I believe it would be beneficial to have the ability to accept options to control the target processor as well as processor features. Currently in the compiler, for P and Z, the CPU features are coupled with the processor so knowing the processor level generally indicates what features are available for use. However, this may not continue to be the trend, and is already not the case with x86 and AArch64. Therefore, supporting an option to target a processor would be convenient to address the current coupling in P and Z, but we also accept target processor features as options for other architectures. In the case of relocatable compilations, the default behaviour could just be to target only the core features of the ISA.
1 - By "optional dynamic relocatable compilation", I mean the decision to compile some entity is made at runtime (dynamic) and the decision to generate position independent code for a particular compilation (relocatable compilation) is also made at runtime (optional).
The text was updated successfully, but these errors were encountered: