-
Notifications
You must be signed in to change notification settings - Fork 733
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
Loading AOT code based on dependencies #20529
Comments
Attn @mpirvu. |
Issue Number: 20529 |
@mpirvu I did have some verbose log messages during development in a few places, but I haven't added them back in yet. Things related to offset and method tracking, registering dependencies during compilation, that sort of thing. Is there a good verbose option (or options) to put them under? |
Now that I've been able to do some testing of this again, I ran acmeair with
Both classes (ID 30 and 40) are fully initialized, but the relocation failed because One thing I did notice is that calls to I'll have to see if this works elsewhere. The number of load failures with (The AOT load failure total with a read-only SCC closer to what's created during open liberty container builds is roughly 10 with dependency tracking and 100 without, for comparison). |
After further investigation, I don't think |
I said in #20669 (comment) that it looked like the failure here (in #20529 (comment)) was because of openj9/runtime/compiler/runtime/SymbolValidationManager.cpp Lines 842 to 845 in ff43532
that is not interacting well with some of the other validations. The compilation logs for the method with that relo failure look like this:
I imagine that we used
and that The issue with all of this is that at compile time, we would have called I think we can just add a |
If the load happens only when the dependencies are satisfied, why would the cpIndex getting resolved at load time have an impact on the success of the load? Even if the ClassFromCPRecord was added, the entry wouldn't get resolved until relo time, but we would not have relocated until the entry was resolved. The only way it can matter is if the compilation of one method (say |
I've been trying to avoid counting individual entries being resolved in classes as dependencies, so the dependencies currently count as satisfied when all the classes mentioned in the relo records are loaded or initialized. What I saw when I added more log messages to the relo logs was more like: during compilation of Since the dependency table stuff is merged, I'm going to test calling |
The current approach to AOT loading involves setting a low initial invocation count (the
scount
, default 20) for methods with stored AOT bodies in the SCC. This invocation count guess cannot be too small, or loads would be attempted before all the classes necessary for relocation had been loaded, and it cannot be too large, or loads would be delayed unnecessarily.An alternative is to induce an AOT load when every class necessary for relocating that AOT code has been loaded. This will both increase the reliability of AOT loads and reduce the time between when a load is possible and when a load actually occurs. (Dependency-based loading will not eliminate load failures entirely, as some runtime properties of the classes in question may have changed, but decreasing the failure rate further would require more substantial changes to the structure of relocation itself).
The plan I am following for an initial design has a few components.
J9::AheadOfTimeCompile::processRelocations()
.jitHookInitializeSendTarget()
), their dependencies will be read from the SCC and the current state of those dependencies will be determined. If their dependencies are all satisfied, their initial count will be set to zero. Otherwise, they and their dependencies will be tracked, and their dependencies will be updated as updates to the map in (2) occur. When their dependencies are satisfied, their current count will be reduced to zero and they will be removed from tracking. This will trigger an AOT load the next time they are invoked.Testing of a rough implementation with acmeair is promising - the AOT failure rate is significantly reduced, and AOT loads generally happen much earlier than the
scount
approach. I'll link PRs here as I open them to implement the different pieces of this design.The text was updated successfully, but these errors were encountered: