Skip to content

Commit

Permalink
Merge branch 'main' into zhewen_bdchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu-Zhewen committed Nov 28, 2024
2 parents a8c52b5 + daf2eca commit 770fd34
Show file tree
Hide file tree
Showing 32 changed files with 1,077 additions and 461 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: nod-ai-shared-cpubuilder-manylinux-x86_64
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable

# see https://black.readthedocs.io/en/stable/integrations/github_actions.html
62 changes: 26 additions & 36 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,59 +160,51 @@ jobs:
echo "XRT_LITE_N_CORE_ROWS=$(python build_tools/ci/amdxdna_driver_utils/amdxdna_ioctl.py --num-rows)" >> $GITHUB_ENV
echo "XRT_LITE_N_CORE_COLS=$(python build_tools/ci/amdxdna_driver_utils/amdxdna_ioctl.py --num-cols)" >> $GITHUB_ENV
- name: E2E correctness matmul test
run: |
# https://stackoverflow.com/a/17567422
# shim_xdna::bo::map_drm_bo does an mmap with MAP_LOCKED
# which can fail if limit is to low
sudo prlimit -lunlimited --pid $$
source .venv/bin/activate
bash build_tools/ci/run_matmul_test.sh \
test_matmuls \
iree-install \
$PWD/llvm-aie
- name : E2E comparison of AIE to llvm-cpu
run: |
sudo prlimit -lunlimited --pid $$
source .venv/bin/activate
python build_tools/ci/cpu_comparison/run.py \
test_aie_vs_cpu \
$PWD/iree-install \
$PWD/llvm-aie \
--vitis-dir /opt/Xilinx/Vitis/2024.2 \
--target_device "npu1_4col" \
--reset-npu-between-runs -v \
--peano_dir=$PWD/llvm-aie \
--vitis_dir=/opt/Xilinx/Vitis/2024.2 \
--target_device="npu1_4col" \
--reset_npu_between_runs -v \
--xrt_lite_n_core_rows=$XRT_LITE_N_CORE_ROWS \
--xrt_lite_n_core_cols=$XRT_LITE_N_CORE_COLS
- name : Performance benchmarks

run: |
source .venv/bin/activate
python build_tools/ci/cpu_comparison/run.py \
test_aie_vs_cpu \
$PWD/iree-install \
$PWD/llvm-aie \
--vitis-dir /opt/Xilinx/Vitis/2024.2 \
--target_device "npu1_4col" \
--reset-npu-between-runs -v \
--peano_dir=$PWD/llvm-aie \
--vitis_dir=/opt/Xilinx/Vitis/2024.2 \
--target_device="npu1_4col" \
--reset_npu_between_runs -v \
--xrt_lite_n_core_rows=$XRT_LITE_N_CORE_ROWS \
--xrt_lite_n_core_cols=$XRT_LITE_N_CORE_COLS \
--tests=Performance > performance.log
python build_tools/ci/cpu_comparison/performance_summarizer.py \
performance.log
- name: E2E correctness matmul test
run: |
# https://stackoverflow.com/a/17567422
# shim_xdna::bo::map_drm_bo does an mmap with MAP_LOCKED
# which can fail if limit is to low
sudo prlimit -lunlimited --pid $$
source .venv/bin/activate
bash build_tools/ci/run_matmul_test.sh \
test_matmuls \
iree-install \
$PWD/llvm-aie \
/opt/Xilinx/Vitis/2024.2
- name: Python tests
run: |
source .venv/bin/activate
pytest -rv tests \
--capture=tee-sys \
--iree-install-dir=$PWD/iree-install \
--peano-install-dir=$PWD/llvm-aie \
--xrt_lite_n_core_rows=$XRT_LITE_N_CORE_ROWS \
--xrt_lite_n_core_cols=$XRT_LITE_N_CORE_COLS
- name: XRT-LITE tests
run: |
Expand Down Expand Up @@ -274,11 +266,9 @@ jobs:
python build_tools/ci/cpu_comparison/run.py \
test_aie_vs_cpu \
$PWD/iree-install \
/opt/xilinx/Vitis/2024.2 \
--vitis-dir /opt/xilinx/Vitis/2024.2 \
--target_device "npu4" \
--use_chess "1" \
--reset-npu-between-runs \
--vitis_dir=/opt/xilinx/Vitis/2024.2 \
--target_device="npu4" \
--reset_npu_between_runs \
--xrt_lite_n_core_rows=$XRT_LITE_N_CORE_ROWS \
--xrt_lite_n_core_cols=$XRT_LITE_N_CORE_COLS \
-v
16 changes: 3 additions & 13 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,7 @@ jobs:
python build_tools/ci/cpu_comparison/run.py \
/c/test_aie_vs_cpu \
$PWD/iree-install \
$PWD/llvm-aie -v \
--peano_dir=$PWD/llvm-aie -v \
--target_device "npu1_4col" \
--device-hal=xrt
- name: Python tests
run: |
ls $env:XILINX_XRT
.\.venv\Scripts\Activate.ps1
mkdir temp
pytest tests -sv `
--basetemp=$PWD\temp `
--iree-install-dir="$PWD\iree-install" `
--peano-install-dir="$PWD\llvm-aie" `
--device-hal=xrt
--device_hal=xrt \
--skip_tests "Performance"
1 change: 0 additions & 1 deletion build_tools/build_test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ CMAKE_ARGS=(
-DIREE_INPUT_TORCH=OFF
-DCMAKE_OBJECT_PATH_MAX=4096
-DIREE_CMAKE_PLUGIN_PATHS="$repo_root"
-DIREE_AMDAIE_TIME_KERNEL=1
)

PEANO_INSTALL_DIR=${PEANO_INSTALL_DIR:-""}
Expand Down
20 changes: 12 additions & 8 deletions build_tools/ci/cpu_comparison/performance_summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@
with open(path, "r") as f:
lines = f.readlines()
print("============================")
first_print = True
for line in lines:
if "Run #1" in line:
if not first_print:
print("\n" + line.split()[-1])
else:
print(line.split()[-1])
first_print = False
if "IREE_AMDAIE" in line:
if "Performance benchmark:" in line:
print("\n")
print(line.split()[-1])
if "----------------------" in line:
print(line.strip())
if "Benchmark" in line:
print(line.strip())
if "real_time_mean" in line:
print(line.strip())
if "real_time_median" in line:
print(line.strip())
if "real_time_stddev" in line:
print(line.strip())
print("============================")
Loading

0 comments on commit 770fd34

Please sign in to comment.