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

iree submodule #733

Merged
merged 11 commits into from
Sep 2, 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
24 changes: 16 additions & 8 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,29 @@ jobs:
run: |
/gitmirror/scripts/trigger_update_mirrors.sh
/gitmirror/scripts/git_config.sh
- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: recursive

- name: "Checking out repository"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
REPO_ADDRESS: ${{ github.server_url }}/${{ github.repository }}
run: |
# TODO : investigate warning: --depth is ignored in local clones; use file:// instead
git \
-c submodule."third_party/torch-mlir".update=none \
-c submodule."third_party/stablehlo".update=none \
-c submodule."src/runtime_src/core/common/aiebu".update=none \
clone \
--recursive \
--shallow-submodules \
--depth 1 \
-b $BRANCH_NAME $REPO_ADDRESS .

- name: Install deps
run: |
dnf install -y almalinux-release-devel epel-release
yum remove -y openssl-devel zlib-devel || true
yum install -y protobuf-devel protobuf-compiler tmate

- name: Sync source deps
run: |
python ./sync_deps.py

- name: Python deps
run: |
pip install "numpy<2" pyyaml "pybind11[global]==2.10.3" nanobind
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,19 @@ jobs:
timezoneWindows: "Singapore Standard Time"

- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: recursive
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
REPO_ADDRESS: ${{ github.server_url }}/${{ github.repository }}
run: |
git \
-c submodule."third_party/torch-mlir".update=none \
-c submodule."third_party/stablehlo".update=none \
-c submodule."src/runtime_src/core/common/aiebu".update=none \
clone \
--recursive \
--shallow-submodules \
--depth 1 \
-b $BRANCH_NAME $REPO_ADDRESS .

- uses: actions/setup-python@v4
with:
Expand All @@ -57,10 +67,6 @@ jobs:
run: |
brew install ccache ninja

- name: Sync source deps
run: |
python ./sync_deps.py

- name: Python deps
run: |
pip install "numpy<2" pyyaml "pybind11[global]==2.10.3" nanobind
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,19 @@ jobs:
timezoneWindows: "Singapore Standard Time"

- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: recursive
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
REPO_ADDRESS: ${{ github.server_url }}/${{ github.repository }}
run: |
git \
-c submodule."third_party/torch-mlir".update=none \
-c submodule."third_party/stablehlo".update=none \
-c submodule."src/runtime_src/core/common/aiebu".update=none \
clone \
--recursive \
--shallow-submodules \
--depth 1 \
-b $BRANCH_NAME $REPO_ADDRESS .

- name: Setup Cpp
uses: aminya/setup-cpp@v1
Expand All @@ -65,10 +75,6 @@ jobs:
with:
python-version: '3.11'

- name: Sync source deps
run: |
python ./sync_deps.py

- name: Python deps
run: |
pip install "numpy<2" pyyaml "pybind11[global]==2.10.3" nanobind
Expand Down
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@
[submodule "third_party/openssl"]
path = third_party/openssl
url = https://github.com/viaduck/openssl-cmake.git
shallow = true
[submodule "third_party/iree"]
path = third_party/iree
url = https://github.com/iree-org/iree.git
shallow = true
68 changes: 45 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,47 @@ interfacing the AMD AIE accelerator to IREE.

## Developer Setup

These instructions assume that you have an appropriate IREE checkout side by side
with this repository have an IREE build setup in an `iree-build` directory that
is also a sibling. This is not a requirement, but instructions will need to be
changed for different paths.
**Strong recommendation**: check the CI scripts @ [.github/workflows](.github/workflows) - they do a fresh/clean
checkout and build and are exercised on every commit and are written such that they're simple enough to be read
by a non-CI expert.

Preparing repository:
### Getting the repository:

Either

```
# ssh
git clone --recursive [email protected]:nod-ai/iree-amd-aie.git
# https
git clone --recursive https://github.com/nod-ai/iree-amd-aie.git
```

or if you want a faster checkout

```
git submodule update --init
git \
-c submodule."third_party/torch-mlir".update=none \
-c submodule."third_party/stablehlo".update=none \
-c submodule."src/runtime_src/core/common/aiebu".update=none \
clone \
--recursive \
--depth 1 \
--shallow-submodules \
https://github.com/nod-ai/iree-amd-aie.git
```

