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

[RFC] New versioning scheme for IREE Python packages #18938

Open
marbre opened this issue Oct 29, 2024 · 6 comments
Open

[RFC] New versioning scheme for IREE Python packages #18938

marbre opened this issue Oct 29, 2024 · 6 comments
Labels
discussion Proposals, open-ended questions, etc infrastructure Relating to build systems, CI, or testing

Comments

@marbre
Copy link
Member

marbre commented Oct 29, 2024

Summary

Our pre-compiled software is currently made publicly available using different versioning schemes. We're proposing a new versioning scheme to remedy this situation to which downstream packages depending on IREE can easily adopt.

This affects these packages:

Here are examples of the new versions we propose:

Type of build Version format Version example
Stable release (PyPI) X.Y.Z 3.0.0
Nightly release (GitHub schedule) X.Y.ZrcYYYYMMDD 3.0.1rc20241029
Dev release (GitHub pull_request) X.Y.Z.devNN 3.0.1.dev50
Local build X.Y.Z.dev 3.0.1.dev

Key

Identifier Explanation
X Major version
Y Minor version
Z Patch version
rc release candidate (main branch)
dev developer build (code on pull request branches)
YYYY Year, e.g. 2024
MM Month, e.g. 10
DD Day, e.g. 29
NN Build number (increasing ID from GitHub per workflow), e.g. 50

Background

Currently CalVer is used for releasing iree-compiler and iree-runtime whereas iree-turbine utilizes a version number in the format of X.Y.Z. Therefore, compatible versions cannot be derived from the version number. A common versioning scheme would be SemVer, but as the MAJOR version must be increased when incompatible API changes are introduced a cross-project version number (primarily a shared MAJOR version) cannot be guaranteed if APIs are not identical. Switching to a non-CalVer scheme requires a package rename as the first release segment would otherwise need to be set to a number larger than 20240928, e.g. 30000000, or to introduce an N! epoch segment which however is not a convenient solution, see Python version epochs are broken.

Detailed proposal

A shared version format is proposed for the packages

  • iree-base-compiler (formally named iree-compiler)
  • iree-base-runtime (formally named iree-runtime)
  • iree-turbine

Major or minor releases are published every 6 weeks for all packages uniformly. Based on logistics and/or practical engineering issues, releases may be delayed or deferred as needed. Patch versions for individual packages can be published outside of that cycle as needed.

A release number is in the format of X.Y.Z (MAJOR.MAJOR.PATCH).

  • X and Y are defined as shared version numbers between all packages.
  • The patch level Z MAY be incremented individually.
  • A PATCH release contains only bug fixes and the version Z (x.y.Z) MUST be incremented. A bug fix is an internal change that fixes incorrect behavior and MUST NOT introduce breaking changes.
  • A MINOR release (unlike SemVer) as well as a MAJOR release MAY contain backwards-incompatible, breaking changes, like API changes and removals and furthermore bug fixes and new features.

Development and nightly releases:

  • Development builds (e.g. from a regular CI) MUST be released with a version number defined as X.Y.Z.devN, where N is a build number.
  • Nightly releases MUST be released with a version number defined as X.Y.ZrcYYYYMMDD.
  • The intent is to promote a recent, high quality release candidate to a final version. Binary stamps and tools will continue to report the original release candidate version.

The following semantics apply:

  • If the version X (X.y.z) is increased for one package, the version number change MUST be adopted by all (other) packages. The same applies for the version Y (x.Y.Z).
  • If the version X or Y are changed, Z MUST be set 0.
  • After a release, either Y or Z MUST be increased to ensure precedence of nightly builds.
    For example:
    • The latest stable release published on November 15th 2024 is versioned as version 3.0.0.
    • The next nightly builds are released as 3.0.1rc20241116 or 3.1.0rc20241116.
    • The next stable release is released as 3.0.1 or 3.1.0.

Additional version information

With switching from CalVer to the proposed versioning scheme, the build date is not encoded in the version number any longer. However, additional information is provided by --version, e.g. iree-compile --version gives:

