Add release step to build iree_jax package. (#6217)
* This is the first pure python package and thus warrants its own build step.
* It only runs on Linux since platform independent.
diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml
index 36adfc6..3e49646 100644
--- a/.github/workflows/build_package.yml
+++ b/.github/workflows/build_package.yml
@@ -47,6 +47,10 @@
- os: ubuntu-18.04
build_package: py-tf-compiler-tools-pkg
experimental: false
+ # Only needs to be built on Linux because platform independent.
+ - os: ubuntu-18.04
+ build_package: py-pure-pkgs
+ experimental: true
# Windows packages.
- os: windows-2019
@@ -166,7 +170,6 @@
if: "matrix.build_package == 'py-runtime-pkg'"
shell: bash
run: |
- # Just need to build for one examplar python3 variant.
package_dir="./iree-install/python_packages/iree_runtime"
export CIBW_BEFORE_BUILD="python ./main_checkout/build_tools/github_actions/build_dist.py py-runtime-pkg"
# TODO: cibuildwheel sanity checks this, but our setup.py is the
@@ -174,6 +177,24 @@
mkdir -p $package_dir && touch $package_dir/setup.py
python -m cibuildwheel --output-dir bindist $package_dir
+ # Pure python packages only need to do a minimal CMake configure and no
+ # actual building, aside from setting up sources. If there are multiples,
+ # it is fairly cheap to build them serially. Using cibuildwheel is a bit
+ # overkill for this, but we keep it the same as the others for maintenance
+ # value.
+ - name: Build pure python wheels
+ if: "matrix.build_package == 'py-pure-pkgs'"
+ shell: bash
+ run: |
+ # Just need to build for one examplar python3 variant.
+ export CIBW_BUILD="cp38-*"
+ package_dir="./iree-install/python_packages/iree_jax"
+ export CIBW_BEFORE_BUILD="python ./main_checkout/build_tools/github_actions/build_dist.py py-pure-pkgs"
+ # TODO: cibuildwheel sanity checks this, but our setup.py is the
+ # *output* of the build :( Make source packages.
+ mkdir -p $package_dir && touch $package_dir/setup.py
+ python -m cibuildwheel --output-dir bindist $package_dir
+
# Compiler tools wheels are not python version specific, so just build
# for one examplar python version.
- name: Build XLA Compiler Tools wheels
diff --git a/build_tools/github_actions/build_dist.py b/build_tools/github_actions/build_dist.py
index 4ef29ba..f346f5b 100644
--- a/build_tools/github_actions/build_dist.py
+++ b/build_tools/github_actions/build_dist.py
@@ -39,6 +39,7 @@
python ./main_checkout/build_tools/github_actions/build_dist.py main-dist
python ./main_checkout/build_tools/github_actions/build_dist.py py-runtime-pkg
+ python ./main_checkout/build_tools/github_actions/build_dist.py py-pure-pkgs
python ./main_checkout/build_tools/github_actions/build_dist.py py-xla-compiler-tools-pkg
python ./main_checkout/build_tools/github_actions/build_dist.py py-tflite-compiler-tools-pkg
python ./main_checkout/build_tools/github_actions/build_dist.py py-tf-compiler-tools-pkg
@@ -116,8 +117,11 @@
def build_main_dist():
"""Builds the main distribution binaries.
- Also builds the iree-install/python_packages/iree_compiler package, ready
- for wheel building.
+ Also builds python packages associated with the full distribution:
+ - iree-install/python_packages/iree_compiler
+
+ Additional packages that are installable as part of a full build and do not
+ benefit from a more restricted build can be added here.
"""
install_python_requirements()
@@ -167,6 +171,48 @@
tf.add(os.path.join(INSTALL_DIR, entry), arcname=entry, recursive=True)
+def build_py_pure_pkgs():
+ """Performs a minimal build sufficient to produce pure python packages.
+
+ This installs the following packages:
+ - iree-install/python_packages/iree_jax
+
+ Since these are pure python packages, it is expected that they will be built
+ on a single examplar (i.e. Linux) distribution.
+ """
+ install_python_requirements()
+
+ # Clean up install and build trees.
+ shutil.rmtree(INSTALL_DIR, ignore_errors=True)
+ remove_cmake_cache()
+
+ # CMake configure.
+ print("*** Configuring ***")
+ subprocess.run([
+ sys.executable,
+ CMAKE_CI_SCRIPT,
+ f"-B{BUILD_DIR}",
+ f"-DCMAKE_INSTALL_PREFIX={INSTALL_DIR}",
+ f"-DCMAKE_BUILD_TYPE=Release",
+ f"-DIREE_BUILD_COMPILER=OFF",
+ f"-DIREE_BUILD_PYTHON_BINDINGS=ON",
+ f"-DIREE_BUILD_SAMPLES=OFF",
+ f"-DIREE_BUILD_TESTS=OFF",
+ ],
+ check=True)
+
+ print("*** Building ***")
+ subprocess.run([
+ sys.executable,
+ CMAKE_CI_SCRIPT,
+ "--build",
+ BUILD_DIR,
+ "--target",
+ "install-IreePythonPackage-jax",
+ ],
+ check=True)
+
+
def build_py_runtime_pkg():
"""Builds the iree-install/python_packages/iree_runtime package.
@@ -362,6 +408,8 @@
build_main_dist()
elif command == "py-runtime-pkg":
build_py_runtime_pkg()
+elif command == "py-pure-pkgs":
+ build_py_pure_pkgs()
elif command == "py-xla-compiler-tools-pkg":
build_py_xla_compiler_tools_pkg()
elif command == "py-tflite-compiler-tools-pkg":