Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
15db45b
AIE2P in required devices for lit
jgmelber May 7, 2025
d1fd8c9
And AIE2P for programming guide
jgmelber May 7, 2025
70a5960
Find components at runtime and fix pg/section-1 placed
jgmelber May 7, 2025
38da277
Find architectures at runtime
jgmelber May 7, 2025
6d4d691
Disable for npu-xrt to try on CI
jgmelber May 7, 2025
15c1d0b
[TEST] No Chess buildAndTestRyzenAI.yml
jgmelber May 8, 2025
4d51e58
Fix requires in packet_switch example
jgmelber May 8, 2025
ce176eb
[TEST] Try install aie runtime libs without chess
jgmelber May 8, 2025
3c2d621
Merge branch 'main' into peano-build
jgmelber May 8, 2025
729f640
[TEST] Split precompile and runtime libs
jgmelber May 8, 2025
5101d26
[TEST] split with subdirectories
jgmelber May 8, 2025
0df9881
Merge branch 'main' into peano-build
jgmelber Oct 31, 2025
c017ae7
Fix bootgen with main
jgmelber Oct 31, 2025
028e18a
Find AIE architectures in Peano
jgmelber Oct 31, 2025
f87c11e
Add dev requriements to no chess action
jgmelber Oct 31, 2025
831a410
Add more requriements to no chess action
jgmelber Oct 31, 2025
4bb8cd0
Add venv activate line back
jgmelber Oct 31, 2025
e90c38b
Find IRON_CACHE_HOME
jgmelber Oct 31, 2025
3ca4b39
Don't make xchesscc/xbridge the default if Vitis not found
jgmelber Nov 3, 2025
aab5ba5
Use found AIETools not Vitis
jgmelber Nov 3, 2025
5b44755
Merge branch 'main' into peano-build
jgmelber Nov 3, 2025
f486ed9
Fix vector scalar mul test
jgmelber Nov 3, 2025
53990a5
Merge branch 'main' into peano-build
jgmelber Nov 5, 2025
c7fdb59
Use find Peano cmake
jgmelber Nov 5, 2025
04900a7
Merge branch 'peano-build' of https://github.com/Xilinx/mlir-aie into…
jgmelber Nov 6, 2025
d958a52
Merge branch 'main' into peano-build
jgmelber Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions .github/workflows/buildAndTestRyzenAI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,146 @@ jobs:
ninja check-reference-designs
ninja check-programming-guide
popd

build-tests-no-chess:
name: Run Tests on Ryzen AI No Chess
runs-on: ${{ matrix.runner_type }}
strategy:
fail-fast: false
matrix:
runner_type: [ amd7940hs, amdhx370 ]
env:
IRON_CACHE_HOME: ${{ github.workspace }}/iron-cache-${{ matrix.runner_type }}-${{ github.run_id }}
steps:
- uses: actions/checkout@v4
with:
submodules: "true"

# Launch an ssh session via a proxy server if there is a need
# for debug. This seems to live for 35 min max
# https://github.com/mxschmitt/action-tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
# To run this, launch it manually on the default branch and
# click on "launch_tmate_terminal_for_debug"
if: github.event_name == 'workflow_dispatch'
&& inputs.launch_tmate_terminal_for_debug

- name: Run commands
run: |
sudo prlimit -lunlimited --pid $$
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
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt
pip install -r python/requirements_notebook.txt
pip install -r python/requirements_ml.txt
pip install -r python/requirements_dev.txt

# Install llvm-aie (Peano) which is needed for unittests requiring compiling NPU code
pip install -I llvm-aie -f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly
export PEANO_INSTALL_DIR="$(pip show llvm-aie | grep ^Location: | awk '{print $2}')/llvm-aie"

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 {} \;

mkdir build
pushd build

# -j here to reduce the number of parallel chess jobs.
# -j4 for 32GB RAM, -j12 for 64GB RAM
if [ x"${{ matrix.runner_type }}" == x"amdhx370" ]; then
LIT_OPTS="-j4 $LIT_OPTS"
else
LIT_OPTS="-j12 $LIT_OPTS"
fi

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

