Skip to content

[NativeAOT] Properly implement targeting iOS-like platforms rather than pretending to be macOS #87610

Closed

Description

@ivanpovazan

Description

Initial support for targeting iOS-like platforms with NativeAOT introduced with: #81476 uses a workaround in JIT interface:

target.IsOSXLike ? CORINFO_OS.CORINFO_MACOS : CORINFO_OS.CORINFO_UNIX;

hardwiring the compilation as if the target platform is macOS which also brings along corresponding implications on the native side.

Activity

  1. added this to the 8.0.0 milestone on Jun 15, 2023
  2. ivanpovazan commented on Jun 15, 2023

    @ivanpovazan
    MemberAuthor
  3. MichalStrehovsky commented on Jun 16, 2023

    @MichalStrehovsky
    Member

    What problem is this causing? If there are ABI differences (that this bit controls in the JIT), I'd expect we wouldn't be able to run a MAUI app.

  4. jkotas commented on Jun 16, 2023

    @jkotas
    Member

    Is this issue just about renaming macOS to OSXLike in the JIT and JIT/EE interface?

  5. filipnavara commented on Jun 16, 2023

    @filipnavara
    Member

    Does the flag control the ABI only, or can it have effect on something like the minimum expected architecture baseline? (which is different between M1 ARM and Axx ARM).

  6. MichalStrehovsky commented on Jun 16, 2023

    @MichalStrehovsky
    Member

    Instruction sets are configured here; the JIT doesn't decide this:

    if (targetOS == TargetOS.OSX)
    {
    // For osx-arm64 we know that apple-m1 is a baseline
    instructionSetSupportBuilder.AddSupportedInstructionSet("apple-m1");
    }
    else
    {
    instructionSetSupportBuilder.AddSupportedInstructionSet("neon"); // Lower baselines included by implication
    }

  7. ivanpovazan commented on Jun 16, 2023

    @ivanpovazan
    MemberAuthor

    @akoeplinger could you please add more context?

  8. akoeplinger commented on Jun 16, 2023

    @akoeplinger
    Member

    Is this issue just about renaming macOS to OSXLike in the JIT and JIT/EE interface?

    That is an option, but when I initially did the iOS changes for NativeAOT I tried to add a new platform CORINFO_IOS etc but then hit some issues with the consistency checks here:

    // compMatchedVM is set to true if both CPU/ABI and OS are matching the execution engine requirements
    //
    // Do we have a matched VM? Or are we "abusing" the VM to help us do JIT work (such as using an x86 native VM
    // with an ARM-targeting "altjit").

    Back then I didn't have time to investigate further so we went with pretending to target macOS for iOS.

  9. MichalStrehovsky commented on Jun 20, 2023

    @MichalStrehovsky
    Member

    Back then I didn't have time to investigate further so we went with pretending to target macOS for iOS.

    The question is if there's anything different for iOS that we would need a new value to distinguish it in RyuJIT. We distinguish it as TargetOS in the C# part of the compiler, but only because there's one spot in the LLVM object writer that puts this into the object file (99.9% of the compiler doesn't see it as a different OS). Is there a part of RyuJIT that needs to know?

  10. akoeplinger commented on Jun 21, 2023

    @akoeplinger
    Member

    As far as I can see the JIT would be fine with a generic "Apple" value, except for the compatibility checks. E.g. this one:

    // MacOS x64 uses the Unix jit variant in crossgen2, not a special jit
    info.compMatchedVM =
    info.compMatchedVM && ((eeInfo->osType == CORINFO_UNIX) || (eeInfo->osType == CORINFO_MACOS));

    I assume we also use the Unix jit variant for iOS x64 (Simulator) today so presumably it works fine.

    If you think that we don't need this distinction in the JIT I can send a PR to rename OSX -> Apple.

  11. MichalStrehovsky commented on Jun 21, 2023

    @MichalStrehovsky
    Member

    As far as I can see the JIT would be fine with a generic "Apple" value, except for the compatibility checks. E.g. this one:

    That compatibility check also uses TargetOS::IsMacOSX above which is currently broken #87794 without anything noticing - I don't know what this actually does.

    If you think that we don't need this distinction in the JIT I can send a PR to rename OSX -> Apple.

    If we're only discussing renaming this within the JIT, this is now fully a JIT issue, so I'm moving this to that area and leaving the call on the JIT team.

  12. 1 remaining item

  13. added
    area-CodeGen-coreclr
    on Jun 21, 2023
  14. JulieLeeMSFT commented on Jul 6, 2023

    @JulieLeeMSFT
    Member

    cc @dotnet/jit-contrib. @jakobbotsch please take a look.

  15. jakobbotsch commented on Jul 18, 2023

    @jakobbotsch
    Member

    If you think that we don't need this distinction in the JIT I can send a PR to rename OSX -> Apple.

    Indeed I don't think we need the distinction. Feel free to submit a PR to rename the value. I'm going to move the issue to future since this is just a cosmetic change.

  16. modified the milestones: 8.0.0, Future on Jul 18, 2023
  17. modified the milestones: Future, 9.0.0 on Aug 17, 2023
  18. ghost added
    in-pr
    on Dec 16, 2023
  19. ghost removed
    in-pr
    on Dec 17, 2023
  20. locked and limited conversation to collaborators on Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclros-ios

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions