-
Notifications
You must be signed in to change notification settings - Fork 721
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
Improvements and clean up related to the JITServer AOT cache #18990
Comments
Attn @mpirvu, @AlexeyKhrabrov. |
I already have a working implementation of handling object array classes. I needed it for caching profiling data at JITServer, but I don't remember this being an issue for AOT cache. Storing the full array class name in the |
This is more complicated than that, and doesn't have much to do with the local SCC (except for the The By the way, the same issue applies to hidden classes because they are ignored in class lookup by name. But this is a much easier fix, we simply need to add a flag to |
Which assertion? |
This assert:
|
This should be easier to do with the infrastructure I have for AOT prefetching where I store not-yet-valid records in the deserializer cache until corresponding classes get loaded. When a class gets unloaded, we can simply recreate and store its serialization record. Another approach would be to invalidate known IDs for unloaded classes and loaders on the server side, which would be preferable in terms of client memory usage. But we would have to figure out how to synchronize things properly, maybe using the existing mechanism with critical compilation requests. |
@AlexeyKhrabrov We were thinking of trying to get the array class fix (for the |
Out of curiosity - did you end up modifying the |
I can put together a draft PR some time later this week, but might not have time to work on ironing out the details afterwards. When exactly is the milestone "later this month"?
No, I didn't need to. |
It's milestone 2 for the 0.44 release. I asked again and apparently I was misremembering; it's on March 18, and it would only be later if some delay were to occur. (Edit: Looking back, I see that I did just say "later this month" and not "end of the month"). |
I've looked at my code, unfortunately I didn't add handling object arrays as a separate commit, so it'll take me a couple hours to extract the changes (which are scattered across a few components: hash class, AOT cache, client session, deserializer). I can submit an untested draft PR tomorrow. But in general I wouldn't call the changes completely straightforward, e.g. one of the complications is requesting uncached base component classes from the client. So finalizing this before the 18th might be optimistic (unless my implementation is overcomplicated and this can be done easier). |
I think that's all right. Another option that @mpirvu and I discussed was simply forbidding class record generation for array ROM classes, which would at least have the same behaviour (effectively) as what happens with |
So I can just do that, and support for array classes can wait until your larger changes are incorporated. |
Regarding this comment, I don't believe that scenario can happen, since we should be setting the flag
Then, in these places:
openj9/runtime/compiler/control/JITClientCompilationThread.cpp Lines 3117 to 3133 in d3d128a
that flag will forbid AOT store or load requests respectively. The field is perhaps poorly named - its analogue in local AOT is Now that I think about it, a method being eligible for an AOT cache store does not imply it is eligible for an AOT cache load in general, only because the client might have explicitly forbidden that method from being an AOT cache load with a command line option, but not forbidden it from being an AOT cache store. (I think the ability to do that was introduced for testing purposes). Maybe for that reason alone the fresh code should be sent every time. |
I see, the part that I missed was the fact that Ignoring the edge cases with specific methods forbidden from stores and/or loads, turning a store into a load in |
There are still various cleanup/refactoring tasks remaining after the merge of #18301. People may have some input on the solutions to these things; in any case, I'll put the list up here just to record these things for myself.
-XX:+PortableSharedCache
flag is set in the liberty container. Something to look at.JITServerAOTDeserializer::reset()
is missing a critical section for_classLoaderMonitor
.copyJ9UTF8
inClassLoaderTable.cpp
to throw an exception (Support persistent class loader name tracking in all cases when JITServer AOT cache is active #18839 (comment)).[L
class, which isn't really a class name at all - it's theromClass->className
of an array class, which is incorrect. These classes can't be stored in the SCC - there happens to be a workaround for this issue in SVM, but otherwise if the old AOT cache implementation ever tried torememberClass()
a class with an array class in its chain somewhere it would simply fail to store the chain in the SCC and the AOT compilation would fail. Fixing this could be as easy as recording the correct class name in theClassSerializationRecord
(I haven't tried this) but we also speculated in one of our weekly meetings that a newArrayClassSerializationRecord
could also be created, which would record the arity of the array class and the element class name and hash. (Now that I think about it, we can't simply record the correct name inClassSerializationRecord
- we would have to incorporate the hash of the element ROM class in some way as well). A short-term fix would be to refuse to create class serialization records for array classes, which should match the not-ignoring-SCC behaviour (something I still need to verify). I should say that the current behaviour isn't broken, as these records will always fail to be deserialized - it would just be better to handle them at compile time.$$Lambda$<index>/<address>
at the end) are less normalized without an SCC present. With an SCC, the<address>
part is just NULL (specifically, a0x0...
address), and I think the<index>
is also calculated differently (but I'm less sure about that). Performing the same transformation with an SCC not present (even if it's just at the point where aClassSerializationRecord
is created) would improve matching, as currently the "Failed to find class in class loader" deserialization error comes up more frequently in the new implementation if the originalClassSerializationRecord
was created for a client that did not have a local SCC present.TR_J9DeserializerSharedCache
we doTR::Compilation *comp = TR::compInfoPT->getCompilation();
a few times. We might be able to cache a pointer to thecompInfoPT
in that class like we now do inTR_J9JITServerSharedCache
.ClientSessionData::getClassRecord(ClientSessionData::ClassInfo &classInfo, bool &missingLoaderInfo)
that's firing in the new implementation. It indicates that there is a class chain offset being cached without a corresponding loader name. It's not fatal, really. Just odd that it's happening. I still have to track down the cause.AOTDeserializerReset
exception, the explicitwasReset
parameter in the deserializer methods can be replaced by throwing and catching that exception. Though, the entire deserializer reset mechanism can also be replaced by a readers-writer lock instead.JITServerCompilationThread.cpp
there is a line_aotCacheStore = aotCacheStore && aotCache && JITServerAOTCacheMap::cacheHasSpace();
that I think is not exactly what we want when ignoring the local SCC. Before, we could downgrade an AOT cache store at the server at any time, turning it into a normal AOT compilation. When we are ignoring the local SCC we can't let this happen, as we don't have access to a local SCC as a source of offsets. Instead of having that test, we might have to abort the compilation and inform the client that the server doesn't support AOT cache stores.testServerAOTCache
component intestJITServer
. There is the already-existing issue JITServer AOT test #16428 that would be nice to have in - it could be run under various options as well. Likely there are other tests of various AOT cache features that could be added.The text was updated successfully, but these errors were encountered: