Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nod-ai/iree-amd-aie
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8c42d2a47cfc76ff71477b104c67dbd0424abe44
Choose a base ref
..
head repository: nod-ai/iree-amd-aie
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1f2c6289f47adac29da47bab177dfe571895424e
Choose a head ref
Showing with 616 additions and 496 deletions.
  1. +12 −22 .github/workflows/ci-linux.yml
  2. +58 −4 .github/workflows/ci-windows.yml
  3. +2 −1 .gitmodules
  4. +4 −0 README.md
  5. +23 −8 build_tools/ci/build_test_cpp.sh
  6. +89 −67 build_tools/ci/cpu_comparison/run_test.py
  7. +6 −13 build_tools/ci/print_ir_aie2xclbin/print_ir_aie2xclbin.sh
  8. +89 −62 build_tools/ci/run_matmul_test.sh
  9. +3 −3 build_tools/download_peano.sh
  10. +5 −21 cmake/iree_aie_bootgen.cmake
  11. +1 −3 cmake/iree_aie_rt.cmake
  12. +28 −33 cmake/iree_aie_xrt.cmake
  13. +0 −8 compiler/plugins/target/AMD-AIE/aievec/VectorToAIEVecConversions.cpp
  14. +0 −19 compiler/plugins/target/AMD-AIE/iree-amd-aie/IR/AMDAIEAttrs.cpp
  15. +192 −164 compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp
  16. +6 −16 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIECanonicalizeNpuDmaCpyNd.cpp
  17. +0 −5 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIELocalizeLogicalObjectFifo.cpp
  18. +2 −1 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIELowerToAIE.cpp
  19. +0 −1 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIESinkIntoCore.cpp
  20. +1 −0 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIEVectorization.cpp
  21. +1 −0 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/Passes.h
  22. +1 −1 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/Passes.td
  23. +1 −1 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/test/create_reference_to_allocation.mlir
  24. +36 −0 compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/test/sink_into_core.mlir
  25. +4 −0 runtime/src/iree-amd-aie/aie_runtime/iree_aie_configure.cc
  26. +4 −4 runtime/src/iree-amd-aie/aie_runtime/iree_aie_configure.h
  27. +2 −2 runtime/src/iree-amd-aie/aie_runtime/iree_aie_runtime.h
  28. +19 −4 runtime/src/iree-amd-aie/driver/xrt/native_executable.cc
  29. +0 −7 runtime/src/iree-amd-aie/driver/xrt/xrt_device.cc
  30. +0 −4 runtime/src/iree-amd-aie/driver/xrt/xrt_device.h
  31. +22 −18 runtime/src/iree-amd-aie/driver/xrt/xrt_driver.cc
  32. +1 −1 sync_deps.py
  33. +2 −1 tests/matmul/requirements.txt
  34. +1 −1 tests/samples/conv_pipeline_e2e.mlir
  35. +1 −1 third_party/XRT
