[AIETarget] Fetch chess and peano architecture version strings from DeviceModel
#2072
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Linux | |
on: | |
workflow_call: | |
workflow_dispatch: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- main | |
concurrency: | |
# A PR number if a pull request and otherwise the commit hash. This cancels | |
# queued and in-progress runs for the same PR (presubmit) or commit | |
# (postsubmit). | |
group: ci-build-test-cpp-linux-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build_and_ctest: | |
name: Build and Test (linux, ASSERTIONS) | |
runs-on: azure-cpubuilder-linux-scale | |
strategy: | |
fail-fast: true | |
env: | |
CACHE_DIR: ${{ github.workspace }}/.container-cache | |
# either the PR number or `branch-N` where N always increments | |
CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ format('{0}-{1}', github.ref_name, github.run_number) }} | |
steps: | |
- name: Set unified TZ | |
uses: szenius/set-timezone@v2.0 | |
with: | |
# this is an arbitrary choice | |
timezoneLinux: "Asia/Singapore" | |
timezoneMacos: "Asia/Singapore" | |
timezoneWindows: "Singapore Standard Time" | |
- name: "Checking out repository" | |
env: | |
BRANCH_NAME: ${{ github.ref }} | |
REPO_ADDRESS: ${{ github.server_url }}/${{ github.repository }} | |
run: | | |
git init | |
git remote add origin $REPO_ADDRESS | |
git -c protocol.version=2 fetch --depth 1 origin $BRANCH_NAME | |
git reset --hard FETCH_HEAD | |
git -c submodule."third_party/torch-mlir".update=none \ | |
-c submodule."third_party/stablehlo".update=none \ | |
-c submodule."third_party/XRT".update=none \ | |
submodule update --init --recursive --depth 1 --single-branch -j 10 | |
- name: "Setting up Python" | |
run: | | |
sudo apt update | |
sudo apt install software-properties-common -y | |
sudo add-apt-repository ppa:deadsnakes/ppa -y | |
sudo apt install python3.11 python3-pip -y | |
sudo apt-get install python3.11-dev python3.11-venv build-essential -y | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16 | |
with: | |
key: ${{ github.job }} | |
save: ${{ needs.setup.outputs.write-caches == 1 }} | |
- name: Python deps | |
run: | | |
python3.11 -m venv .venv | |
source .venv/bin/activate | |
pip install -r third_party/iree/runtime/bindings/python/iree/runtime/build_requirements.txt | |
pip install pyyaml pybind11[global]==2.13.6 nanobind==2.4.0 | |
- name: Enable cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CACHE_DIR }} | |
key: ${{ env.CACHE_KEY }} | |
restore-keys: linux-build-test-cpp- | |
- name: Peano dep | |
run: | | |
bash build_tools/download_peano.sh | |
echo "PEANO_INSTALL_DIR=$PWD/llvm-aie" >> $GITHUB_ENV | |
echo "ENABLE_XRT_LITE_CTS_TESTS=ON" >> $GITHUB_ENV | |
- name: Install linux deps | |
run: | | |
sudo apt remove cmake -y | |
bash build_tools/ci/install_cmake.sh | |
sudo apt-get install ninja-build clang lld libudev-dev uuid-dev -y | |
- name: Build packages | |
run: | | |
source .venv/bin/activate | |
export cache_dir="${{ env.CACHE_DIR }}" | |
export CCACHE_COMPILERCHECK="string:$(clang --version)" | |
bash build_tools/build_llvm.sh | |
rm -rf llvm-build | |
export llvm_install_dir=$PWD/llvm-install | |
bash build_tools/build_test_cpp.sh | |
- name: Create artifacts | |
if: ${{ !cancelled() }} | |
run: | | |
pushd third_party/iree/third_party/llvm-project && llvm_sha_short=$(git rev-parse --short HEAD) && popd | |
tar cf llvm-dist-linux-$llvm_sha_short.tar llvm-install | |
tar cf iree-dist-linux.tar iree-install | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: linux_x86_64_llvm_packages | |
path: llvm-dist-*.tar | |
if-no-files-found: warn | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: linux_x86_64_iree_packages | |
path: iree-dist-linux.tar | |
if-no-files-found: warn | |
- name: Save cache | |
uses: actions/cache/save@v3 | |
if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }} | |
with: | |
path: ${{ env.CACHE_DIR }} | |
key: ${{ env.CACHE_KEY }} | |
test_linux_phoenix: | |
name: E2E Test Linux Phoenix | |
needs: build_and_ctest | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [linux-phoenix] | |
runs-on: ${{ matrix.runs-on }} | |
env: | |
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic | |
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: linux_x86_64_iree_packages | |
- name: Extract artifact | |
run: | | |
tar -xvf iree-dist-linux.tar | |
echo "IREE_INSTALL_DIR=$PWD/iree-install" >> $GITHUB_ENV | |
echo "PYTHONPATH=$PWD/iree-install/python_packages/iree_compiler:$PWD/iree-install/python_packages/iree_runtime" >> $GITHUB_ENV | |
bash build_tools/download_peano.sh | |
echo "PEANO_INSTALL_DIR=$PWD/llvm-aie" >> $GITHUB_ENV | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Create venv and install dependencies | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install -r tests/requirements.txt | |
- name: Query device info | |
run: | | |
source .venv/bin/activate | |
echo "aie-metadata" | |
python build_tools/ci/amdxdna_driver_utils/amdxdna_ioctl.py --aie-metadata | |
echo "aie-version" | |
python build_tools/ci/amdxdna_driver_utils/amdxdna_ioctl.py --aie-version | |
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 \ | |
--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 \ | |
--skip_tests=Performance | |
# Run the 'Performance' tests. These do not check numerical correctness, | |
# just measure the time to run some workloads. | |
- name : Performance benchmarks | |
run: | | |
source .venv/bin/activate | |
python build_tools/ci/cpu_comparison/run.py \ | |
test_aie_vs_cpu \ | |
$PWD/iree-install \ | |
--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 | |
# Print a summary of the findings. | |
python build_tools/ci/cpu_comparison/performance_summarizer.py \ | |
performance.log | |
- name: XRT-LITE tests | |
run: | | |
DEVICE_TEST_DIR="$PWD/iree-install/device_tests" | |
for t in $(ls $DEVICE_TEST_DIR); do | |
$DEVICE_TEST_DIR/$t --xrt_lite_n_core_rows=$XRT_LITE_N_CORE_ROWS --xrt_lite_n_core_cols=$XRT_LITE_N_CORE_COLS | |
done | |
test_linux_strix: | |
name: E2E Test Linux Strix | |
needs: build_and_ctest | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [linux-strix] | |
runs-on: ${{ matrix.runs-on }} | |
env: | |
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic | |
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: linux_x86_64_iree_packages | |
- name: Extract artifact | |
run: | | |
tar -xvf iree-dist-linux.tar | |
echo "IREE_INSTALL_DIR=$PWD/iree-install" >> $GITHUB_ENV | |
echo "PYTHONPATH=$PWD/iree-install/python_packages/iree_compiler:$PWD/iree-install/python_packages/iree_runtime" >> $GITHUB_ENV | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Create venv and install dependencies | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install -r tests/requirements.txt | |
- name: Query device info | |
run: | | |
source .venv/bin/activate | |
echo "aie-metadata" | |
python build_tools/ci/amdxdna_driver_utils/amdxdna_ioctl.py --aie-metadata | |
echo "aie-version" | |
python build_tools/ci/amdxdna_driver_utils/amdxdna_ioctl.py --aie-version | |
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 comparison of AIE to llvm-cpu | |
run: | | |
source .venv/bin/activate | |
python build_tools/ci/cpu_comparison/run.py \ | |
test_aie_vs_cpu \ | |
$PWD/iree-install \ | |
--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 |