Skip to content

Commit

Permalink
Switch to a new method of configuring and managing dependencies. (#29)
Browse files Browse the repository at this point in the history
This still has some moving parts to it that have not landed but advances
us a couple of steps in terms of managing dependencies.
  • Loading branch information
Stella Laurenzo authored Apr 7, 2023
1 parent 826a765 commit b30bc54
Show file tree
Hide file tree
Showing 8 changed files with 243 additions and 206 deletions.
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import %workspace%/build_tools/bazel/iree_pjrt.bazelrc
import %workspace%/env.bazelrc

# Import the main IREE bazel configuration.
import %workspace%/external/iree/build_tools/bazel/iree.bazelrc
try-import %workspace%/external/iree/configured.bazelrc
import %workspace%/../iree/build_tools/bazel/iree.bazelrc
import %workspace%/../iree/configured.bazelrc

try-import %workspace%/user.bazelrc
21 changes: 15 additions & 6 deletions .github/workflows/build_smoketest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,26 @@ jobs:
with:
python-version: "3.10" # Needs pybind >= 2.10.1 for Python >= 3.11

- name: Sync and install versions
run: |
# TODO: https://github.com/openxla/openxla-pjrt-plugin/issues/30
sudo apt install -y lld
python ./sync_deps.py
pip install -r requirements.txt
- name: Setup Bazelisk
uses: bazelbuild/setup-bazelisk@v2

- name: "Sync to latest nightly"
run: |
python ./build_tools/sync.py nightly
- name: "Configure bazel"
- name: "Sync and configure"
run: |
CC=clang CXX=clang++ python ./external/iree/configure_bazel.py
python ./configure.py --cc=clang --cxx=clang++ --cuda-sdk-dir=$CUDA_SDK_DIR
- name: "Build CPU plugin"
run: |
bazel build iree/integrations/pjrt/cpu/...
- name: "Test CPU plugin"
run: |
source .env.sh
# TODO: We should be pinning/rolling a jaxlib nightly version.
JAX_PLATFORMS=iree_cpu python test/test_simple.py
24 changes: 7 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,28 @@ most powerful).

## Setup options

The below presumes that you have a compatible Jax/Jaxlib installed. Since
PJRT plugin support is moving fast, it is rare that released versions are
The below presumes that you have a compatible Jax/Jaxlib installed. Since
PJRT plugin support is moving fast, it is rare that released versions are
appropriate. See ["Building Jax from Source"](#building-jax-from-source) below.

### Option 1: Synchronize to a nightly IREE release

This will install compiler binaries from IREE's nightly releases and will then
sync a local clone of IREE's runtime to the same commit used to build the
compiler. This is the easiest way to work on pure-runtime/plugin features and
involves building the least.

```
# Run at any time to sync to the then-current nightly.
python build_tools/sync.py nightly
python ./sync_deps.py
pip install -U -r requirements.txt
python ./configure.py --cc=clang --cxx=clang++ --cuda-sdk-dir=$CUDA_SDK_DIR
# Source environment variables to run interactively.
# The above generates a .env and .env.sh file with key setup vars.
source .env.sh
# Replace with actual compiler binaries if multiple.
CC=clang CXX=clang++ python external/iree/configure_bazel.py
# Configure path to CUDA SDK (for building CUDA plugin).
# Replace $CUDA_SDK_DIR as appropriate.
echo "build --action_env IREE_CUDA_DEPS_DIR=$CUDA_SDK_DIR" > user.bazelrc
# Build.
bazel build iree/integrations/pjrt/...
# Run a sample.
# Note that there can be version incompatibilities between jaxlib nightlies
pip install -e ../jax
JAX_PLATFORMS=iree_cpu python test/test_simple.py
JAX_PLATFORMS=iree_cuda python test/test_simple.py
```
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

local_repository(
name = "xla",
path = "external/xla",
path = "../xla",
)

local_repository(
name = "iree_core",
path = "external/iree",
path = "../iree",
)

# Import all of the xla dependencies.
Expand Down Expand Up @@ -42,7 +42,7 @@ load("@iree_core//build_tools/bazel:workspace.bzl", "configure_iree_submodule_de
# TODO: Path hard-coding is... not great. Oh bazel.
configure_iree_submodule_deps(
iree_repo_alias = "@iree_core",
iree_path = "external/iree",
iree_path = "../iree",
)

configure_iree_cuda_deps()
178 changes: 0 additions & 178 deletions build_tools/sync.py

This file was deleted.

Loading

0 comments on commit b30bc54

Please sign in to comment.