34 changes: 12 additions & 22 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -70,9 +70,7 @@ jobs:
- name: Create artifacts
if: ${{ !cancelled() }}
run: |
rm -f iree-install/bin/clang*
rm -f iree-install/bin/llvm-link*
tar cf iree-dist-linux.tar -C iree-install . -C ../iree-build tools/testing/e2e/iree-e2e-matmul-test
tar cf iree-dist-linux.tar -C iree-install .
- name: Upload artifacts
uses: actions/upload-artifact@v4
@@ -95,7 +93,7 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on: [linux-phoenix-20240606, linux-phoenix-20240819]
runs-on: [linux-phoenix]
runs-on: ${{ matrix.runs-on }}
env:
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic
@@ -152,6 +150,7 @@ jobs:
# on the guthub CI machine.
sudo prlimit -lunlimited --pid $$
source /opt/xilinx/xrt/setup.sh
bash build_tools/ci/run_matmul_test.sh \
test_matmuls \
iree-install \
@@ -163,20 +162,14 @@ jobs:
- name : Smoke E2E comparison flag test
run: |
source .venv/bin/activate
# install requirements
# TODO(newling) make requirements.txt file
pip install numpy
source /opt/xilinx/xrt/setup.sh
python3 build_tools/ci/cpu_comparison/run_test.py \
test_aie_vs_cpu \
iree-install \
$PWD/llvm-aie \
/opt/xilinx/xrt \
/opt/Xilinx/Vitis/2024.2 \
--reset_npu_between_runs=0 \
--test_set='Smoke' \
--do_not_run_aie=1 \
--verbose=0
--xrt-dir /opt/xilinx/xrt \
--test-set='Smoke' \
--do-not-run-aie
# Assert that output.log is empty (because verbose=0)
if [ -s output.log ]; then
@@ -190,23 +183,20 @@ jobs:
- name : E2E comparison of AIE to llvm-cpu
run: |
source .venv/bin/activate
# install requirements
# TODO(newling) make requirements.txt file
pip install numpy
source /opt/xilinx/xrt/setup.sh
python3 build_tools/ci/cpu_comparison/run_test.py \
test_aie_vs_cpu \
iree-install \
$PWD/iree-install \
$PWD/llvm-aie \
/opt/xilinx/xrt \
/opt/Xilinx/Vitis/2024.2
--xrt-dir /opt/xilinx/xrt \
--vitis-dir /opt/Xilinx/Vitis/2024.2 \
--reset-npu-between-runs -v
- name: Printing IR from aie2xclbin
run: |
source .venv/bin/activate
source /opt/xilinx/xrt/setup.sh
bash build_tools/ci/print_ir_aie2xclbin/print_ir_aie2xclbin.sh \
iree-install \
print_ir_aie2xclbin_results \
$PWD/llvm-aie \
/opt/xilinx/xrt \
/opt/Xilinx/Vitis/2024.2
$PWD/llvm-aie
62 changes: 58 additions & 4 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ jobs:
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: msvc
compiler: llvm
vcvarsall: true
cmake: true
ninja: true
@@ -86,9 +86,7 @@ jobs:
- name: Create artifacts
if: ${{ !cancelled() }}
run: |
rm -f iree-install/bin/clang*
rm -f iree-install/bin/llvm-link*
tar cf iree-dist-windows.tar -C iree-install . -C ../iree-build tools/testing/e2e/iree-e2e-matmul-test.exe
tar cf iree-dist-windows.tar -C iree-install .
- name: Upload artifacts
uses: actions/upload-artifact@v4
@@ -104,3 +102,59 @@ jobs:
with:
path: ${{ env.CACHE_DIR }}
key: windows-build-test-cpp-asserts-v1-${{ github.sha }}-${{ github.event.repository.updated_at }}

test_windows:
name: E2E Test windows
runs-on: windows-phoenix
needs: build_and_ctest
strategy:
fail-fast: true
steps:
- name: "Checking out repository" # for test scripts
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: false # not required for testbench

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: windows_x86_64_release_packages

- name: Extract artifact
run: |
mkdir iree-install
tar -xf iree-dist-windows.tar -C iree-install
bash build_tools/download_peano.sh
- name: Create venv and install dependencies
run: |
python -m venv .venv
source .venv/Scripts/activate
pip install -r tests/matmul/requirements.txt
- name: E2E correctness matmul test
run: |
source .venv/Scripts/activate
export XILINX_XRT=/c/Xilinx/XRT
bash build_tools/ci/run_matmul_test.sh \
/c/test_matmuls \
$PWD/iree-install \
$PWD/llvm-aie
- name : E2E comparison of AIE to llvm-cpu
run: |
source .venv/Scripts/activate
export XILINX_XRT=/c/Xilinx/XRT
python build_tools/ci/cpu_comparison/run_test.py \
/c/test_aie_vs_cpu \
$PWD/iree-install \
$PWD/llvm-aie -v
- name: Printing IR from aie2xclbin
run: |
source .venv/Scripts/activate
export XILINX_XRT=/c/Xilinx/XRT
bash build_tools/ci/print_ir_aie2xclbin/print_ir_aie2xclbin.sh \
$PWD/iree-install \
/c/print_ir_aie2xclbin_results \
$PWD/llvm-aie
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[submodule "third_party/XRT"]
path = third_party/XRT
url = https://github.com/Xilinx/XRT.git
url = https://github.com/nod-ai/XRT.git
shallow = true
branch = iree-amd-aie-patches
[submodule "third_party/mlir-air"]
path = third_party/mlir-air
url = https://github.com/nod-ai/mlir-air.git
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![CI Linux](https://github.com/nod-ai/iree-amd-aie/actions/workflows/ci-linux.yml/badge.svg)](https://github.com/nod-ai/iree-amd-aie/actions/workflows/ci-linux.yml)
[![CI Windows](https://github.com/nod-ai/iree-amd-aie/actions/workflows/ci-windows.yml/badge.svg)](https://github.com/nod-ai/iree-amd-aie/actions/workflows/ci-windows.yml)
[![CI MacOS](https://github.com/nod-ai/iree-amd-aie/actions/workflows/ci-macos.yml/badge.svg)](https://github.com/nod-ai/iree-amd-aie/actions/workflows/ci-macos.yml)

# AMD AIE Plugin for IREE

This repository contains an early-phase IREE compiler and runtime plugin for
31 changes: 23 additions & 8 deletions build_tools/ci/build_test_cpp.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -eu -o errtrace
set -eux -o errtrace

this_dir="$(cd $(dirname $0) && pwd)"
repo_root="$(cd $this_dir/../.. && pwd)"
@@ -32,6 +32,9 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export CMAKE_TOOLCHAIN_FILE="$this_dir/linux_default_toolchain.cmake"
export CC=clang
export CXX=clang++
elif [[ "$OSTYPE" == "msys"* ]]; then
export CC=clang-cl.exe
export CXX=clang-cl.exe
fi
export CCACHE_DIR="${cache_dir}/ccache"
export CCACHE_MAXSIZE="700M"
@@ -57,8 +60,6 @@ echo '{

cd $iree_dir
CMAKE_ARGS="\
-S $iree_dir \
-B $build_dir \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$install_dir \
@@ -76,14 +77,24 @@ CMAKE_ARGS="\
-DIREE_INPUT_STABLEHLO=OFF \
-DIREE_INPUT_TORCH=OFF \
-DCMAKE_OBJECT_PATH_MAX=4096 \
-DIREE_CMAKE_PLUGIN_PATHS=$PWD/../iree-amd-aie"
-DIREE_CMAKE_PLUGIN_PATHS=$repo_root"

if [[ "$OSTYPE" != "darwin"* ]]; then
CMAKE_ARGS="$CMAKE_ARGS -DIREE_EXTERNAL_HAL_DRIVERS=xrt"
cmake $CMAKE_ARGS \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DLLVM_TARGET_ARCH=X86 \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DIREE_EXTERNAL_HAL_DRIVERS=xrt \
-S $iree_dir -B $build_dir
else
cmake $CMAKE_ARGS \
-S $iree_dir -B $build_dir
fi

cmake $CMAKE_ARGS

echo "Building all"
echo "------------"
cmake --build "$build_dir" -- -k 0
@@ -99,10 +110,14 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
ctest --test-dir "$build_dir" -R amd-aie --output-on-failure -j
elif [[ "$OSTYPE" == "darwin"* ]]; then
ctest --test-dir "$build_dir" -R amd-aie -E "pack_peel_pipeline_matmul|conv_fill_spec_pad" --output-on-failure -j --repeat until-pass:5
else
elif [[ "$OSTYPE" == "msys"* ]]; then
# hack while windows is flaky to get past failing tests
ctest --test-dir "$build_dir" -R amd-aie --output-on-failure -j --repeat until-pass:5
fi

# Show ccache stats.
ccache --show-stats

rm -f "$install_dir"/bin/clang*
rm -f "$install_dir"/bin/llvm-link*
cp "$build_dir"/tools/testing/e2e/iree-e2e-matmul-test "$install_dir"/bin
Loading