IREE (https://iree.dev):
  IREE compiler version 20240730.970 @ d39c3c56682e006e842b32aa6f38c272f77c8f3c
  LLVM version 20.0.0git
  Optimized build

which can be extended by the build date.

Implementation plan

Each project will have a version_info.json file containing the latest X.Y.Z version. Local, pull request, and nightly builds will read from this file and append their own suffixes to it. When a new release is promoted to PyPI from a nightly release, a script will be used to edit the embedded version, removing any rcYYYYMMDD suffix and then we will upgrade the version in each version_info.json file so future builds will use new versions. The new releases will start at version 3.0.0, since iree-turbine is currently 2.4.1.

Timeline

We would like to begin implementation work soon and have this completed within ~2 weeks.

@ScottTodd ScottTodd added infrastructure Relating to build systems, CI, or testing discussion Proposals, open-ended questions, etc labels Oct 29, 2024
@ScottTodd
Copy link
Member

Highlighting an important detail that could be missed: with these version changes, existing workflows that use

python -m pip install iree-compiler iree-runtime

will need to be replaced with new packages

python -m pip install iree-base-compiler iree-base-runtime

Simply switching the version scheme on the existing packages would require starting with a version greater than the existing calver (20240828), or using Python version epochs, which are broken.

After rolling out the initial releases for each package, we can also explore ergonomics improvements like functional or meta packages that themselves depend on both "base" packages, so users can install a single project or the individual packages if they want precise control.

We can also publish tombstone package releases to the iree-compiler and iree-runtime projects that warn about the name change and maybe eventually (after years?) remove the old names/packages entirely.

marbre added a commit to marbre/iree that referenced this issue Nov 4, 2024
This implements the new versioning scheme proposed with iree-org#18938. For the
compiler, the runtime, the TF compiler tools and the TFLite compiler
tools, `version_info.json` files to allow to set the patch level
individually for each package. Furthermore, a `version_info.json` is
added at root level to have a common version for a (future) meta
package, now mainly used to determine the tag when publishing release
candidates. This file might be moved in future and additional,
per-package tags might be added.
marbre added a commit to marbre/iree that referenced this issue Nov 4, 2024
This implements the new versioning scheme proposed with iree-org#18938. For the
compiler, the runtime, the TF compiler tools and the TFLite compiler
tools, `version_info.json` files to allow to set the patch level
individually for each package. Furthermore, a `version_info.json` is
added at root level to have a common version for a (future) meta
package, now mainly used to determine the tag when publishing release
candidates. This file might be moved in future and additional,
per-package tags might be added.
marbre added a commit to marbre/iree that referenced this issue Nov 4, 2024
This implements the new versioning scheme proposed with iree-org#18938. For the
compiler, the runtime, the TF compiler tools and the TFLite compiler
tools, `version_info.json` files to allow to set the patch level
individually for each package. Furthermore, a `version_info.json` is
added at root level to have a common version for a (future) meta
package, now mainly used to determine the tag when publishing release
candidates. This file might be moved in future and additional,
per-package tags might be added.
marbre added a commit to marbre/iree that referenced this issue Nov 4, 2024
This implements the new versioning scheme proposed with iree-org#18938. For the
compiler, the runtime, the TF compiler tools and the TFLite compiler
tools, `version_info.json` files to allow to set the patch level
individually for each package. Furthermore, a `version_info.json` is
added at root level to have a common version for a (future) meta
package, now mainly used to determine the tag when publishing release
candidates. This file might be moved in future and additional,
per-package tags might be added.
@ScottTodd
Copy link
Member

One open question is where we'll publish nightly releases to.

We currently push a new release every night to https://github.com/iree-org/iree/releases and a release index to https://iree.dev/pip-release-links.html using this script: https://github.com/iree-org/iree/blob/main/build_tools/scripts/generate_release_index.py . We could switch to a single "dev-wheels" release like https://github.com/nod-ai/SHARK-Platform/releases/tag/dev-wheels with a release index generated for us by GitHub like https://github.com/nod-ai/SHARK-Platform/releases/expanded_assets/dev-wheels .

Even if we rename the packages to iree-base-runtime and iree-base-compiler, we should be able to continue using the current system. Maybe as a future refactoring we can switch to the single release style.

Eventually we could also push nightly / pre-release versions of packages to pypi so users can just pass --pre instead of -f, --find-links <url>.

@stellaraccident
Copy link
Collaborator

Whatever helps you get bootstrapped. These things usually require a cascade of changes. But it would be good to get off of the old way. It's long in the tooth and creates a ton of tag spam.

If building a new index scraper, we probably want it to scrape all of the dev wheel locations across the projects and make one consolidated index file.

marbre added a commit to marbre/iree that referenced this issue Nov 5, 2024
This implements a new versioning scheme, similar to the one recently
proposed with iree-org#18938 and applies it to `iree-compiler`, `iree-runtime`
and the `iree-dist` tarball. The TF and TFLite compiler tools use the
(legacy) versioning and need to be updated with a follow up commit. The
common version number is determined based on the versions of the
compiler and the runtime and the higher version is picked as the common
on. In contrast to the proposed versioning scheme, version numbers of
development releases are in the format `X.Y.Z.dev0+${gitcommithash}` as
discussed in iree-org#19003 and not `X.Y.Z.dev` as originally proposed.

Not yet addressed is the refactoring of the workflows thus that the
`version-local.json` files get only written once (and not for every OS)
and to provide then to subsequent steps as artifacts.
ScottTodd added a commit to iree-org/iree-turbine that referenced this issue Nov 6, 2024
This release was just promoted to stable:
https://github.com/iree-org/iree/releases/tag/candidate-20241104.1068.
As we align the versions across projects
(iree-org/iree#18938), we should aim to use
stable versions or at least test nightly versions with care.
@ScottTodd
Copy link
Member

Oh, I just found / re-remembered that iree-turbine versioning is intended to be based on PyTorch versions. I presume we're departing from that now, but using the existing 2.* versions as a starting point for our new 3.* versions across all packages?

The versioning scheme for 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).

I just pushed iree-turbine version 2.5.0 (https://github.com/iree-org/iree-turbine/releases/tag/v2.5.0), which I guess we could say coincides with PyTorch 2.5.0 (https://github.com/pytorch/pytorch/releases/tag/v2.5.0), but that's mostly a coincidence.

We could also have iree-turbine keep tracking PyTorch versions and instead start the iree-base-compiler/iree-base-runtime versions at 1.0.0. I do like taking this opportunity to use a common version scheme across all of our packages, diverging from external projects like PyTorch.

@ScottTodd
Copy link
Member

That quote is from https://github.com/iree-org/iree/blob/main/RELEASING.md , which also then has this section:

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.

ScottTodd added a commit that referenced this issue Nov 7, 2024
This adapts docs and samples to
https://github.com/iree-org/iree-turbine/releases/tag/v2.5.0.

* Switched from `import shark_turbine.aot as aot` to `import
iree.turbine.aot as aot` (see also
iree-org/iree-turbine#28).
* Redirected notes from `/RELEASING.md` to
https://github.com/iree-org/iree-turbine/blob/main/docs/releasing.md.
The release process is changing now with
#18938 and I'll want to fold the
notes there in to
https://iree.dev/developers/general/release-management/ instead.
* Re-ran some Colab notebooks and adapted to the latest changes across
projects. Note that the
https://github.com/iree-org/iree/tree/main/samples/dynamic_shapes sample
still has code using `@aot.jittable`, so I have re-opened
#18564 to migrate it. I spent
some time trying to update it but wasn't sure how to demonstrate dynamic
shapes using the "modern canonical usage" effectively.
* This fixes the recent test failures:
https://github.com/iree-org/iree/actions/runs/11697207429/job/32575551934.
Test run:
https://github.com/ScottTodd/iree/actions/runs/11713816651/job/32627295562
marbre added a commit that referenced this issue Nov 7, 2024
This implements a new versioning scheme, similar to the one recently
proposed with #18938 and applies it to `iree-compiler`, `iree-runtime`
and the `iree-dist` tarball. The TF and TFLite compiler tools use the
(legacy) versioning and need to be updated with a follow up commit. The
common version number is determined based on the versions of the
compiler and the runtime and the higher version is picked as the common
on. In contrast to the proposed versioning scheme, version numbers of
development releases are in the format `X.Y.Z.dev+${gitcommithash}` as
discussed in #19003 and not `X.Y.Z.dev` as originally proposed.
@ScottTodd
Copy link
Member

We are starting to roll out the new versions and package names now. Hoping to have nightly releases of iree-base-compiler and iree-base-runtime tonight, then packages on PyPI tonight or tomorrow.

ScottTodd pushed a commit that referenced this issue Nov 7, 2024
As part of applying the new versioning scheme proposed with #18938, this
renames the Python packages `iree-compiler` to `iree-base-compiler` and
`iree-runtime` to `iree-base-runtime`.
JamesMBartlett pushed a commit to gimletlabs/iree that referenced this issue Nov 8, 2024
This adapts docs and samples to
https://github.com/iree-org/iree-turbine/releases/tag/v2.5.0.

* Switched from `import shark_turbine.aot as aot` to `import
iree.turbine.aot as aot` (see also
iree-org/iree-turbine#28).
* Redirected notes from `/RELEASING.md` to
https://github.com/iree-org/iree-turbine/blob/main/docs/releasing.md.
The release process is changing now with
iree-org#18938 and I'll want to fold the
notes there in to
https://iree.dev/developers/general/release-management/ instead.
* Re-ran some Colab notebooks and adapted to the latest changes across
projects. Note that the
https://github.com/iree-org/iree/tree/main/samples/dynamic_shapes sample
still has code using `@aot.jittable`, so I have re-opened
iree-org#18564 to migrate it. I spent
some time trying to update it but wasn't sure how to demonstrate dynamic
shapes using the "modern canonical usage" effectively.
* This fixes the recent test failures:
https://github.com/iree-org/iree/actions/runs/11697207429/job/32575551934.
Test run:
https://github.com/ScottTodd/iree/actions/runs/11713816651/job/32627295562
marbre pushed a commit to nod-ai/SHARK-Platform that referenced this issue Nov 8, 2024
IREE is renaming its Python packages from `iree-compiler` and
`iree-runtime` to `iree-base-compiler` and `iree-base-runtime`, in order
to switch to a new versioning scheme:
iree-org/iree#18938. This switches to using
the new package names and versions and cleans up some related
documentation along the way.
ScottTodd added a commit that referenced this issue Nov 8, 2024
This is part of rolling out the new versioning scheme proposed at
#18938.

During publishing to PyPI with the existing
`build_tools/python_deploy/pypi_deploy.sh` script, this converts
"nightly" packages with versions like `X.Y.ZrcYYYYMMDD` to "stable"
packages with versions like `X.Y.Z`.
* The version change is performed by
https://pypi.org/project/change-wheel-version/ (source here:
https://github.com/hauntsaninja/change_wheel_version/blob/master/change_wheel_version.py),
which handles editing package versions and renaming files.
* Note that binary tools like `iree-compile` still have versions stamped
in them that this is **not** modifying.

Test logs (on a draft release, with the upload step commented out):
https://gist.github.com/ScottTodd/e7342a7be9c1c4eb093e6d31bd9cebef
ScottTodd added a commit to iree-org/iree-turbine that referenced this issue Nov 9, 2024
IREE is renaming its Python packages from `iree-compiler` and
`iree-runtime` to `iree-base-compiler` and `iree-base-runtime`, in order
to switch to a new versioning scheme:
iree-org/iree#18938. This switches to using
the new package names and versions and cleans up some related
documentation along the way.

Note: the new packages are not yet built and published, hence this is a
draft PR. Once packages are published we can rebase, test this, and then
proceed.
ScottTodd added a commit that referenced this issue Nov 9, 2024
A release was published today:
* https://pypi.org/project/iree-base-compiler/2.9.0/
* https://pypi.org/project/iree-base-runtime/2.9.0/
* https://github.com/iree-org/iree/releases/tag/iree-2.9.0rc20241108

We're still figuring out the procedure for these new version updates,
but #18938 does at least say:

> After a release, either Y or Z MUST be increased to ensure precedence
of nightly builds.

We can decide next week if we want to start by updating the minor
version instead of the patch version that I updated here.
marbre added a commit to marbre/iree that referenced this issue Nov 12, 2024
This documents the versioning scheme proposed with iree-org#18938, refined as
part of the discussion iree-org#19003 (first drafted patch) and iree-org#19034 (second
drafted patch) and applied with commit 6d55a11.
marbre added a commit to marbre/iree that referenced this issue Nov 12, 2024
This documents the versioning scheme proposed with iree-org#18938, refined as
part of the discussion iree-org#19003 (first drafted patch) and iree-org#19034 (second
drafted patch) and applied with commit 6d55a11.
ScottTodd added a commit that referenced this issue Nov 14, 2024
Progress on #18938.

Pip will only install "pre-release" versions if `--pre` is set or the
version is set explicitly:
https://pip.pypa.io/en/stable/cli/pip_install/#pre-release-versions. The
`rc` part of our `rcYYYYMMDD` suffix used in the nightly packages is
considered a "Pre-release segment" in the version string:
https://packaging.python.org/en/latest/specifications/version-specifiers/#public-version-identifiers.

Also switched sample Colab notebooks to use the new package names. I
tested these lightly, but did not fully regenerate them, so the embedded
logs still reference old versions of packages:
* Manually ran a few notebooks from my branch like
https://colab.research.google.com/github/ScottTodd/iree/blob/release-pre/samples/colab/tensorflow_edge_detection.ipynb
* Ran the 'samples' workflow on my fork:
https://github.com/ScottTodd/iree/actions/runs/11828250281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Proposals, open-ended questions, etc infrastructure Relating to build systems, CI, or testing
Projects
None yet
Development

No branches or pull requests

3 participants