Fix intrinsic wrapper for aie2 acquire/release #2066
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: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [assigned, opened, synchronize, reopened] | |
workflow_dispatch: | |
defaults: | |
run: | |
# This is already the default, except when running inside another Docker | |
# image, which is the case here. So set it up globally to avoid | |
# repeating elsewhere. | |
shell: bash | |
env: | |
# Run apt package manager in the CI in non-interactive mode. | |
# Otherwise, on Ubuntu 20.04 the installation of tzdata asking question | |
# freezes libboost installation. | |
DEBIAN_FRONTEND: noninteractive | |
jobs: | |
build-repo: | |
name: Build and Test | |
# By latest GitHub means actually latest LTS only | |
runs-on: ubuntu-latest | |
strategy: | |
# Run all the test even if there are some which fail | |
fail-fast: false | |
# Run the tests on the Cartesian product of the following | |
matrix: | |
build_type: [ Assert, Release ] | |
ubuntu_version: [ 20.04, 22.04 ] | |
# Using a container instead of running native on public GitHub | |
# Action has also the advantage of having 2 CPU instead of 1, so | |
# it runs faster. But these images have quite less software | |
# installed compared to the GitHub Ubuntu distribution for example. | |
container: | |
image: docker://ubuntu:${{matrix.ubuntu_version}} | |
steps: | |
- name: Display environment variables | |
run: env | |
- name: User and group ids | |
run: id -a | |
- name: Execution context information | |
# Display a lot of information to help further development | |
# https://docs.github.com/en/actions/learn-github-actions/variables | |
# https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/contexts | |
# The problem is that echo-ing directly ${{ toJSON(github) }} | |
# in the shell is not escaped and for example '&' breaks | |
# things or can lead to server-side script injection. :-( | |
# So, use environment setting and display the environment | |
# variable in the shell between "" to avoid unsafe | |
# interpretation. | |
env: | |
execution_context_var_github: ${{ toJSON(github) }} | |
execution_context_var_env: ${{ toJSON(env) }} | |
execution_context_var_vars: ${{ toJSON(vars) }} | |
execution_context_var_job: ${{ toJSON(job) }} | |
execution_context_var_steps: ${{ toJSON(steps) }} | |
execution_context_var_runner: ${{ toJSON(runner) }} | |
execution_context_var_strategy: ${{ toJSON(strategy) }} | |
execution_context_var_matrix: ${{ toJSON(matrix) }} | |
execution_context_var_needs: ${{ toJSON(needs) }} | |
execution_context_var_inputs: ${{ toJSON(inputs) }} | |
run: | | |
echo "::group::github context" | |
echo "$execution_context_var_github" | |
echo "::endgroup::" | |
echo "::group::env context" | |
echo "$execution_context_var_env" | |
echo "::endgroup::" | |
echo "::group::vars context" | |
echo "$execution_context_var_vars" | |
echo "::endgroup::" | |
echo "::group::job context" | |
echo "$execution_context_var_job" | |
echo "::endgroup::" | |
echo "::group::steps context" | |
echo "$execution_context_var_steps" | |
echo "::endgroup::" | |
echo "::group::runner context" | |
echo "$execution_context_var_runner" | |
echo "::endgroup::" | |
echo "::group::strategy context" | |
echo "$execution_context_var_strategy" | |
echo "::endgroup::" | |
echo "::group::matrix context" | |
echo "$execution_context_var_matrix" | |
echo "::endgroup::" | |
echo "::group::needs context" | |
echo "$execution_context_var_needs" | |
echo "::endgroup::" | |
echo "::group::inputs context" | |
echo "$execution_context_var_inputs" | |
echo "::endgroup::" | |
- name: Configure Environment | |
run: echo "$GITHUB_WORKSPACE/llvm/install/bin" >> $GITHUB_PATH | |
- name: Install git | |
run: | | |
apt-get update | |
apt-get install -y git | |
# Clone the repo and its submodules. Do shallow clone to save clone | |
# time. | |
- name: Get the project repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
submodules: "true" | |
- name: Install libboost | |
run: apt-get install -y libboost-all-dev | |
- name: Install Python and other packages | |
# Install cmake here to get the latest version to compile | |
# LLVM. The Ubuntu 20.04 cmake version is only 3.16.3 | |
run: | | |
apt-get install -y pip | |
pip install cmake numpy psutil pybind11 rich | |
- name: Install Ninja | |
# Can not use the following since it wants to use `sudo` not | |
# available in the case of Docker execution | |
# https://github.com/llvm/actions/tree/main/install-ninja | |
# uses: llvm/actions/install-ninja@6a57890d0e3f9f35dfc72e7e48bc5e1e527cdd6c | |
# So just use the specific implementation instead: | |
run: apt-get install -y ninja-build | |
# Because the build requires to use explicitly this compiler | |
- name: Install Clang & Clang++ and linker | |
run: apt-get install -y clang lld | |
- name: Get Submodule Hash | |
id: get-submodule-hash | |
run: echo "hash=$(md5sum $(echo utils/clone-llvm.sh))" >> $GITHUB_OUTPUT | |
- name: Ccache for C++ compilation | |
# https://github.com/hendrikmuhs/ccache-action/releases/tag/v1.2.9 | |
uses: hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e | |
with: | |
key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }} | |
max-size: 1G | |
- name: Get LLVM | |
id: clone-llvm | |
run: utils/clone-llvm.sh | |
- name: Rebuild and Install LLVM | |
run: utils/build-llvm.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 | |
cd build_assert | |
cmake .. \ | |
-GNinja \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DAIE_COMPILER=NONE \ | |
-DAIE_LINKER=NONE \ | |
-DHOST_COMPILER=NONE \ | |
-DLLVM_ENABLE_ASSERTIONS=ON \ | |
-DCMAKE_MODULE_PATH=`pwd`/../cmake/modulesXilinx \ | |
-DMLIR_DIR=../llvm/install/lib/cmake/mlir \ | |
-DLLVM_DIR=../llvm/install/lib/cmake/llvm \ | |
-DCMAKE_LINKER=lld \ | |
-DCMAKE_C_COMPILER=clang \ | |
-DCMAKE_CXX_COMPILER=clang++ \ | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \ | |
-DLLVM_EXTERNAL_LIT=`pwd`/../llvm/build/bin/llvm-lit \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
ninja | |
ninja check-aie | |
ninja check-tutorials | |
ninja check-reference-designs | |
# 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 | |
cd build_release | |
cmake .. \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DAIE_COMPILER=NONE \ | |
-DAIE_LINKER=NONE \ | |
-DHOST_COMPILER=NONE \ | |
-DLLVM_ENABLE_ASSERTIONS=OFF \ | |
-DCMAKE_MODULE_PATH=`pwd`/../cmake/modulesXilinx \ | |
-DMLIR_DIR=../llvm/install/lib/cmake/mlir \ | |
-DLLVM_DIR=../llvm/install/lib/cmake/llvm \ | |
-DCMAKE_LINKER=lld \ | |
-DCMAKE_C_COMPILER=clang \ | |
-DCMAKE_CXX_COMPILER=clang++ \ | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \ | |
-DLLVM_EXTERNAL_LIT=`pwd`/../llvm/build/bin/llvm-lit | |
make -j$(nproc) | |
make check-aie | |
make check-tutorials | |
make check-reference-designs | |
lint-repo: | |
name: Check code format | |
runs-on: ubuntu-latest | |
steps: | |
# We'll be running clang-tidy later in this flow. | |
- name: Install clang-tidy | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-tidy-12 | |
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy \ | |
/usr/bin/clang-tidy-12 100 | |
# 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@v3 | |
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 |