which has the effect of not cloning entire repo histories and skipping nested submodules that we currently do not need.

## Building (along with IREE)

### Just show me the CMake

From the checkout of the repo:

```
cmake -B $WHERE_YOU_WOULD_LIKE_TO_BUILD -S $IREE_REPO_SRC_DIR \
-DIREE_CMAKE_PLUGIN_PATHS=$IREE_AMD_AIE_REPO_SRC_DIR -DIREE_BUILD_PYTHON_BINDINGS=ON \
cd iree-amd-aie
cmake -B $WHERE_YOU_WOULD_LIKE_TO_BUILD -S third_party/iree \
makslevental marked this conversation as resolved.
Show resolved Hide resolved
-DIREE_CMAKE_PLUGIN_PATHS=$PWD -DIREE_BUILD_PYTHON_BINDINGS=ON \
-DIREE_INPUT_STABLEHLO=OFF -DIREE_INPUT_TORCH=OFF -DIREE_INPUT_TOSA=OFF \
-DIREE_HAL_DRIVER_DEFAULTS=OFF -DIREE_TARGET_BACKEND_DEFAULTS=OFF -DIREE_TARGET_BACKEND_LLVM_CPU=ON \
-DIREE_BUILD_TESTS=ON -DIREE_EXTERNAL_HAL_DRIVERS=xrt \
Expand All @@ -40,19 +63,15 @@ cmake -B $WHERE_YOU_WOULD_LIKE_TO_BUILD -S $IREE_REPO_SRC_DIR \

### Instructions

To pin IREE and its submodules (LLVM, etc) to commits which are compatible
with this plugin, run

```
python3 sync_deps.py
```

from within the iree-amd-aie root directory. Then the bare minimum CMake configure command is
The bare minimum CMake configure command is

```
cd ../iree-build
cmake -DIREE_BUILD_PYTHON_BINDINGS=ON -DIREE_CMAKE_PLUGIN_PATHS=$PWD/../iree-amd-aie .
ninja
cmake \
-B $WHERE_YOU_WOULD_LIKE_TO_BUILD \
-S $IREE_REPO_SRC_DIR \
-DIREE_CMAKE_PLUGIN_PATHS=$IREE_AMD_AIE_REPO_SRC_DIR \
-DIREE_BUILD_PYTHON_BINDINGS=ON
cmake --build $WHERE_YOU_WOULD_LIKE_TO_BUILD
```

to build IREE with amd-aie plugin. Very likely, you will want to use `ccache` and `lld` (or some other modern linker like [mold](https://github.com/rui314/mold))
Expand Down Expand Up @@ -95,10 +114,13 @@ ctest -R amd-aie
To enable the runtime driver, you need to also enable the XRT HAL:

```
cd ../iree-build
cmake . -DIREE_CMAKE_PLUGIN_PATHS=../iree-amd-aie \
-DIREE_EXTERNAL_HAL_DRIVERS=xrt
ninja
cmake \
-B $WHERE_YOU_WOULD_LIKE_TO_BUILD \
-S $IREE_REPO_SRC_DIR \
-DIREE_CMAKE_PLUGIN_PATHS=$IREE_AMD_AIE_REPO_SRC_DIR \
-DIREE_BUILD_PYTHON_BINDINGS=ON \
-DIREE_EXTERNAL_HAL_DRIVERS=xrt
cmake --build $WHERE_YOU_WOULD_LIKE_TO_BUILD
```

### Ubuntu Dependencies
Expand Down
2 changes: 1 addition & 1 deletion build_tools/ci/build_test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eux -o errtrace

this_dir="$(cd $(dirname $0) && pwd)"
repo_root="$(cd $this_dir/../.. && pwd)"
iree_dir="$(cd $repo_root/../iree && pwd)"
iree_dir="$(cd $repo_root/third_party/iree && pwd)"
build_dir="$repo_root/iree-build"
install_dir="$repo_root/iree-install"
mkdir -p "$build_dir"
Expand Down
122 changes: 0 additions & 122 deletions sync_deps.py

This file was deleted.

1 change: 1 addition & 0 deletions third_party/iree
Submodule iree added at 60b65f
Loading