oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.45k stars 1.64k forks source link

[Native Image] Native image compiled with -march=native fails to execute on the same machine (Linux Arch) #10037

Closed gavr123456789 closed 2 weeks ago

gavr123456789 commented 3 weeks ago

Describe the Issue

Can't run the binary which was compiled with -march=native, if this flags removed, it runs.

CPU: 12th Gen Intel® Core™ i9-12900H × 20

This was not the case with GraalVM 21.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java --version java 23.0.1 2024-10-15 Java(TM) SE Runtime Environment Oracle GraalVM 23.0.1+11.1 (build 23.0.1+11-jvmci-b01) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 23.0.1+11.1 (build 23.0.1+11-jvmci-b01, mixed mode, sharing)

Operating System and Version

Linux precision5570 6.11.6-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 01 Nov 2024 03:30:35 +0000 x86_64 GNU/Linux

Build Command

Using id("org.graalvm.buildtools.native") version "0.10.3"

graalvmNative {
    binaries {
        named("main") {
            mainClass.set("main.MainKt")
        }
    }
    binaries.all {

        imageName.set("niva")
        buildArgs.add("-O3")
        this.runtimeArgs()
        buildArgs.add("--no-fallback")
        buildArgs.add("-march=native")
        buildArgs.add("--initialize-at-build-time")
    }
}

Expected Behavior

The resulting binary runs on the same machine on which it was compiled.

Actual Behavior

Getting

The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, AMD_3DNOW_PREFETCH, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, TSC, TSCINV_BIT, AVX, AVX2, AES, ERMS, CLMUL, BMI1, BMI2, ADX, SHA, FMA, VZEROUPPER, FLUSH, FLUSHOPT, CLWB, SERIALIZE, RDTSCP, RDPID, FSRM, GFNI, F16C, PKU, OSPKE, CET_IBT, CET_SS].
Please rebuild the executable with an appropriate setting of the -march option.⏎

Steps to Reproduce

Build any binary with -march=native flag, try to run it.

Additional Context

If I remove -march=native I can run the binary.

Build Log Output and Error Messages

No response

gavr123456789 commented 3 weeks ago

I assume this is very similar to https://github.com/oracle/graal/issues/6234

oubidar-Abderrahim commented 3 weeks ago

Could you please share a reproducer? Thank you

mukel commented 2 weeks ago

Fixed in #10050. This only happens on Intel CPUs with performance and economy cores; should be backported.

gavr123456789 commented 2 weeks ago

Thanks! Then I completely forgot what to add to the reproducer, but in fact this is any hello world project