Swifts C++ interoperability #3549
Replies: 3 comments 6 replies
-
I'm interested in replacing Obj-c with Swift, but will definitely need an initial implementation on top of which we can build. I don't have enough experience to do it myself. If is is simple enough and covers everything that we currently have, I will be fine to switch to Swift |
Beta Was this translation helpful? Give feedback.
-
Is there any reason to not use the C++ bindings instead? https://developer.apple.com/metal/cpp/ |
Beta Was this translation helpful? Give feedback.
-
Swift/C++ interoperability is still new, somewhat experimental, and the compilation is slow. I have been experimenting with the interop feature with llama.cpp, and though it works, it's not pleasant. Many C++ types do not bridge well/at all, templates are useless, and you end up having to write a bunch of bridging code anyways. There are too many unknowns as far as compatibility until the feature matures. I would recommend exposing an ObjC++ interface over the current C interface to better support Swift users. As it stands, there are already a number of missing features not exposed in the llama.cpp C interface that Swift users cannot reasonably interact with. |
Beta Was this translation helpful? Give feedback.
-
Bidirectional C++ interoperability has been added in Swift 5.9/Xcode 15.
I would like to gather thoughts and points that speak for or against a conversion of
ggml-metal.m
toggml-metal.swift
.Or maybe someone already started to work on this or notice some limits or blockers?
Beta Was this translation helpful? Give feedback.
All reactions