Skip to content

Conversation

@KavinSatheeskumar
Copy link
Contributor

@KavinSatheeskumar KavinSatheeskumar commented Dec 4, 2025

Fixes #23038

This is the complete design of the fix as described in the issue linked above.

  • Create a flag in J9:Compilation called _vectorApiTransformationPerformed (or something similar) and a similar flag in TR_MethodMetaData
  • Whenever the JIT issues a "#VECTOR API" verbose log message, set the J9:Compilation::_vectorApiTransformationPerformed flag
  • At the end of the compilation, if that flag was set, write it into the metadata.
  • The metadata is sent from the server to the client together with the compiled body. This already happens today.
  • The client receives the metadata, inspects the flag and issues a single "#VECTOR API" verbose log message

@mpirvu mpirvu added the comp:jitserver Artifacts related to JIT-as-a-Service project label Dec 4, 2025
@mpirvu mpirvu self-assigned this Dec 4, 2025
@github-project-automation github-project-automation bot moved this to In progress in JIT as a Service Dec 4, 2025
struct J9JITInvokeBasicCallInfo* invokeBasicCallInfo;
#if defined(J9VM_OPT_JITSERVER)
// corresponds to J9::Compilation::_vectorApiTransformationPerformed
bool _vectorApiTransformationPerformed;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether we could use UDATA flags; for this purpose

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also use the type BOOLEAN as used in other places within this file

Copy link
Contributor

Choose a reason for hiding this comment

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

No need to add a new field since one is already provided (flags) and it's very appropriate for the job.

// this list will be copied into the metadata
if (metaData->_vectorApiTransformationPerformed)
{
TR_VerboseLog::writeLineLocked(TR_Vlog_VECTOR_API, "Jit server processed vector ops");
Copy link
Contributor

@mpirvu mpirvu Dec 4, 2025

Choose a reason for hiding this comment

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

Please correct alignment. Also your code separated the comment from the code it was referring to.
Also, we typically write JITServer (instead of Jit server)

{
data->flags |= JIT_METADATA_IS_DESERIALIZED_COMP;
}
data->_vectorApiTransformationPerformed = comp->setVectorApiTransformationPerformed();
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to define a flag write to data->flags as you see above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we need to do this only for outOfProcessCompilation()

Copy link
Contributor

@mpirvu mpirvu left a comment

Choose a reason for hiding this comment

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

There are some places in VectorAPIExpansion.hpp that also issue vlog messages. Those need to be covered as well.

{
data->flags |= JIT_METADATA_IS_DESERIALIZED_COMP;
}
data->_vectorApiTransformationPerformed = comp->setVectorApiTransformationPerformed();
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we need to do this only for outOfProcessCompilation()

{
data->flags |= JIT_METADATA_IS_DESERIALIZED_COMP;
}
data->flags |= comp->setVectorApiTransformationPerformed() * JIT_METADATA_HAS_BEEN_VECTORIZED;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, but this code makes no sense to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

What threw me off is the usage of a setter (based on the name). The name should indicate a getter.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer the code to look this:

if (comp->getVectorApiTransformationPerformed())
   data->flags |= JIT_METADATA_HAS_BEEN_VECTORIZED;

Also, JIT_METADATA_HAS_BEEN_VECTORIZED is a bit misleading because it can be read that the metadata has been vectorized. Maybe replace it with JIT_METADATA_VECTORIZED_CODE

*/
struct J9JITInvokeBasicCallInfo* invokeBasicCallInfo;
#if defined(J9VM_OPT_JITSERVER)
// corresponds to J9::Compilation::_vectorApiTransformationPerformed
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment needs to be removed

@gita-omr
Copy link
Contributor

gita-omr commented Dec 5, 2025

Could you please describe the whole design in the commit message? Is it exactly as described here: #23038 (comment) ?

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

Status: In progress

Development

Successfully merging this pull request may close these issues.

jdk_vector_long128_j9_0 Timeout

3 participants