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

Add options to bypass JITServer AOT cache per method #15399

Closed
AlexeyKhrabrov opened this issue Jun 22, 2022 · 9 comments · Fixed by #16442 or eclipse/omr#6842
Closed

Add options to bypass JITServer AOT cache per method #15399

AlexeyKhrabrov opened this issue Jun 22, 2022 · 9 comments · Fixed by #16442 or eclipse/omr#6842
Labels
comp:jitserver Artifacts related to JIT-as-a-Service project

Comments

@AlexeyKhrabrov
Copy link
Contributor

As a debugging/diagnostic feature, we should to have a way of bypassing the JITServer AOT cache on a per method basis, similar to excluding methods from JIT or AOT compilation/load. This can be useful, e.g., to determine whether a problem with a given method is caused by an AOT compiler issue or an AOT cache method serialization/deserialization issue. For completeness, there should be two separate options to forbid storing and loading a method to/from the JITServer AOT cache, e.g. -Xaot:{method}(jitserverAOTCacheNoStore) and -Xaot:{method}(jitserverAOTCacheNoLoad). These options should be specified on the client side.

@mpirvu mpirvu added the comp:jitserver Artifacts related to JIT-as-a-Service project label Jun 22, 2022
@mpirvu mpirvu added this to To do in JIT as a Service via automation Jun 22, 2022
@mpirvu
Copy link
Contributor

mpirvu commented Nov 24, 2022

FYI @cjjdespres This would be useful to implement for diagnosing #16232

@cjjdespres
Copy link
Contributor

Should these method names be sent to the server and stored in the client data so that it can decide what should or should not be stored/loaded, or would it be easier for the client to send those details along in its compilation request? I only see an aotCacheLoad bool transmitted in the request, so I suppose an aotCacheStore would need to be added as well.

The exclusion would happen, say, using the name in the method details of the entry being compiled in remoteCompile. We'd need to keep around a set of excluded methods for this purpose.

Should there be a limit-type option for methods as well, so that only particular methods will be loaded or stored?

Is the {method}(option) form a recognized option form for -Xaot, or should it be something like -Xaot:jitserverAOTCacheNoLoad={method}?

@AlexeyKhrabrov
Copy link
Contributor Author

Should these method names be sent to the server and stored in the client data so that it can decide what should or should not be stored/loaded, or would it be easier for the client to send those details along in its compilation request?

The latter.

I only see an aotCacheLoad bool transmitted in the request, so I suppose an aotCacheStore would need to be added as well.

Look at the code in remoteCompile() and TR::CompilationInfoPerThreadRemote::processEntry(), there is already a way to communicate "do not store" to the server (setting the classChain field in the compilation request to NULL IIRC).

@cjjdespres
Copy link
Contributor

At the moment the two relevant variables are set with

      _aotCacheStore = classChain && aotCache && JITServerAOTCacheMap::cacheHasSpace();
      aotCacheLoad = aotCacheLoad && classChain && aotCache;

I suppose it doesn't make too much sense to forbid storing and not forbid loading.

@AlexeyKhrabrov
Copy link
Contributor Author

I suppose it doesn't make too much sense to forbid storing and not forbid loading.

Good point. I agree that allowing loads but not stores for a specific method is probably not too useful because a store cannot happen after a successful load anyway. I'm fine if NoStore implies NoLoad. We can also reflect that in the option name (e.g. NoStoreLoad).

@cjjdespres
Copy link
Contributor

Would it be worth it to repurpose the existing regex/search tree infrastructure from the exclude= and limit= family of options, or is a simple list of method names most of what we need? For #16232 a list would suffice, at least.

@mpirvu
Copy link
Contributor

mpirvu commented Nov 29, 2022

It may be more flexible to use our existing infrastructure.
LimitFile.cpp contains relevant code.
There might be some dup work with this requirement: #16364

@cjjdespres
Copy link
Contributor

It looks like the existing filters use

   TR::CompilationFilters    * _compilationFilters;
   TR::CompilationFilters    * _relocationFilters;
   TR::CompilationFilters    * _inlineFilters;

in TR_Debug. The filter itself is added by the appropriate addFilter call in LimitFile. We could add new fields for the new restrictions we want to add, populate them with a TR::Option option processor, then query them when constructing the compilation request at the client.

cjjdespres added a commit to cjjdespres/omr that referenced this issue Dec 8, 2022
The option processing framework now includes a limitOption function
overload that allows the user to specify a particular compilation filter
set.

Fixes: #eclipse-openj9/openj9#15399
Signed-off-by: Christian Despres <despresc@ibm.com>
cjjdespres added a commit to cjjdespres/omr that referenced this issue Dec 8, 2022
The option processing framework now includes a limitOption function
overload that allows the user to specify a particular compilation filter
set.

Fixes: #eclipse-openj9/openj9#15399
Signed-off-by: Christian Despres <despresc@ibm.com>
JIT as a Service automation moved this from To do to Done Dec 14, 2022
@AlexeyKhrabrov
Copy link
Contributor Author

I think this was closed unintentionally (by eclipse/omr#6842).

@mpirvu mpirvu reopened this Dec 14, 2022
JIT as a Service automation moved this from Done to In progress Dec 14, 2022
cjjdespres added a commit to cjjdespres/openj9 that referenced this issue Dec 14, 2022
The -Xaot:jitserverLoadExclude and -Xaot:jitserverStoreExclude
options reuse the existing method filtering framework so that clients
can selectively exclude particular methods from AOT cache loading or
storing in a connected JITServer.

Fixes: eclipse-openj9#15399
Signed-off-by: Christian Despres <despresc@ibm.com>
JIT as a Service automation moved this from In progress to Done Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:jitserver Artifacts related to JIT-as-a-Service project
Projects
3 participants