-
Notifications
You must be signed in to change notification settings - Fork 60
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 support for PGO instrumentation #471
Conversation
This commit adds support for PGO instrumentation. This should be enabled by adding the `--pgo-instrument` option to the Gradle command line. When this is done, then the generated binary will be compiled with PGO instrumentation enabled, and the binary name will be suffixed with `-instrumented`. It is possible to run the instrumented binary directly too, in which case the profile files will be written in the same directory as the binary.
By convention, the directory is set to `src/pgo-profiles/<binary>`. For example, for the `main` binary, the directory where to put PGO profiles would be `src/pgo-profiles/main`. If that directory is present _and that we're not instrumenting_, then the profile will be used when compiling with native image. It is possible to provide multiple profiles in a single directory.
As we're not compatible. Test `org.graalvm.buildtools.gradle.OfficialMetadataRepoFunctionalTest` throws an incomprehensible error message, in all versions of Gradle I've tested: ``` Configuration cache state could not be cached: field `spec` of `org.gradle.api.internal.tasks.execution.SelfDescribingSpec` bean found in task `:compileJava` of type `org.gradle.api.tasks.compile.JavaCompile`: error writing value of type 'org.gradle.api.internal.tasks.compile.CompilerForkUtils$$Lambda$1235/0x00000008015b1c38' > Unable to make field private final java.lang.Object[] java.lang.invoke.SerializedLambda.capturedArgs accessible: module java.base does not "opens java.lang.invoke" to unnamed module @3cc98b0c ``` This PR also rewrote some code which fixed other configuration cache issues which arose _before_ reaching this one.
@alvarosanchez @fniephaus this is ready for review. The configuration cache problems are solved, we're compatible 🎉 |
languageVersion.set(JavaLanguageVersion.of(11)) | ||
vendor.set(JvmVendorSpec.matching("GraalVM")) | ||
languageVersion.set(JavaLanguageVersion.of(17)) | ||
// vendor.set(JvmVendorSpec.matching("Oracle Corporation")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentionally left so that we figure out what to do with this : the build will fail if it's not an Oracle GraalVM, but there's no way to make it work properly if we set matching("Oracle Corporation")
since it could select a different implementation
This commit adds support for PGO instrumentation. This should be enabled by adding the
--pgo-instrument
option to the Gradle command line. When this is done, then the generated binary will be compiled with PGO instrumentation enabled, and the binary name will be suffixed with-instrumented
.It is possible to run the instrumented binary directly too, in which case the profile files will be written in the same directory as the binary.