# Create runner-specific cache directory
mkdir -p $IRON_CACHE_HOME

ninja install
ninja check-aie

popd

build-quick-setup-no-chess:
name: Run Examples on Ryzen AI No Chess
runs-on: ${{ matrix.runner_type }}
strategy:
fail-fast: false
matrix:
runner_type: [ amd7940hs, amdhx370 ]
env:
IRON_CACHE_HOME: ${{ github.workspace }}/iron-cache-${{ matrix.runner_type }}-${{ github.run_id }}
steps:
- uses: actions/checkout@v4
with:
submodules: "true"

# Launch an ssh session via a proxy server if there is a need
# for debug. This seems to live for 35 min max
# https://github.com/mxschmitt/action-tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
# To run this, launch it manually on the default branch and
# click on "launch_tmate_terminal_for_debug"
if: github.event_name == 'workflow_dispatch'
&& inputs.launch_tmate_terminal_for_debug

- name: Run commands
run: |
sudo prlimit -lunlimited --pid $$
pip cache purge
source /opt/xilinx/xrt/setup.sh
source utils/quick_setup.sh
# quick_setup changes directory to programming_examples, so we need to return to mlir-aie
cd ..
pip install -r python/requirements_dev.txt

./utils/build-mlir-aie-from-wheels.sh

# 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.
pushd my_install
find mlir -exec touch -a -m -t 201108231405.14 {} \;
popd

# build is created by the build-mlir-aie-from-wheels.sh script
pushd build

# -j here to reduce the number of parallel chess jobs.
# -j4 for 32GB RAM, -j12 for 64GB RAM
if [ x"${{ matrix.runner_type }}" == x"amdhx370" ]; then
LIT_OPTS="-j4 $LIT_OPTS"
else
LIT_OPTS="-j12 $LIT_OPTS"
fi

# Create runner-specific cache directory
mkdir -p $IRON_CACHE_HOME

ninja install
ninja check-reference-designs
ninja check-programming-guide

popd
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ set(AIE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
find_package(Vitis 2023.2 COMPONENTS ${AIE_VITIS_COMPONENTS})
configure_file(./utils/vitisVariables.config.in
${CMAKE_BINARY_DIR}/utils/vitisVariables.config @ONLY)
find_package(Peano COMPONENTS ${AIE_VITIS_COMPONENTS})
find_package(XRT)
find_package(hsa-runtime64)

Expand Down Expand Up @@ -178,10 +179,10 @@ cmake_dependent_option(AIECC_HOST_COMPILE
"Set aiecc to host compile." ON "NOT HOST_COMPILER STREQUAL NONE" OFF)

cmake_dependent_option(AIECC_COMPILE_WITH_XCHESSCC
"Set aiecc to compile with chess." ON "AIECC_COMPILE;AIE_COMPILER STREQUAL XCHESSCC" OFF)
"Set aiecc to compile with chess." ON "AIECC_COMPILE;AIE_COMPILER STREQUAL XCHESSCC;AIETools_FOUND" OFF)

cmake_dependent_option(AIECC_LINK_WITH_XCHESSCC
"Set aiecc to link with chess." ON "AIECC_LINK;AIE_LINKER STREQUAL XCHESSCC" OFF)
"Set aiecc to link with chess." ON "AIECC_LINK;AIE_LINKER STREQUAL XCHESSCC;AIETools_FOUND" OFF)

# If we need runtime libs, then statically link them.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
Expand Down
3 changes: 3 additions & 0 deletions aie_runtime_lib/AIE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@

add_aie_runtime_libs(AIE)

if(AIETools_AIE_FOUND)
compile_aie_runtime_libs(AIE)
endif()
4 changes: 4 additions & 0 deletions aie_runtime_lib/AIE2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
# (c) Copyright 2021 Xilinx Inc.

add_aie_runtime_libs(AIE2)

if(AIETools_AIE2_FOUND OR Peano_AIE2_FOUND)
compile_aie_runtime_libs(AIE2)
endif()
4 changes: 4 additions & 0 deletions aie_runtime_lib/AIE2P/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
# (c) Copyright 2024 Xilinx Inc.

add_aie_runtime_libs(AIE2P)

