Turbine native image does not work on really old hardware
Turbine native image built with default Graal settings fails on Core 2 Duo CPU due to missing instructions:
turbine_direct_graal failed: error executing Turbine command (from target @@rules_jvm_external~//private/tools/java/com/github/bazelbuild/rules_jvm_external/zip:zip) external/rules_java~~toolchains~remote_java_tools_linux/java_tools/turbine_direct_graal '-Dturbine.ctSymPath=external/rules_java~~toolchains~remotejdk21_linux/lib/ct.sym' --output ... (remaining 28 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT].
Please rebuild the executable with an appropriate setting of the -march option.Target //lib/text/format:format failed to build
Is it possible to build Turbine with -march=x86-64 native image option for best compatibility?
See https://github.com/bazelbuild/bazel/issues/20298 for the last time this came up (cc @fmeum )
As a workaround in the meantime, consider using a custom java_toolchain that overrides header_compiler_direct = "@remote_java_tools//:TurbineDirect"
Do we have a baseline that we aim to support with default settings? Presumably reducing the amount of optimizations we allow would have an impact on performance for all users, not just those on old machines.
We could try to use https://github.com/bazelbuild/bazel/issues/20298#issuecomment-1826618043.
It is unlikely that SSE and AVX have any impact on performance of header generation.
wt., 14 sty 2025, 16:09 użytkownik Fabian Meumertzheim < @.***> napisał:
Do we have a baseline that we aim to support with default settings? Presumably reducing the amount of optimizations we allow would have an impact on performance for all users, not just those on old machines.
We could try to use bazelbuild/bazel#20298 (comment) https://github.com/bazelbuild/bazel/issues/20298#issuecomment-1826618043 .
— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/rules_java/issues/263#issuecomment-2590180049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOLMPWJIMGB3M76QE45LNL2KUSAXAVCNFSM6AAAAABVAG3RE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJQGE4DAMBUHE . You are receiving this because you authored the thread.Message ID: @.***>
I ran turbine_benchmark with both settings and found the version without SSE to be slower, but only by a margin that's within the noise of the benchmark (which is somewhat noisy).
@marekkrk Could you check whether turbine built with this patch works on your machine?
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/BUILD b/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/BUILD
index 34a90028f8..b4e091200a 100644
--- a/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/BUILD
+++ b/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/BUILD
@@ -65,6 +65,7 @@ native_image(
# Graal's default settings result in executables that aren't sufficiently compatible for
# general use in Bazel.
"-march=x86-64-v2",
+ "-H:RuntimeCheckedCPUFeatures=SSE3,SSSE3,SSE4_1,SSE4_2,POPCNT",
],
"//conditions:default": [],
}),
I could not make it work with any native-image compiler flags. Please close this ticket.