halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.88k stars 1.07k forks source link

Add support for arm64e ABI (when possible) #4490

Open steven-johnson opened 4 years ago

steven-johnson commented 4 years ago

See http://lists.llvm.org/pipermail/llvm-dev/2019-October/136091.html

arm64e is a specific ABI for pointer authentication in C, C++, 
Objective-C, and Swift.  It is used on iOS 12+ on systems that provide 
ARMv8.3, as well as several other Apple OSes.  This ABI is not yet 
considered “stable” for third-party use because some of the details 
are still evolving

This will likely be necessary in order to work with versions of Xcode (etc) that enable the pointer-authentication features for newer (A12+) chips.

Note that ARMv8.3a support is somewhat orthogonal to this; arm64e presumes/requires ARM8.3a to be available, but the reverse it not necessarily the case, AFAIK.

steven-johnson commented 4 years ago

See also https://github.com/halide/Halide/issues/4487

rjmccall commented 4 years ago

Yes, if you support emitting code for iOS (AOT, I guess, given iOS platform restrictions), you will need to support emitting code for pointer authentication. If you don't need to generate any indirect calls, that should be very easy — just a small amount of driver setup. Otherwise, it might be more complex.

steven-johnson commented 3 months ago

Adding @abadams @alexreinking -- we have a request internal to Google about supporting this (I'm rather surprised it hasn't come up before now, in hindsight). My guess is that if LLVM supports it directly (which I'd hope to be the case by now) then this should be fairly straightforward; if not.... well, not?

abadams commented 3 months ago

I think it hasn't come up because Apple backed off on requiring it. I don't know how complex it would be to add. It might just work, but it's also possible there could be LLVM IR passes we have to do over the runtime modules, because target-agnostic bitcode isn't enough.

rjmccall commented 3 months ago

The iOS JIT entitlement requires arm64e. Users could also potentially want to run your code in an arm64e process on macOS for security reasons. It's not urgent If you don't have users actually asking for these things, of course.

steven-johnson commented 2 months ago

As of July 2024, the support for arm64e in upstream LLVM doesn't appear to match that in recent XCode versions, so it's not really useful. This will likely need to wait for Apple to upstream their fixes from their private branch into the main branch.