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

[FFI/JDK22] Performance improvement via NativeMH/LinkToNative #18799

Conversation

ChengJin01
Copy link

The prototype explores the way of shrinking the performance gap
in downcall by leveraging the NativeMH/LinkToNative mechanism
in OpenJDK to guarantee that the LambdaForm-customized
bytecode can be optimized in JIT.

Note:

  1. the prototype only supports primitives for the moment.
  2. -Xffiproto is used to enable the prototype without the
    constraints on the life cycle of memory segment.

Signed-off-by: ChengJin01 [email protected]

@ChengJin01
Copy link
Author

The prototype includes the changes in OpenJ9 (this PR) and in OpenJDK at ibmruntimes/openj9-openjdk-jdk#736 & ibmruntimes/openj9-openjdk-jdk22#17, in which case they should be merged altogether once approved.

@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch from 1397732 to f0b26e2 Compare January 23, 2024 20:09
@ChengJin01
Copy link
Author

Reviewer: @tajila
FYI: @gacholio, @keithc-ca, @pshipton

@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch 2 times, most recently from 6acc2b9 to 71e2d90 Compare January 24, 2024 20:14
@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch 2 times, most recently from 0f45817 to f2a3b9a Compare January 30, 2024 23:05
runtime/vm/UpcallVMHelpers.cpp Outdated Show resolved Hide resolved
runtime/vm/UpcallVMHelpers.cpp Outdated Show resolved Hide resolved
@keithc-ca
Copy link
Contributor

Could this improvement be extended to jdk21? It would be a greater benefit given jdk21 is an LTS version.

@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch from f2a3b9a to 21f6135 Compare January 31, 2024 15:19
@ChengJin01
Copy link
Author

ChengJin01 commented Jan 31, 2024

Could this improvement be extended to jdk21? It would be a greater benefit given jdk21 is an LTS version.

There is no plan for the moment to push the optimization (still in the status of prototype/exploration) back to JDK21 (might be a little bit different in terms of the OpenJDK extension) as we have not yet confirmed whether it really works this way as expected given a bunch of work/issues with the prototype will be addressed by JIT.

FYI: @tajila

@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch 2 times, most recently from dd2158d to 1863d90 Compare January 31, 2024 17:16
@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch 2 times, most recently from fcc0249 to 20aeec7 Compare January 31, 2024 17:54
@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch from 20aeec7 to ec6f98c Compare January 31, 2024 18:58
@keithc-ca
Copy link
Contributor

Jenkins test sanity amac,zlinux,win jdknext depends ibmruntimes/openj9-openjdk-jdk#736

@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch 2 times, most recently from 76dd44b to b6687f6 Compare February 1, 2024 03:21
@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch from b6687f6 to 9fc62be Compare February 1, 2024 16:04
@ChengJin01 ChengJin01 force-pushed the ffi_perf_improvement_linktonative_vm_jdk22_v5 branch from 9fc62be to 2dd0653 Compare February 1, 2024 17:37
The prototype explores the way of shrinking the performance gap
in downcall by leveraging the NativeMH/LinkToNative mechanism
in OpenJDK to guarantee that the LambdaForm-customized bytecode
can be optimized in JIT. 

Note:
1) the prototype only supports primitives for the moment.
2) -Xffiproto is used to enable the prototype without the
constraints on the life cycle of memory segment.

Signed-off-by: ChengJin01 <[email protected]>
@keithc-ca
Copy link
Contributor

@tajila, any further comments?

@keithc-ca keithc-ca merged commit c3e5161 into eclipse-openj9:master Feb 2, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants