Skip to content
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

WIP: Some minimal support for Apple Silicon #36592

Merged
merged 1 commit into from
Jul 11, 2020
Merged

WIP: Some minimal support for Apple Silicon #36592

merged 1 commit into from
Jul 11, 2020

Conversation

Keno
Copy link
Member

@Keno Keno commented Jul 9, 2020

With this and some hacks to various dependencies, Julia builds for
Darwin ARM64. We don't get very far though, and quickly end up
jumping into a bit of uninitialized JIT memory, so there's clearly
more work to be done here. That said, let's take this one step at
a time, so here's the few pieces that at least make it build.

@Keno Keno added system:mac Affects only macOS system:arm ARMv7 and AArch64 labels Jul 9, 2020
@Keno Keno requested review from staticfloat and yuyichao July 9, 2020 07:19
@Keno Keno changed the title Some minimal support for Apple Silicon WIP: Some minimal support for Apple Silicon Jul 9, 2020
#elif defined(_CPU_AARCH64_)
typedef arm_thread_state64_t host_thread_state_t;
typedef arm_exception_state64_t host_exception_state_t;
#define HOST_EXCEPTION_STATE ARM_EXCEPTION_STATE
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: This should be ARM_EXCEPTION_STATE64

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a change from Apple that you are expecting? Or are you going to push a new version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll push a new version, there's still some other issues with it also.

Copy link
Contributor

@yuyichao yuyichao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense, though I’m just assuming the signal handling is correct....

A few questions,

  1. Is it A64 only?
  2. What’s the actual chip and features? What’s apple’s way of detecting the features?
    I’ve heard that it can boot Linux so checking it from there should be interesting (to see if Update ARM feature and CPU detection (supersedes #36464) #36485 detects it correctly).i assume it doesn’t have hwcap or at least not in the same way Linux does it. Does it at least support what Linux have with HWCAP_CPUID? Or is it like iOS where, as I read, you jus need to hard code the known hardware features of various Apple devices.

#elif defined(_CPU_AARCH64_)
typedef arm_thread_state64_t host_thread_state_t;
typedef arm_exception_state64_t host_exception_state_t;
#define HOST_EXCEPTION_STATE ARM_EXCEPTION_STATE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a change from Apple that you are expecting? Or are you going to push a new version?

@Keno
Copy link
Member Author

Keno commented Jul 9, 2020

  • Is it A64 only?

I believe so yes. Darwin has support for A32, but all recent iDevices are A64 and I believe there will never be an A32 mac.

What’s the actual chip and features? What’s apple’s way of detecting the features?

The chip in the DTK is an Apple A12Z. I haven't figured out if there's any way to do feature detection. I need to look into that.

With this and some hacks to various dependencies, Julia builds for
Darwin ARM64. We don't get very far though, and quickly end up
jumping into a bit of uninitialized JIT memory, so there's clearly
more work to be done here. That said, let's take this one step at
a time, so here's the few pieces that at least make it build.
@Keno
Copy link
Member Author

Keno commented Jul 11, 2020

Looks like we can feature detect via sysctl:

$ sysctl hw.optional
hw.optional.floatingpoint: 1
hw.optional.watchpoint: 4
hw.optional.breakpoint: 6
hw.optional.neon: 1
hw.optional.neon_hpfp: 1
hw.optional.neon_fp16: 1
hw.optional.armv8_1_atomics: 1
hw.optional.armv8_crc32: 1
hw.optional.armv8_2_fhm: 0
hw.optional.amx_version: 0
hw.optional.ucnormal_mem: 0
hw.optional.arm64: 1

@Keno Keno merged commit a23a4ff into master Jul 11, 2020
@Keno Keno deleted the kf/applesilicon branch July 11, 2020 14:53
simeonschaub pushed a commit to simeonschaub/julia that referenced this pull request Aug 11, 2020
With this and some hacks to various dependencies, Julia builds for
Darwin ARM64. We don't get very far though, and quickly end up
jumping into a bit of uninitialized JIT memory, so there's clearly
more work to be done here. That said, let's take this one step at
a time, so here's the few pieces that at least make it build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:arm ARMv7 and AArch64 system:mac Affects only macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants