swift icon indicating copy to clipboard operation
swift copied to clipboard

Feature Request: Apple Silicon Support

Open ifsheldon opened this issue 3 years ago • 4 comments

As Apple begins to ship new Macbooks with Apple Silicon and Tensforflow was claimed to support Apple Silicon, I wonder whether Swift for Tensorflow will work on Apple Silicon-based Macs. Or, does it work with Rosseta2?

ifsheldon avatar Nov 16 '20 13:11 ifsheldon

I hope Apple Silicon will help in focusing S4TF towards macOS and Xcode. It will be really awesome if we could simply add S4TF package in Xcode (without installing custom S4TF toolchain, of course after differentiation been baked into stable Swift toolchains) and use it with M chip series accelerated Macs. I think this is important because it helps in keeping the training algorithm private as opposed to cloud computing.

Maybe this is a dumb thought, but I was wondering how could Swift's differentiation (in compiler) could possibly take advantage of ML Compute (written in Metal). 🤔

RahulBhalley avatar Nov 22 '20 00:11 RahulBhalley

@rahulbhalley You may want to take a look at the TF release by Apple, but Apple did not release the source code, which is not so friendly

ifsheldon avatar Nov 22 '20 08:11 ifsheldon

@ifsheldon yea, I've seen that.

RahulBhalley avatar Nov 23 '20 02:11 RahulBhalley

There are a few different things being discussed here.

@rahulbhalley I think that supporting ASi is a completely different task from using stock toolchains. The work required for both is completely disjoint.

Use of acceleration in X10 is yet a separate item.

I'd rather not this issue become a tracker for wishlist items, but stay focused on the specifics to support ASi.

As to supporting ASi, I think that it should be possible to do that. I did take a stab at getting Swift building (a while ago) and found that there was a bunch of work to be done. After fixing things like libdispatch and the runtime, I got to the point where the swift compiler test suite was passing. However, the next stage requires building swift-apis. That in turn requires x10 where the problem lies. x10 has a dependency on tensorflow, which requires bazel, which requires the JVM which is not (or at least was not?) available. It should be possible to cross-compile now I believe, which was not possible when I had looked at it. Thanks to the use of CMake, I'd say that if we can get x10 built, the rest should be possible to get through.

The one thing to remember is that although ASi is similar to AArch64, it is merely derived from it, and is not identical. So, although it is possible to use items on ARM64 Linux, that does not immediately translate into ASi support.

compnerd avatar Nov 23 '20 16:11 compnerd