Skip to content

NativeAOT on Graviton2 As armv8.2-a Fails to Execute #89937

@chrisoverzero

Description

@chrisoverzero

Description

When NativeAOT-compiling an application for deployment onto AWS Lambda, specifying IlcInstructionSet with the known, documented supported instruction sets for Graviton2 processors fails to execute with the error message:

The required instruction sets are not supported by the current CPU.

Reproduction Steps

For a minimal reproduction, I'm using the code from maxday's lambda-perf cold start–testing repository, but targeting .NET 8's NativeAOT. The meaningful parts of that are:

public class Function
{
    private static async Task Main()
    {
        await LambdaBootstrapBuilder.Create(FunctionHandler, new SourceGeneratorLambdaJsonSerializer<LambdaFunctionJsonSerializerContext>())
            .Build()
            .RunAsync();
    }

    public static StatusResponse FunctionHandler()
    {
        return new StatusResponse(statusCode: 200);
    }
}

public record StatusResponse(int statusCode);

[JsonSerializable(typeof(StatusResponse))]
public partial class LambdaFunctionJsonSerializerContext : JsonSerializerContext
{
}

…and for .csproj settings:

    <TargetFramework>net8.0</TargetFramework>
    <RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
    <PublishAot>true</PublishAot>
    <AssemblyName>bootstrap</AssemblyName>

    <IlcInstructionSet>armv8.2-a</IlcInstructionSet>

Expected behavior

Because Amazon's Graviton2 processor is documented as revision 8.2-a with support for features "fp16, rcpc, dotprod, crypto" and ilc doesn't support "fp16" or "crypto", I expected this:

<IlcInstructionSet>armv8.2-a,rcpc,dotprod</IlcInstructionSet>

…to compile and run. It compiled, but did not run. Figuring that maybe I was trying to add too much sauce, I tried:

<IlcInstructionSet>armv8.2-a</IlcInstructionSet>

…expecting this to compile and run. It compiled, but did not run.

Actual behavior

Upon execution, this error message is received:

The required instruction sets are not supported by the current CPU.

Regression?

No response

Known Workarounds

Leave off IlcInstructionSet, implicitly targeting revision 8.0. This does compile (natch) and run.

Configuration

I am cross-compiling for arm64 in the Docker image mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64:

~/.dotnet/dotnet publish -p:SysRoot=/crossrootfs/arm64 -p:LinkerFlavor=lld

dotnet --version is "8.0.100-rc.1.23402.12"

Other information

I admit that I'm not certain this is a problem with the NativeAOT compiler, since I don't know how to look into a binary and say "Aha, here is the incorrect instruction."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions