Open stellaraccident opened 2 months ago
For the package builds, do we want to use manylinux?
Dockerfile choices:
You always want to build python packages that will be run on any other os with a many Linux image. It's typically easier to just do that from the get go. I almost always use one that has been forked locally and extended with needed packages.
Can we yank the old shortfin releases (https://pypi.org/project/shortfin/#history) ? That only has version 0.1.dev3, for Python 3 (including pre-3.12).
If I try running python -m pip install shortfin -f https://github.com/ScottTodd/SHARK-Platform/releases/expanded_assets/dev-wheels
from Python 3.10, that gets the stale package, since the new packages are only for Python 3.12 and 3.13.
Can we yank the old shortfin releases (https://pypi.org/project/shortfin/#history) ? That only has version 0.1.dev3, for Python 3 (including pre-3.12).
If I try running
python -m pip install shortfin -f https://github.com/ScottTodd/SHARK-Platform/releases/expanded_assets/dev-wheels
from Python 3.10, that gets the stale package, since the new packages are only for Python 3.12 and 3.13.
Bah, https://peps.python.org/pep-0440/#handling-of-pre-releases
Pre-releases of any kind, including developmental releases, are implicitly excluded from all version specifiers, unless they are already present on the system, explicitly requested by the user, or if the only available version that satisfies the version specifier is a pre-release.
That old 0.1.dev3 pre-release package for https://pypi.org/project/shortfin/ (and similarly for https://pypi.org/project/sharktank/) is making testing new packaging tricky:
shortfin
package is for any Python version, not just 3.12+shortfin
package depends on sharktank
, iree-runtime
, etc.sharktank
package depends on shark-turbine
, which still needs to be migrated to iree-turbine
Brain dump before vacation (could merge these into a single tasklist in the original issue comment):
python -m pip install shortfin -f https://github.com/nod-ai/SHARK-Platform/releases/expanded_assets/dev-wheels
shortfin/examples/python/mobilenet_server
works on my machine as of https://github.com/nod-ai/SHARK-Platform/commit/8e074b45362737787e5ad1d467f0286976490e4f . We'll want more examples and tests for those examples as these packages mature.TODO:
sharktank/setup.py
, as well as .github/workflows/build_packages.yml
setup.py
file and the various projects in scope (iree-compiler
, iree-runtime
, iree-turbine
, sharktank
, shortfin
, etc.)--pre
for prerelease versions. Put less emphasis on installing from source or nightly buildsrequirements.txt
files and README.md
files across https://github.com/nod-ai/SHARK-Platform , focusing on what each individual project needs for development and what the aggregate "platform" needs to be used
Bringing up libshortfin CI and releases
Overall Description
libshortfin is a C++ project providing serving oriented APIs atop the IREE runtime. It aims to supercede prior pure-Python systems that used IREE via its low-level synchronous API. From the get-go, libshortfin is:
Internally, it consists of three primary components:
libshortfin
C++ library (built as both a static and a dynamic library)_shortfin
native Python moduleshortfin
pure Python module (re-exports from the native module and adds higher level Python-only features)Note that we are transitioning to using the containing repository (currently called
sharktank
) as a monorepo for a variety of related model development and serving projects. As such, plan for some organization to the way that venvs/dev setup is done across the repo (and CI, etc).Dependencies
Native deps
libshortfin
currently depends purely on the IREEruntime
C APIs. In the future, it will also expose an interface to the IREE compiler C API via a delay loaded stub, allowing the compiler to be dynamically loaded (same as some other integrations). The compiler will remain an optional dep and pure-inference or deployed systems can leave it off so long as whatever is built onlibshortfin
does not need it (i.e. if pipelines are pre-compiled).libshortfin
currently has the following additional native dependencies:Python deps
shortfin
does not have any Python deps for minimal functionality, but it is expected that a number of deps will be useful for various applications of it, and it may provide features based on these deps in an optional fashion that people can use if helpful/available:Variants
The native
_shortfin.lib
Python package is provided, similar toiree.runtime
, by redirecting at runtime to a concrete native library module based on env flags, allowing the selection of multiple packages runtimes such as "default", "tracy", "assert", etc. As with theiree.runtime
, we expect that our normal wheels will bundle thedefault
andtracy
versions so that users can always use an instrumented build.Dependent Projects
It is intended that both C++ and pure/native Python extensions will be built atop libshortfin, providing application level support for various models, etc.
Moving towards release
There are several steps towards a robust release of the project.
Initial Packaging and CI
Initial Build Work
See the current README for developer quality instructions. This just uses
find_package
for both IREE and other dependencies. Asetup.py
is added that works for development, but it needs to be completed to build a hermetic/production build.This will necessitate supporting CMake options to enable bundled/pinned deps vs relying on find_package. The trickiest of these is IREE itself, and for that we should support two modes:
SHORTFIN_IREE_SOURCE_DIR
set, for example) which will do aadd_subdirectory
on IREE and include it directly in the build.FetchContent
a pinned IREE release in bundled mode and build off of that.These bundling modes can be developed/tested in pure cmake in isolation. Once functional, setup.py can be extended to invoke CMake itself. See IREE runtime/setup.py for inspiration. The result should be that
pip install libshortfin/
works on any reasonably modern Linux and Windows system with no further fuss.There are a few things that should be done at this point:
libshortfin.so
orshortfin-{soname}.dll
and let it be configured (needed for coexistence and dependent extension linking).Initial CI work
CI should be brought up to:
Note that the project is self contained enough that it should build just fine on free linux and windows runners.
Versioning and Releasing
Releasing libshortfin properly will necessitate working out the versioning and releasing policies for some of its related deps (IREE, iree-turbine, sharktank, etc). This may be the end of the road for the nightly builds of those, and we may want to take this chance to come up with a real versioning policy and apply it uniformly to all of the projects. It would be great to have normal pre-releases and regular releases in stable places where everything can be installed by adding one
index-url
(vs the current state where everything is somewhere bespoke with all kinds of-f
flags).We also get requests for conda packages from some in the community, and this would be a good time to enable those.