if(AIETools_AIE2P_FOUND OR Peano_AIE2P_FOUND)
compile_aie_runtime_libs(AIE2P)
endif()
57 changes: 26 additions & 31 deletions aie_runtime_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,6 @@
add_custom_target(aie-runtime-libs ALL)

function(add_aie_runtime_libs arch)
# Precompile the intrinsic wrappers.
if(DEFINED VITIS_AIETOOLS_DIR)
string(TOLOWER ${arch} aiearch)
add_custom_target(${arch}_chess_intrinsic_wrapper ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll
COMMAND ${PROJECT_BINARY_DIR}/bin/xchesscc_wrapper ${arch}
-aietools ${AIETOOLS_DIR}
-c ${CMAKE_CURRENT_SOURCE_DIR}/chess_intrinsic_wrapper.cpp
-d # Disassemble output
-f # Use LLVM frontend
+f # ... and emit LLVMIR
-o ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll
COMMAND sed -i s/^target.*//
${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll
DEPENDS
xchesscc_wrapper
${CMAKE_CURRENT_SOURCE_DIR}/chess_intrinsic_wrapper.cpp)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll DESTINATION ${CMAKE_INSTALL_PREFIX}/aie_runtime_lib/${arch})
add_dependencies(aie-runtime-libs ${arch}_chess_intrinsic_wrapper)
endif()

