Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

[WIP] Proof-of-concept integration of pure swift model into TuriCreate #2878

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hoytak
Copy link
Collaborator

@hoytak hoytak commented Dec 24, 2019

This PR adds an XCode project that demonstrates how to effectively write a swift ML model while allowing it to be called from C++ or python.

The key idea is to expose the swift class to objective-C (add @objc
modifier), then write a simple Objective-C++ class that is registered
using the new model registration mechanism.  The type convesion is handled by
overloading the variant_type converter to handle native Objective-C
types.

See src/xcode_swift_toolkit/TC_Swift_Demo/TC_Swift_Demo.xcodeproj for a
proof of concept.

Hoyt Koepke added 6 commits December 21, 2019 16:26
This class proposes a new method for managing extensions.  It is meant
to replace the bulky and unweildy macro system in use currently.

The new code is contained in model_server_v2.
Rearchitecture of the the build system.  A vast simplification.

Changes
- ./configure can produce an XCode project of the Turi source code.
- deps/ can be compiled and installed out of the regular build process.
  Helpful for the XCode project.
- All packages in src/external/ and src/visualization compile into static
  libraries.
- The rest of the code base compiles into a single shared library.  This
  means that most everything occurs in one single CMakeLists.txt file
  using standard cmake commands.
- All headers are installed into targets/include when `make install` is
  called.  The main library is installed into targets/lib.
- The code definitions that reflect compiler oddities (e.g.
  is std::hash<int128_t> defined) are dumped into a single header file,
  src/turi_common.h.  All source files and headers include this file
  first.  This allows other programs to link against this library /
  headers reliably.
- The python part of TuriCreate now builds through the standard
  setup.py method. Cython / pybind11 extensions are compiled and
  packaged using the standard extensions mechanisms and linking against
  the installed Turi headers.

WIP TODO: the python installation, deployment.
This adds an XCode project that demonstrates how to effectively write a
swift ML model while allowing it to be called from C++ or python.

The key idea is to expose the swift class to objective-C (add @objc
modifier), then write a simple Objective-C++ class that is registered
using the new model registration mechanism.  The type convesion is handled by
overloading the variant_type converter to handle native Objective-C
types.

See src/xcode_swift_toolkit/TC_Swift_Demo/TC_Swift_Demo.xcodeproj for a
proof of concept.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant