-
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 #457
Comments
Thanks for the suggestions, @melix. I've got some comments:
I'd like a CLI flag, but using
yes, that'd be very useful.
Does this mean that Native Image will automatically pick up the profile stored in a
maybe
I'm actually wondering how the iprof files find their way into this new directory for PGO profiles? We probably should provide users with the right
Quoting this a second time for another thought: why is this not about the ability to automatically run the instrumented image? I mean the plugins already support running with the tracing agent, couldn't it similarly run the instrumented binary, add the right |
* Add support for PGO instrumentation 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. * Add support for a PGO profiles directory 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. * Remove GraalVM version from workflows * Add documentation about PGO support See #457 * Fix JUnit native test * Make checkstyle happy * Fix tests * Temporarily(?) disable testing with config cache 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. * Upgrade to JUnit 5.10.0 * Make checkstyle happy * Fix test * Restore configuration cache tests * Update baseline versions for config cache
Now that GraalVM 23 is out with PGO support available in the Oracle GraalVM distribution, it would be good if the Gradle and Maven plugins added built-in support for PGO.
For the Gradle plugin, my recommendation would be to add a couple of options to
org.graalvm.buildtools.gradle.dsl.NativeImageCompileOptions
:Property<Boolean> getPgo()
which can also be enabled via a CLI flag (e.g--pgo
), which would enable the compilation with--pgo-instrument
(and potentially add a-instrumented
suffix to the image name for clarity), which would be used for the 1st step, building an image with instrumentation supportDirectoryProperty getPgoProfilesDirectory()
pointing to a directory of.iprof
files which would be automatically added to the native image compilation ifgetPgo()
returns false (and that there are actually files there)We could have a conventional location of those profile files, for example
src/native-image/<image name>/pgo
, so for example for the main image it would besrc/native-image/main/pgo
(with the idea that these files would be checked in VCS).This is not about the ability to automatically run the instrumented image with a "load test" and automating the process from A-Z, but at least to make it possible to enable PGO in a standard way.
The text was updated successfully, but these errors were encountered: