Skip to content

Commit

Permalink
Merge branch 'main' into fix-peano-shift-ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
jgmelber authored Oct 19, 2024
2 parents 2fd7c5e + f4b52e9 commit 11cd228
Show file tree
Hide file tree
Showing 268 changed files with 1,677 additions and 7,963 deletions.
1 change: 1 addition & 0 deletions .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
- name: Install Python packages
run: |
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
- name: Install packages
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/buildAndTestAieTools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
pip -q download mlir==$VERSION \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/buildAndTestAieToolsHsaBuildOnly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
pip -q download mlir==$VERSION \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/buildAndTestMulti.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
- name: Install Python packages
run: |
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
- name: Setup Cpp
uses: aminya/setup-cpp@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/buildAndTestPythons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
- name: Install Python packages
run: |
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
- name: Install packages
run: |
Expand Down
39 changes: 10 additions & 29 deletions .github/workflows/buildAndTestRyzenAI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ concurrency:
env:
DEBIAN_FRONTEND: noninteractive
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic
VITIS: /opt/Xilinx/Vitis/2023.2
VITIS: /opt/ryzen_ai-1.3.0/vitis_aie_essentials
CMAKE_ARGS: |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
Expand Down Expand Up @@ -79,6 +79,7 @@ jobs:
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
pip install -r python/requirements_ml.txt
pip install jupyter
sed -i.bak 's/OUTPUT_TIMEOUT = 10/OUTPUT_TIMEOUT = 100/g' \
Expand All @@ -96,7 +97,7 @@ jobs:
mkdir build
pushd build
export PATH=/opt/Xilinx/Vitis/2023.2/bin:/opt/Xilinx/Vitis/2023.2/aietools/bin:$PATH
export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH
cmake .. -G Ninja \
-DPython3_EXECUTABLE=$(which python) \
-DLLVM_EXTERNAL_LIT=$(which lit) \
Expand All @@ -110,7 +111,7 @@ jobs:
popd
build-examples:
build-quick-setup:
name: Run Examples on Ryzen AI
runs-on: amd7940hs
steps:
Expand All @@ -133,35 +134,15 @@ jobs:
pip cache purge
source /opt/xilinx/xrt/setup.sh
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
pip install -r python/requirements_ml.txt
pip install jupyter
sed -i.bak 's/OUTPUT_TIMEOUT = 10/OUTPUT_TIMEOUT = 100/g' \
$(python -c 'import site; print(site.getsitepackages()[0])')/jupyter_client/runapp.py
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 {} \;
export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH
source utils/quick_setup.sh
# quick_setup changes directory to programming_examples, so we need to return to mlir-aie
cd ..
./utils/build-mlir-aie-from-wheels.sh ./my_install/mlir build install ./my_install/llvm-aie
mkdir build
# build is created by the build-mlir-aie-from-wheels.sh script
pushd build
export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH
cmake .. -G Ninja \
-DPython3_EXECUTABLE=$(which python) \
-DLLVM_EXTERNAL_LIT=$(which lit) \
-DCMAKE_INSTALL_PREFIX=$PWD/../mlir_aie \
-DCMAKE_MODULE_PATH=$PWD/../cmake/modulesXilinx \
-DMLIR_DIR=$PWD/../mlir/lib/cmake/mlir \
$CMAKE_ARGS
ninja install
ninja check-reference-designs
ninja check-programming-guide
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/buildAndTestRyzenAISw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build and Test with Ryzen AI Sofware

on:
push:
branches:
- main
- ryzen-ai-sw-test
pull_request:
workflow_dispatch:
inputs:
AIE_COMMIT:
description: 'which aie commit to build'
type: string
required: false
default: ''
LIT_FILTER:
description: 'LIT_FILTER for tests (regex of paths in test/)'
type: string
required: false
default: ''

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-ryzenai-tools-linux-${{ github.event.number || github.sha }}
cancel-in-progress: true

env:
DEBIAN_FRONTEND: noninteractive

jobs:
build-repo:
name: Build and Test with Ryzen AI Software

runs-on: ubuntu-latest

steps:

- name: Free disk space
uses: descriptinc/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false

- name: Docker prune
shell: bash
run: |
docker system prune -a -f
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: uraimo/run-on-arch-action@v2.5.0
name: Build and Test
id: runcmd
with:
distro: none
base_image: ghcr.io/xilinx/mlir-aie/ubuntu22-ryzenai-1.3.0ea
githubToken: ${{ github.token }}
dockerRunArgs: |
--mac-address ${{ secrets.XILINX_MAC }}
run: |
MLIR_DIR=$PWD
pushd /workspace
# this is the inverse of `base64 -w 1000000 Xilinx.lic`
# the -w ("wrap after 1000000 cols") is so that there are no spaces in the XILINX_LIC env var
echo -n "${{ secrets.XILINX_LIC }}" | base64 --decode > /workspace/Xilinx.lic
export XILINXD_LICENSE_FILE=/workspace/Xilinx.lic
ccrypt -d -K ${{ secrets.RYZEN_AI_SW_KEY }} /workspace/ryzen_ai-1.3.0ea1.tgz.cpt
tar xvf /workspace/ryzen_ai-1.3.0ea1.tgz
pushd /workspace/ryzen_ai-1.3.0
./install_ryzen_ai_1_3.sh -a yes -p /workspace/venv -l
popd
export LD_LIBRARY_PATH=
export PYTHONPATH=
source /workspace/venv/bin/activate
source /opt/xilinx/xrt/setup.sh
popd
if [ x"${{ inputs.AIE_COMMIT }}" != x"" ]; then
git reset --hard ${{ inputs.AIE_COMMIT }}
fi
pip install onnxruntime==1.17.0
pip install -r python/requirements.txt
pip install -r python/requirements_ml.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
cd /workspace
pip -q download mlir==$VERSION \
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro
unzip -q mlir-*.whl
mkdir -p /workspace/install
mkdir -p /workspace/build
pushd /workspace/build
cmake $MLIR_DIR -G Ninja \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DXRT_ROOT=/opt/xilinx/xrt \
-DAIE_ENABLE_PYTHON_PASSES=OFF \
-DAIE_ENABLE_XRT_PYTHON_BINDINGS=ON \
-DAIE_INCLUDE_INTEGRATION_TESTS=OFF \
-DAIE_VITIS_COMPOONENTS=AIE2 \
-DPython3_EXECUTABLE=$(which python) \
-DLLVM_EXTERNAL_LIT=$(which lit) \
-DCMAKE_INSTALL_PREFIX=/workspace/install \
-DCMAKE_MODULE_PATH=$MLIR_DIR/cmake/modulesXilinx \
-DMLIR_DIR=/workspace/mlir/lib/cmake/mlir
ninja install
ninja check-aie
popd
6 changes: 3 additions & 3 deletions .github/workflows/buildRyzenWheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
pip -q download mlir==$VERSION \
Expand Down Expand Up @@ -116,9 +117,7 @@ jobs:
fail-fast: false
matrix:
python_version: [
# "3.8", "3.9",
"3.10",
# "3.11", "3.12"
"3.10", "3.12",
]

steps:
Expand Down Expand Up @@ -158,6 +157,7 @@ jobs:
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
source aie-venv/bin/activate
export MLIR_INSTALL_ABS_PATH=$PWD/mlir
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lintAndFormat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
pip install cmake==3.27.9 numpy psutil pybind11 rich pkginfo lit PyYAML requests
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
- name: Get MLIR
id: mlir-wheels
Expand Down Expand Up @@ -204,6 +205,7 @@ jobs:
run: |
pip install cmake numpy psutil pybind11 rich lit
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
- name: Install packages
run: sudo apt-get install -y ninja-build clang lld llvm libelf-dev
Expand Down Expand Up @@ -236,6 +238,7 @@ jobs:
if: steps.changed-files.outputs.changed-files != ''
run: |
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
- name: Build and generate coverage (Release)
if: steps.changed-files.outputs.changed-files != ''
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/mlirAIEDistro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ jobs:
export PIP_NO_BUILD_ISOLATION=false
pip install -r requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
pip install importlib-metadata
CIBW_ARCHS=${{ matrix.ARCH }} MATRIX_OS=${{ matrix.OS }} ./scripts/download_mlir.sh
Expand Down Expand Up @@ -360,6 +361,7 @@ jobs:
with:
sparse-checkout: |
python/requirements.txt
python/requirements_extras.txt
- uses: actions/download-artifact@v3
with:
Expand All @@ -374,6 +376,7 @@ jobs:
shell: bash
run: |
pip install -r python/requirements.txt
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
unzip -o -q dist/mlir_aie\*.whl
if [ x"${{ matrix.ENABLE_RTTI }}" == x"ON" ]; then
Expand All @@ -383,6 +386,8 @@ jobs:
fi
python -c 'import aie.ir'
python -c 'import aie.extras'
python -c 'import aie.helpers'
upload_wheels:

