Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

Commit

Permalink
[WIP] AIE CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Aug 30, 2024
1 parent f505444 commit a3466bb
Show file tree
Hide file tree
Showing 8 changed files with 1,891 additions and 0 deletions.
181 changes: 181 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
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:
name: Build (linux)
# runs-on: nod-ai-shared-cpubuilder-manylinux-x86_64
runs-on: ubuntu-22.04
env:
CACHE_DIR: ${{ github.workspace }}/.container-cache
CACHE_KEY: linux-build-manylinux-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }}
steps:
# - name: Install tmate
# run: dnf install -y epel-release && dnf install -y tmate
- name: Setup tmate session
uses: mxschmitt/[email protected]
with:
limit-access-to-actor: true
# install-dependencies: false
install-dependencies: true
detached: true

- name: Set unified TZ
uses: szenius/[email protected]
with:
# this is an arbitrary choice
timezoneLinux: "Asia/Singapore"
timezoneMacos: "Asia/Singapore"
timezoneWindows: "Singapore Standard Time"

# - name: Configure local git mirrors
# run: |
# /gitmirror/scripts/trigger_update_mirrors.sh
# /gitmirror/scripts/git_config.sh

- name: Install deps
run: |
# dnf install -y almalinux-release-devel
# yum install -y elfutils-libelf-devel p7zip p7zip-plugins
sudo apt install -y libelf-dev libnuma-dev
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: llvm-18
cmake: true
ninja: true
ccache: true

- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: recursive

- name: Enable cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHE_DIR }}
key: ${{ env.CACHE_KEY }}
restore-keys: linux-build-

- name: Configure ccache
run: |
export cache_dir="${{ env.CACHE_DIR }}"
if [ -z "${cache_dir}" ]; then
cache_dir="${{ github.workspace }}/.build-cache"
mkdir -p "${cache_dir}"
cache_dir="$(cd ${cache_dir} && pwd)"
fi
echo "Caching to ${cache_dir}"
mkdir -p "${cache_dir}/ccache"
export CCACHE_DIR="${cache_dir}/ccache" >> $GITHUB_ENV
export CCACHE_MAXSIZE="700M" >> $GITHUB_ENV
export CMAKE_C_COMPILER_LAUNCHER=ccache >> $GITHUB_ENV
export CMAKE_CXX_COMPILER_LAUNCHER=ccache >> $GITHUB_ENV
export CCACHE_COMPILERCHECK="string:$(clang --version)" >> $GITHUB_ENV
- name: Build and install libnuma
run: |
curl --silent -L \
https://github.com/numactl/numactl/releases/download/v2.0.18/numactl-2.0.18.tar.gz \
-o numactl-2.0.18.tar.gz
tar -xf numactl-2.0.18.tar.gz
pushd numactl-2.0.18
./configure
sudo make install
popd
- name: Build ROCR distro
run: |
rocr_dir="$(cd ${{ github.workspace }} && pwd)"
build_rocr_dir="${{ github.workspace }}/rocr-build"
mkdir -p "$build_rocr_dir"
build_rocr_dir="$(cd $build_rocr_dir && pwd)"
rocr_install_dir="${{ github.workspace }}/rocr-install"
cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$rocr_install_dir" \
-DTARGET_DEVICES=gfx900 \
-S "$rocr_dir" -B "$build_rocr_dir"
cmake --build "$build_rocr_dir" --target install
- name: Create artifacts
if: ${{ !cancelled() }}
run: |
tar -cf rocr-${{ github.ref_name }}-$(git rev-parse --short HEAD).tar -C rocr-install .
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: linux_x86_64_distro
path: rocr-*.tar
if-no-files-found: warn

- name: Save cache
uses: actions/cache/save@v3
if: ${{ !cancelled() }}
with:
path: ${{ env.CACHE_DIR }}
key: ${{ env.CACHE_KEY }}

test_aie:
name: AIE tests
needs: build
strategy:
fail-fast: false
matrix:
runs-on: [linux-phoenix]
runs-on: ${{ matrix.runs-on }}
steps:
- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3

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

- name: Extract artifact
run: |
mkdir -p rocr-install
tar -xf rocr-*.tar -C rocr-install
export hsa_runtime64_ROOT="$PWD/rocr-install" >> $GITHUB_ENV
- name: Build AIE test suite
run: |
pushd rocrtst/suites/aie
build_dir="$PWD/build"
mkdir -p $build_dir
cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-Dhsa_runtime64_ROOT="${hsa_runtime64_ROOT}" \
-S "$PWD" -B "$build_dir"
cmake --build "$build_dir" --target \
aie_hsa_bare_add_one \
aie_hsa_dispatch_test
popd
- name: Run AIE test suite
run: |
pushd rocrtst/suites/aie
build_dir="$PWD/build"
./"$build_dir"/aie_hsa_bare_add_one $PWD
./"$build_dir"/aie_hsa_dispatch_test $PWD
8 changes: 8 additions & 0 deletions rocrtst/suites/aie/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
find_package(hsa-runtime64 CONFIG REQUIRED NAMES hsa_runtime64)

# smoke test
add_executable(aie_hsa_bare_add_one aie_hsa_bare_add_one.cc)

# hsa test
add_executable(aie_hsa_dispatch_test aie_hsa_dispatch_test.cc)
target_link_libraries(aie_hsa_dispatch_test PUBLIC hsa-runtime64::hsa-runtime64)
Binary file added rocrtst/suites/aie/add_one.pdi
Binary file not shown.
68 changes: 68 additions & 0 deletions rocrtst/suites/aie/add_one_insts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
06030100
00000105
00000007
00000110
00000001
00000000
0001D000
00000030
00000400
00000000
00000000
00000000
80000000
00000000
00000000
02000000
00000081
00000030
00000000
00000000
00000000
00000000
0001D004
00000000
00000001
00000000
00000000
00000000
00000000
00000000
0001D204
00000000
80000000
00000018
00000001
00000000
0001D020
00000030
00000400
00000000
00000000
00000000
80000000
00000000
00000000
02000000
00000081
00000030
00000000
00000000
00000000
00000000
0001D024
00000000
00000000
00000000
00000000
00000000
00000000
00000000
0001D214
00000000
00000001
00000018
00000080
00000010
00000000
00010100
Loading

0 comments on commit a3466bb

Please sign in to comment.