set(INSTALLS
lut_based_ops.cpp
Expand All @@ -50,15 +30,30 @@ function(add_aie_runtime_libs arch)

endfunction()

# Compile AIE runtime libs if component found
if(AIETools_AIE_FOUND)
add_subdirectory(AIE)
endif()
if(AIETools_AIE2_FOUND)
add_subdirectory(AIE2)
endif()
if(AIETools_AIE2P_FOUND)
add_subdirectory(AIE2P)
endif()

function (compile_aie_runtime_libs arch)
# Precompile the intrinsic wrappers.
if(DEFINED VITIS_AIETOOLS_DIR)
string(TOLOWER ${arch} aiearch)
add_custom_target(${arch}_chess_intrinsic_wrapper ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll
COMMAND ${PROJECT_BINARY_DIR}/bin/xchesscc_wrapper ${arch}
-aietools ${AIETOOLS_DIR}
-c ${CMAKE_CURRENT_SOURCE_DIR}/chess_intrinsic_wrapper.cpp
-d # Disassemble output
-f # Use LLVM frontend
+f # ... and emit LLVMIR
-o ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll
COMMAND sed -i s/^target.*//
${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll
DEPENDS
xchesscc_wrapper
${CMAKE_CURRENT_SOURCE_DIR}/chess_intrinsic_wrapper.cpp)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll DESTINATION ${CMAKE_INSTALL_PREFIX}/aie_runtime_lib/${arch})
add_dependencies(aie-runtime-libs ${arch}_chess_intrinsic_wrapper)
endif()
endfunction()

# Install headers and compile AIE runtime libs
add_subdirectory(AIE)
add_subdirectory(AIE2)
add_subdirectory(AIE2P)
2 changes: 1 addition & 1 deletion mlir_exercises/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ config.aieInstallPrefix = "@CMAKE_INSTALL_PREFIX@"
config.vitis_components = []
if lit.util.pythonize_bool("@AIETools_AIE_FOUND@"):
config.vitis_components.append("AIE")
if lit.util.pythonize_bool("@AIETools_AIE2_FOUND@"):
if lit.util.pythonize_bool("@AIETools_AIE2_FOUND@") or lit.util.pythonize_bool("@Peano_AIE2_FOUND@"):
config.vitis_components.append("AIE2")

# Support substitution of the tools_dir with user parameters. This is
Expand Down
2 changes: 1 addition & 1 deletion programming_examples/basic/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

config.suffixes = ['.lit']

if 'AIE2' not in config.vitis_components:
if 'AIE2' not in config.vitis_components and 'AIE2P' not in config.vitis_components:
config.unsupported = True
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
//
// RUN: make -f %S/Makefile clean
// RUN: make -f %S/Makefile
// RUN: %run_on_npu1% make -f %S/Makefile run
// RUN: %run_on_npu1% make -f %S/Makefile run
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// RUN: make -f %S/Makefile clean
// RUN: env CHESS=false use_placed=1 make -f %S/Makefile
// RUN: %run_on_npu1% make -f %S/Makefile run
// RUN: %run_on_npu1% make -f %S/Makefile run_py
// RUN: make -f %S/Makefile clean
// RUN: env CHESS=false use_placed=1 %run_on_npu1% make -f %S/Makefile trace
// RUN: env CHESS=false use_placed=1 %run_on_npu1% make -f %S/Makefile trace_py
2 changes: 1 addition & 1 deletion programming_examples/experimental/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

config.suffixes = ['.lit']

if 'AIE2' not in config.vitis_components:
if 'AIE2' not in config.vitis_components and 'AIE2P' not in config.vitis_components:
config.unsupported = True
22 changes: 16 additions & 6 deletions programming_examples/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@
# Not using run_on_board anymore, need more specific per-platform commands
config.substitutions.append(("%run_on_board", "echo"))

# Detect Peano backend first to get supported architectures
peano_tools_dir = os.path.join(config.peano_install_dir, "bin")
peano_config = LitConfigHelper.detect_peano(
peano_tools_dir, config.peano_install_dir, llvm_config
)

# Add Peano-detected components to vitis_components if not already present
peano_components_str = peano_config.substitutions.get("%peano_components%", "[]")
try:
peano_components = eval(peano_components_str)
for comp in peano_components:
if comp not in config.vitis_components:
config.vitis_components.append(comp)
except Exception:
pass

# Add Vitis components as features
LitConfigHelper.add_vitis_components_features(config, config.vitis_components)

Expand Down Expand Up @@ -107,18 +123,12 @@
# Prepend path to XRT installation, which contains a more recent `aiebu-asm` than the Vitis installation.
LitConfigHelper.prepend_path(llvm_config, config.xrt_bin_dir)

peano_tools_dir = os.path.join(config.peano_install_dir, "bin")
LitConfigHelper.prepend_path(llvm_config, config.llvm_tools_dir)
LitConfigHelper.prepend_path(llvm_config, peano_tools_dir)
config.substitutions.append(("%LLVM_TOOLS_DIR", config.llvm_tools_dir))

tool_dirs = [config.aie_tools_dir, config.llvm_tools_dir]

# Detect Peano backend
peano_config = LitConfigHelper.detect_peano(
peano_tools_dir, config.peano_install_dir, llvm_config
)

# Detect Chess compiler
chess_config = LitConfigHelper.detect_chess(
config.vitis_root, config.enable_chess_tests, llvm_config
Expand Down
4 changes: 2 additions & 2 deletions programming_examples/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ config.aieInstallPrefix = "@CMAKE_INSTALL_PREFIX@"
config.vitis_components = []
if lit.util.pythonize_bool("@AIETools_AIE_FOUND@"):
config.vitis_components.append("AIE")
if lit.util.pythonize_bool("@AIETools_AIE2_FOUND@"):
if lit.util.pythonize_bool("@AIETools_AIE2_FOUND@") or lit.util.pythonize_bool("@Peano_AIE2_FOUND@"):
config.vitis_components.append("AIE2")
if lit.util.pythonize_bool("@AIETools_AIE2P_FOUND@"):
if lit.util.pythonize_bool("@AIETools_AIE2P_FOUND@") or lit.util.pythonize_bool("@Peano_AIE2P_FOUND@"):
config.vitis_components.append("AIE2P")

# Support substitution of the tools_dir with user parameters. This is
Expand Down
2 changes: 1 addition & 1 deletion programming_examples/ml/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

config.suffixes = ['.lit']

if 'AIE2' not in config.vitis_components:
if 'AIE2' not in config.vitis_components and 'AIE2P' not in config.vitis_components:
config.unsupported = True
2 changes: 1 addition & 1 deletion programming_examples/vision/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

config.suffixes = ['.lit']

if 'AIE2' not in config.vitis_components:
if 'AIE2' not in config.vitis_components and 'AIE2P' not in config.vitis_components:
config.unsupported = True
Loading
Loading