Expand Down
6 changes: 5 additions & 1 deletion aie_kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ function(add_aie_kernels arch)
if(EXISTS "${PROJECT_SOURCE_DIR}/tools/chess-clang/xchesscc_wrapper")
add_custom_target(${arch}_kernels ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mm.o)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mm.o
COMMAND ${PROJECT_SOURCE_DIR}/tools/chess-clang/xchesscc_wrapper ${arch} -I ${VITIS_AIETOOLS_DIR}/include -c ${CMAKE_CURRENT_SOURCE_DIR}/mm.cc -o ${CMAKE_CURRENT_BINARY_DIR}/mm.o
COMMAND ${PROJECT_SOURCE_DIR}/tools/chess-clang/xchesscc_wrapper ${arch}
-aietools ${VITIS_AIETOOLS_DIR}
-I ${VITIS_AIETOOLS_DIR}/include
-c ${CMAKE_CURRENT_SOURCE_DIR}/mm.cc
-o ${CMAKE_CURRENT_BINARY_DIR}/mm.o
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mm.cc)
add_dependencies(aie-kernels ${arch}_kernels)

Expand Down
8 changes: 4 additions & 4 deletions aie_kernels/aie2/cascade_mm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void matmul_scalar_cascade_put_only(T_in *a, T_in *b, T_out *c) {
running_sum += a[row * colA + i] * b[i * colB + col];
}
v16int32 v16 = undef_v16int32();
v16 = upd_elem(v16, 0, running_sum);
v16 = upd_elem(v16, 0, (int)running_sum);
put_mcd(v16);
}
}
Expand All @@ -51,7 +51,7 @@ void matmul_scalar_cascade_get_only(T_in *a, T_in *b, T_out *c) {
running_sum += a[row * colA + i] * b[i * colB + col];
}
v16int32 v16 = get_scd_v16int32();
running_sum += ext_elem(v16, 0);
running_sum += ext_elem(v16, 0U);
c[row * colB + col] += running_sum;
}
}
Expand All @@ -68,8 +68,8 @@ void matmul_scalar_cascade_put_get(T_in *a, T_in *b, T_out *c) {
running_sum += a[row * colA + i] * b[i * colB + col];
}
v16int32 v16 = get_scd_v16int32();
running_sum += ext_elem(v16, 0);
v16 = upd_elem(v16, 0, running_sum);
running_sum += ext_elem(v16, 0U);
v16 = upd_elem(v16, 0, (int)running_sum);
put_mcd(v16);
}
}
Expand Down
10 changes: 5 additions & 5 deletions aie_kernels/aie2/reduce_add.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ static void _reduce_add_vector(int32_t *restrict in, int32_t *restrict out,
running_total = test;
}
after_vector = running_total;
v16int32 first = shift_bytes(after_vector, after_vector, 32);
v16int32 first = shift_bytes(after_vector, after_vector, 32U);
v16int32 second = add(after_vector, first);
v16int32 second_shift = shift_bytes(second, second, 16);
v16int32 second_shift = shift_bytes(second, second, 16U);
v16int32 third = add(second, second_shift);
v16int32 third_shift = shift_bytes(third, third, 8);
v16int32 third_shift = shift_bytes(third, third, 8U);
v16int32 fourth = add(third, third_shift);
v16int32 fourth_shift = shift_bytes(fourth, fourth, 4);
v16int32 fourth_shift = shift_bytes(fourth, fourth, 4U);
v16int32 fifth = add(fourth, fourth_shift);
int32_t last = extract_elem(fifth, 0);
int32_t last = extract_elem(fifth, 0U);
*(int32_t *)out = last;
return;
}
Expand Down
Loading

0 comments on commit 11cd228

Please sign in to comment.