matmul e2e from linalg with transform dialect #2086
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
# Copyright (C) 2022, Advanced Micro Devices, Inc. All rights reserved. | |
# SPDX-License-Identifier: MIT | |
name: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [assigned, opened, synchronize, reopened, ready_for_review] | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
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-air-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build-repo: | |
name: Build and Test with ROCm runtime | |
runs-on: ubuntu-${{ matrix.ubuntu_version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [ Assert, Release ] | |
ubuntu_version: [ 20.04, 22.04 ] | |
steps: | |
# Clone the repo and its submodules. Do shallow clone to save clone | |
# time. | |
- name: Get repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
submodules: "true" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install packages | |
run: | | |
sudo apt-get install -y ninja-build clang lld | |
- name: Upgrade gcc | |
if: matrix.ubuntu_version == '20.04' | |
run: | | |
sudo apt install build-essential manpages-dev software-properties-common | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
GCC_VERSION=11 | |
sudo apt update && sudo apt install gcc-$GCC_VERSION g++-$GCC_VERSION | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \ | |
--slave /usr/bin/g++ g++ /usr/bin/g++-9 \ | |
--slave /usr/bin/gcov gcov /usr/bin/gcov-9 \ | |
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-9 \ | |
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-9 | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 110 \ | |
--slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION \ | |
--slave /usr/bin/gcov gcov /usr/bin/gcov-$GCC_VERSION \ | |
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-$GCC_VERSION \ | |
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-$GCC_VERSION | |
- name: Install libboost | |
run: sudo apt-get install -y libboost-all-dev && sudo apt-get clean | |
- name: Install Ninja | |
uses: llvm/actions/install-ninja@55d844821959226fab4911f96f37071c1d4c3268 | |
- name: Get Submodule Hash | |
id: get-submodule-hash | |
run: echo "::set-output name=hash::$(md5sum $(echo utils/clone-llvm.sh))" | |
- name: Ccache for C++ compilation | |
uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3 | |
with: | |
key: ${{ matrix.build_type }}-${{ runner.os }}-${{ matrix.ubuntu_version }} | |
max-size: 1G | |
- name: Install necessary build tools for the ROCm runtime | |
run: | | |
sudo apt install libelf-dev elfutils libdwarf-dev | |
sudo mkdir --parents --mode=0755 /etc/apt/keyrings | |
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \ | |
gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null | |
for ver in 5.3.3 5.4.3 5.5.1 5.6; do | |
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/$ver focal main" \ | |
| sudo tee --append /etc/apt/sources.list.d/rocm.list | |
done | |
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' \ | |
| sudo tee /etc/apt/preferences.d/rocm-pin-600 | |
sudo apt update | |
sudo apt install rocm-hip-runtime-dev5.6.0 && sudo apt-get clean | |
- name: Get ROCm-air-platforms | |
id: clone-rocm-air-platforms | |
run: utils/clone-rocm-air-platforms.sh | |
- name: Build and Install libxaie | |
run: utils/github-clone-build-libxaie.sh | |
- name: Get mlir-aie | |
id: clone-mlir-aie | |
run: utils/clone-mlir-aie.sh | |
- name: Build and Install mlir-aie | |
run: | | |
pushd mlir-aie | |
pip install -r python/requirements.txt | |
VERSION=$(utils/clone-llvm.sh --get-wheel-version) | |
pip -q download mlir==$VERSION \ | |
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro | |
unzip -q mlir-*.whl | |
# I have no clue why but the system clock on GHA containers is like 12 hours ahead. | |
# That means wheels have file with time stamps in the future which makes ninja loop | |
# forever when configuring. Set the time to some arbitrary stamp in the past just to be safe. | |
find mlir -exec touch -a -m -t 201108231405.14 {} \; | |
popd | |
utils/github-build-mlir-aie.sh | |
- name: Build ROCt | |
run: ROCm-air-platforms/utils/clone-build-roct.sh | |
- name: Build ROCr | |
run: ROCm-air-platforms/utils/clone-build-rocr.sh | |
# Build the repo test target in debug mode to build and test. | |
- name: Build and test (Assert) | |
if: matrix.build_type == 'Assert' | |
run: | | |
mkdir build_assert | |
pushd build_assert | |
cmake .. \ | |
-GNinja \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DLLVM_ENABLE_ASSERTIONS=ON \ | |
-DCMAKE_MODULE_PATH=`pwd`/../mlir-aie/cmake/modulesXilinx \ | |
-DMLIR_DIR=`pwd`/../mlir-aie/mlir/lib/cmake/mlir \ | |
-DLLVM_DIR=`pwd`/../mlir-aie/mlir/lib/cmake/llvm \ | |
-DAIE_DIR=`pwd`/../mlir-aie/install/lib/cmake/aie/ \ | |
-DLibXAIE_ROOT=`pwd`/../aienginev2/install \ | |
-Dhsa-runtime64_DIR=`pwd`/../rocm/lib/cmake/hsa-runtime64/ \ | |
-Dhsakmt_DIR=`pwd`/../rocm/lib/cmake/hsakmt/ \ | |
-DAIR_RUNTIME_TARGETS:STRING="x86_64" \ | |
-Dx86_64_TOOLCHAIN_FILE=`pwd`/../cmake/modules/toolchain_x86_64.cmake \ | |
-DLLVM_EXTERNAL_LIT=$(which lit) \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
-DLLVM_USE_LINKER=lld \ | |
-DCMAKE_INSTALL_PREFIX=install | |
ninja | |
ninja check-air-cpp | |
ninja check-air-mlir | |
ninja check-air-python | |
popd | |
rm -rf build_assert | |
env: | |
LD_LIBRARY_PATH: ${{ github.workspace }}/aienginev2/install/lib | |
# Build the repo test target in release mode to build and test. | |
- name: Build and test (Release) | |
if: matrix.build_type == 'Release' | |
run: | | |
mkdir build_release | |
pushd build_release | |
cmake .. \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_ENABLE_ASSERTIONS=OFF \ | |
-DCMAKE_MODULE_PATH=`pwd`/../mlir-aie/cmake/modulesXilinx \ | |
-DMLIR_DIR=`pwd`/../mlir-aie/mlir/lib/cmake/mlir \ | |
-DLLVM_DIR=`pwd`/../mlir-aie/mlir/lib/cmake/llvm \ | |
-DAIE_DIR=`pwd`/../mlir-aie/install/lib/cmake/aie/ \ | |
-DLibXAIE_ROOT=`pwd`/../aienginev2/install \ | |
-Dhsa-runtime64_DIR=`pwd`/../rocm/lib/cmake/hsa-runtime64/ \ | |
-Dhsakmt_DIR=`pwd`/../rocm/lib/cmake/hsakmt/ \ | |
-DAIR_RUNTIME_TARGETS:STRING="x86_64" \ | |
-Dx86_64_TOOLCHAIN_FILE=`pwd`/../cmake/modules/toolchain_x86_64.cmake \ | |
-DLLVM_EXTERNAL_LIT=$(which lit) \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
-DLLVM_USE_LINKER=lld \ | |
-DCMAKE_INSTALL_PREFIX=install | |
make -j$(nproc) | |
make check-air-cpp check-air-mlir check-air-python | |
popd | |
rm -rf build_release | |
env: | |
LD_LIBRARY_PATH: ${{ github.workspace }}/aienginev2/install/lib | |
lint-repo: | |
name: Check code format | |
runs-on: ubuntu-20.04 | |
steps: | |
# Clone the repo and its submodules. Do shallow clone to save clone | |
# time. | |
- name: Get repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
submodules: "true" | |
# -------- | |
# Lint the code. | |
# ------- | |
# Choose the git commit to diff against for the purposes of linting. | |
# Since this workflow is triggered on both pushes and pull requests, we | |
# have to determine if the pull request target branch is set (which it | |
# will only be on the PR triggered flow). If it's not, then compare | |
# against the last commit. | |
- name: choose-commit | |
if: ${{ always() }} | |
env: | |
# Base ref is the target branch, in text form (not hash) | |
PR_BASE: ${{ github.base_ref }} | |
run: | | |
# Run clang-format | |
if [[ -z "$PR_BASE" ]]; then | |
DIFF_COMMIT_NAME="HEAD^" | |
else | |
DIFF_COMMIT_NAME="$PR_BASE" | |
fi | |
echo "DIFF_COMMIT_NAME=$DIFF_COMMIT_NAME" >> $GITHUB_ENV | |
# Since we did a shallow fetch for this repo, we must fetch the commit | |
# upon which we be diff'ing. The last step set the ref name in the | |
# $DIFF_COMMIT_NAME environment variable. When running the fetch, resolve | |
# it to the commit hash and pass that hash along to subsequent steps. | |
- name: git fetch base commit | |
continue-on-error: true | |
run: | | |
if [[ ! "$DIFF_COMMIT_NAME" == *"HEAD"* ]]; then | |
git fetch --recurse-submodules=no origin $DIFF_COMMIT_NAME | |
DIFF_COMMIT_SHA=$( git rev-parse origin/$DIFF_COMMIT_NAME ) | |
else | |
DIFF_COMMIT_SHA=$( git rev-parse $DIFF_COMMIT_NAME ) | |
fi | |
echo "DIFF_COMMIT=$DIFF_COMMIT_SHA" >> $GITHUB_ENV | |
# Run 'git clang-format', comparing against the target commit hash. If | |
# clang-format fixed anything, fail and output a patch. | |
- name: clang-format | |
if: ${{ always() }} | |
run: | | |
# Run clang-format | |
git clang-format-12 $DIFF_COMMIT | |
git diff --ignore-submodules > clang-format.patch | |
if [ -s clang-format.patch ]; then | |
echo "Clang-format found formatting problems in the following " \ | |
"files. See diff in the clang-format.patch artifact." | |
git diff --ignore-submodules --name-only | |
git checkout . | |
exit 1 | |
fi | |
echo "Clang-format found no formatting problems" | |
exit 0 | |
# Run clang-tidy against only the changes. The 'clang-tidy-diff' script | |
# does this if supplied with the diff. | |
- name: clang-tidy | |
if: ${{ always() }} | |
run: | | |
git diff -U0 $DIFF_COMMIT | \ | |
clang-tidy-diff-12.py -path build_assert -p1 -fix | |
git diff --ignore-submodules > clang-tidy.patch | |
if [ -s clang-tidy.patch ]; then | |
echo "Clang-tidy problems in the following files. " \ | |
"See diff in the clang-tidy.patch artifact." | |
git diff --ignore-submodules --name-only | |
git checkout . | |
exit 1 | |
fi | |
echo "Clang-tidy found no problems" | |
exit 0 | |
# Upload the format and tidy patches to an artifact (zip'd) associated | |
# with the workflow run. Only run this on a failure. | |
- name: Upload format and tidy patches | |
uses: actions/upload-artifact@v2 | |
continue-on-error: true | |
if: ${{ failure() }} | |
with: | |
name: clang-format-tidy-patches | |
path: clang-*.patch | |
# Unfortunately, artifact uploads are always zips so display the diff as | |
# well to provide feedback at a glance. | |
- name: clang format and tidy patches display | |
if: ${{ failure() }} | |
continue-on-error: true | |
run: | | |
# Display patches | |
if [ ! -z clang-format.patch ]; then | |
echo "Clang-format patch" | |
echo "================" | |
cat clang-format.patch | |
echo "================" | |
fi | |
if [ ! -z clang-tidy.patch ]; then | |
echo "Clang-tidy patch" | |
echo "================" | |
cat clang-tidy.patch | |
echo "================" | |
fi | |