Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs and samples to use latest iree-turbine. #19054

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 4 additions & 108 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ release process:
* https://pypi.org/project/iree-compiler/
* https://pypi.org/project/iree-runtime/
* https://pypi.org/project/iree-turbine/
* https://pypi.org/project/shark-turbine/ (transitional until switched to
iree-turbine)
* https://pypi.org/project/iree-tools-tf/
* https://pypi.org/project/iree-tools-tflite/

Expand All @@ -101,109 +99,7 @@ Deprecated projects no longer updated:

There are presently two build promotion processes documented:

* Old one focused purely on releasing IREE core packages:
https://iree.dev/developers/general/release-management/
* New one driven by the Torch frontend and documented below.

The versioning scheme for
[iree-turbine](https://github.com/iree-org/iree-turbine) is rooted on the
then-current PyTorch released version, with optional date-based dev/pre-release
suffixes (i.e. `rcYYYYMMDD` or `devYYYYMMDD`) or intra PyTorch releases
(i.e. `postVVVV`).

This process is being trialed to correspond with the 2.3.0 release of PyTorch.
In this scenario, the pinned nightly build of IREE is considered current and
promoted as part of the Turbine release to PyPI (and the release is marked as
not pre-release on the GitHub releases page).

Promotions are done roughly monthly or at need. The schedule is shifted to
account for extra factors as needed.

In the future, we would like to adopt a real versioning scheme (beyond the
nightly calver+build number scheme) and manage promotion and pinning of the
core IREE dep more explicitly and in alignment with how downstreams are using
it.

### Steps to Promote

There are multiple release artifacts that are deployed from this project:

* shark-turbine wheel (transitional while switching to iree-turbine)
* iree-turbine wheel
* iree-compiler wheels
* iree-runtime wheels

Typically we deploy IREE compiler and runtime wheels along with a turbine
release, effectively promoting a nightly.

#### Building Artifacts

Start with a clean clone of iree-turbine:

```
cd scratch
git clone [email protected]:iree-org/iree-turbine.git
cd iree-turbine
```

Build a pre-release:

```
./build_tools/build_release.py --core-version 2.3.0 --core-pre-version=rcYYYYMMDD
```

Build an official release:

```
./build_tools/build_release.py --core-version 2.3.0
```

This will download all deps, including wheels for all supported platforms and
Python versions for iree-compiler and iree-runtime. All wheels will be placed
in the `wheelhouse/` directory.


#### Testing

TODO: Write a script for this.

```
python -m venv wheelhouse/test.venv
source wheelhouse/test.venv/bin/activate
pip install -f wheelhouse iree-turbine[testing]
# Temp: tests require torchvision.
pip install -f wheelhouse torchvision
pytest core/tests
```

#### Push

From the testing venv, verify that everything is sane:

```
pip freeze
```

Push IREE deps (if needed/updated):

```
twine upload wheelhouse/iree_compiler-* wheelhouse/iree_runtime-*
```

Push built wheels:

```
twine upload wheelhouse/iree_turbine-* wheelhouse/shark_turbine-*
```

#### Install from PyPI and Sanity Check

TODO: Script this

From the testing venv:

```
pip uninstall -y shark-turbine iree-turbine iree-compiler iree-runtime
pip install iree-turbine
pytest core/tests
```
* Releasing IREE core packages:
https://iree.dev/developers/general/release-management/
* Releasing iree-turbine packages:
https://github.com/iree-org/iree-turbine/blob/main/docs/releasing.md
12 changes: 6 additions & 6 deletions docs/website/docs/guides/ml-frameworks/pytorch.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ status: new

## :octicons-book-16: Overview

[iree-turbine](https://pypi.org/project/iree-turbine/) (rebrand pending from
"shark-turbine") offers a tight integration between compatible versions of IREE,
[iree-turbine](https://pypi.org/project/iree-turbine/) offers a tight
integration between compatible versions of IREE,
[torch-mlir](https://github.com/llvm/torch-mlir), and
[PyTorch](https://pytorch.org/).

Expand Down Expand Up @@ -193,7 +193,7 @@ graph LR
```python
import iree.runtime as ireert
import numpy as np
import shark_turbine.aot as aot
import iree.turbine.aot as aot
import torch

# Define the `nn.Module` to export.
Expand Down Expand Up @@ -264,15 +264,15 @@ graph LR
```

Advanced export workflows can use the
[`aot.CompiledModule`](https://github.com/iree-org/iree-turbine/tree/main/shark_turbine/aot/compiled_module.py)
[`aot.CompiledModule`](https://github.com/iree-org/iree-turbine/blob/main/iree/turbine/aot/compiled_module.py)
class to define and constrain the structure of a program prior to compiling it.

<!-- TODO(scotttodd): API reference pages for aot.CompiledModule etc.?
https://github.com/iree-org/iree-turbine/issues/77
-->

```python
import shark_turbine.aot as aot
import iree.turbine.aot as aot

# A minimal program, with no functions or variables.
class BasicModule(aot.CompiledModule):
Expand Down Expand Up @@ -339,7 +339,7 @@ models parameters on disk, so that they can be loaded later during runtime.
import torch
from safetensors.torch import save_file
import numpy as np
import shark_turbine.aot as aot
import iree.turbine.aot as aot

class LinearModule(torch.nn.Module):
def __init__(self, in_features, out_features):
Expand Down
Loading
Loading