diff --git a/.github/workflows/buildAndTestRyzenAI.yml b/.github/workflows/buildAndTestRyzenAI.yml index e470786dd6..918851e3c6 100644 --- a/.github/workflows/buildAndTestRyzenAI.yml +++ b/.github/workflows/buildAndTestRyzenAI.yml @@ -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 \ @@ -97,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) \ @@ -134,11 +134,11 @@ jobs: pip cache purge source /opt/xilinx/xrt/setup.sh - export PATH=/opt/Xilinx/Vitis/2023.2/bin:/opt/Xilinx/Vitis/2023.2/aietools/bin:$PATH + 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 + ./utils/build-mlir-aie-from-wheels.sh ./my_install/mlir build install ./my_install/llvm-aie # build is created by the build-mlir-aie-from-wheels.sh script pushd build diff --git a/aie_kernels/generic/passThrough.cc b/aie_kernels/generic/passThrough.cc index 1de33066d1..ccdb5f27f2 100644 --- a/aie_kernels/generic/passThrough.cc +++ b/aie_kernels/generic/passThrough.cc @@ -12,7 +12,6 @@ #define NOCPP #include -#include #include #include @@ -37,39 +36,33 @@ extern "C" { #if BIT_WIDTH == 8 void passThroughLine(uint8_t *in, uint8_t *out, int32_t lineWidth) { - printf("passThroughLine BIT_WIDTH\n"); passThrough_aie(in, out, 1, lineWidth); } void passThroughTile(uint8_t *in, uint8_t *out, int32_t tileHeight, int32_t tileWidth) { - printf("passThroughTile BIT_WIDTH\n"); passThrough_aie(in, out, tileHeight, tileWidth); } #elif BIT_WIDTH == 16 void passThroughLine(int16_t *in, int16_t *out, int32_t lineWidth) { - printf("passThroughLine BIT_WIDTH\n"); passThrough_aie(in, out, 1, lineWidth); } void passThroughTile(int16_t *in, int16_t *out, int32_t tileHeight, int32_t tileWidth) { - printf("passThroughTile BIT_WIDTH\n"); passThrough_aie(in, out, tileHeight, tileWidth); } #else // 32 void passThroughLine(int32_t *in, int32_t *out, int32_t lineWidth) { - printf("passThroughLine BIT_WIDTH\n"); passThrough_aie(in, out, 1, lineWidth); } void passThroughTile(int32_t *in, int32_t *out, int32_t tileHeight, int32_t tileWidth) { - printf("passThroughTile BIT_WIDTH\n"); passThrough_aie(in, out, tileHeight, tileWidth); } diff --git a/programming_examples/basic/dma_transpose/Makefile b/programming_examples/basic/dma_transpose/Makefile index 888e9c240c..69c1292070 100644 --- a/programming_examples/basic/dma_transpose/Makefile +++ b/programming_examples/basic/dma_transpose/Makefile @@ -27,6 +27,7 @@ build/aie.mlir: ${srcdir}/aie2.py build/final.xclbin: build/aie.mlir mkdir -p ${@D} cd ${@D} && aiecc.py --aie-generate-cdo --no-compile-host --xclbin-name=${@F} \ + --no-xchesscc --no-xbridge --peano ${PEANO_INSTALL_DIR} \ --aie-generate-npu --npu-insts-name=insts.txt $(<:%=../%) ${targetname}.exe: ${srcdir}/test.cpp diff --git a/programming_examples/basic/dma_transpose/run_makefile.lit b/programming_examples/basic/dma_transpose/run_makefile.lit index 6875524001..cdae3657a2 100644 --- a/programming_examples/basic/dma_transpose/run_makefile.lit +++ b/programming_examples/basic/dma_transpose/run_makefile.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: make -f %S/Makefile clean // RUN: make -f %S/Makefile diff --git a/programming_examples/basic/matrix_multiplication/cascade/Makefile b/programming_examples/basic/matrix_multiplication/cascade/Makefile index ffbc860c27..2bb2540969 100644 --- a/programming_examples/basic/matrix_multiplication/cascade/Makefile +++ b/programming_examples/basic/matrix_multiplication/cascade/Makefile @@ -25,6 +25,8 @@ target_suffix=${M}x${K}x${N}_${m}x${k}x${n}_${n_aie_cols}c include ${srcdir}/../makefile-common +CHESS=true + build/mm_${m}x${k}x${n}.o: ${kernels_dir}/cascade_mm.cc mkdir -p ${@D} cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} diff --git a/programming_examples/basic/matrix_multiplication/makefile-common b/programming_examples/basic/matrix_multiplication/makefile-common index 3d0a8ec01e..182c0d6a4c 100644 --- a/programming_examples/basic/matrix_multiplication/makefile-common +++ b/programming_examples/basic/matrix_multiplication/makefile-common @@ -81,6 +81,8 @@ aie_py_src?=aie2.py runargs?=-v 2 --warmup 1 --iters 1 aieargs+=-M $M -K $K -N $N --dtype_in ${dtype_in} --dtype_out ${dtype_out} +CHESS?=false + kernels_dir=${srcdir}/../../../../aie_kernels/aie2 .PHONY: all @@ -88,7 +90,7 @@ all: ${xclbin_target} ${targetname}.exe build/%.o: ${kernels_dir}/%.cc mkdir -p ${@D} - cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -c $< -o ${@F} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DBIT_WIDTH=8 -c $< -o ${@F} ${mlir_target}: ${srcdir}/${aie_py_src} mkdir -p ${@D} @@ -97,6 +99,9 @@ ${mlir_target}: ${srcdir}/${aie_py_src} ${xclbin_target}: ${mlir_target} ${kernels:%=build/%.o} mkdir -p ${@D} cd ${@D} && aiecc.py --aie-generate-cdo --no-compile-host --xclbin-name=${@F} \ + $(if $(shell [ $(CHESS) != true ] && echo true), \ + --no-xchesscc --no-xbridge --peano ${PEANO_INSTALL_DIR}, \ + ) \ --aie-generate-npu --npu-insts-name=${insts_target:build/%=%} $(<:%=../%) ${targetname}.exe: ${srcdir}/test.cpp ${srcdir}/../test.cpp ${srcdir}/../common.h diff --git a/programming_examples/basic/matrix_multiplication/matrix_vector/Makefile b/programming_examples/basic/matrix_multiplication/matrix_vector/Makefile index 0b88616bae..7397be0501 100644 --- a/programming_examples/basic/matrix_multiplication/matrix_vector/Makefile +++ b/programming_examples/basic/matrix_multiplication/matrix_vector/Makefile @@ -26,5 +26,5 @@ include ${SELF_DIR}../makefile-common build/mv_${m}x${k}.o: ${kernels_dir}/mv.cc mkdir -p ${@D} - cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -c $< -o ${@F} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -c $< -o ${@F} diff --git a/programming_examples/basic/matrix_multiplication/matrix_vector/Makefile.chess b/programming_examples/basic/matrix_multiplication/matrix_vector/Makefile.chess new file mode 100644 index 0000000000..0a999fb365 --- /dev/null +++ b/programming_examples/basic/matrix_multiplication/matrix_vector/Makefile.chess @@ -0,0 +1,32 @@ +##===- Makefile -----------------------------------------------------------===## +# +# This file licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# Copyright (C) 2024, Advanced Micro Devices, Inc. +# +##===----------------------------------------------------------------------===## + +subdir=matrix_vector +targetname=matrixVectorMultiplication + +# Currently does not accept reconfiguring size via these variables; must change +# in source at aie2.py as well as here +M=288 +K=288 +N=1 +m=32 +k=32 + +kernels=mv_${m}x${k} + +SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +include ${SELF_DIR}../makefile-common + +CHESS=true + +build/mv_${m}x${k}.o: ${kernels_dir}/mv.cc + mkdir -p ${@D} + cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -c $< -o ${@F} + diff --git a/programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile.lit b/programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile.lit index 6875524001..cdae3657a2 100644 --- a/programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile.lit +++ b/programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: make -f %S/Makefile clean // RUN: make -f %S/Makefile diff --git a/programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile_chess.lit b/programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile_chess.lit new file mode 100644 index 0000000000..1e6a64cf1f --- /dev/null +++ b/programming_examples/basic/matrix_multiplication/matrix_vector/run_makefile_chess.lit @@ -0,0 +1,9 @@ +// (c) Copyright 2024 Advanced Micro Devices, Inc. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// REQUIRES: ryzen_ai, chess +// +// RUN: make -f %S/Makefile.chess clean +// RUN: make -f %S/Makefile.chess +// RUN: %run_on_npu make -f %S/Makefile.chess run | FileCheck %s +// CHECK: PASS! diff --git a/programming_examples/basic/matrix_multiplication/single_core/Makefile b/programming_examples/basic/matrix_multiplication/single_core/Makefile index a04e7f67bf..587d057e05 100644 --- a/programming_examples/basic/matrix_multiplication/single_core/Makefile +++ b/programming_examples/basic/matrix_multiplication/single_core/Makefile @@ -33,5 +33,5 @@ include ${srcdir}/../makefile-common build/mm_${m}x${k}x${n}.o: ${kernels_dir}/mm.cc mkdir -p ${@D} - cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -D${dtype_in}_${dtype_out}_ONLY -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DBIT_WIDTH=8 -D${dtype_in}_${dtype_out}_ONLY -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} diff --git a/programming_examples/basic/matrix_multiplication/single_core/Makefile.chess b/programming_examples/basic/matrix_multiplication/single_core/Makefile.chess new file mode 100644 index 0000000000..229fb6eabc --- /dev/null +++ b/programming_examples/basic/matrix_multiplication/single_core/Makefile.chess @@ -0,0 +1,39 @@ +##===- Makefile -----------------------------------------------------------===## +# +# This file licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# Copyright (C) 2024, Advanced Micro Devices, Inc. +# +##===----------------------------------------------------------------------===## + +srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +subdir=single_core +targetname=matrixMultiplication +kernels=mm + +M?=256 +K?=256 +N?=256 +m?=64 +k?=64 +n?=32 + +kernels=mm_${m}x${k}x${n} +aieargs+=-m $m -k $k -n $n +target_suffix=${M}x${K}x${N}_${m}x${k}x${n} +use_alt?=0 + +ifeq (${use_alt}, 1) +aie_py_src=aie2_alt.py +endif + +include ${srcdir}/../makefile-common + +CHESS=true + +build/mm_${m}x${k}x${n}.o: ${kernels_dir}/mm.cc + mkdir -p ${@D} + cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -D${dtype_in}_${dtype_out}_ONLY -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} + diff --git a/programming_examples/basic/matrix_multiplication/single_core/run_makefile.lit b/programming_examples/basic/matrix_multiplication/single_core/run_makefile.lit index f5014c39d3..00e62e1362 100644 --- a/programming_examples/basic/matrix_multiplication/single_core/run_makefile.lit +++ b/programming_examples/basic/matrix_multiplication/single_core/run_makefile.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_1 // RUN: cd %S/test_1 diff --git a/programming_examples/basic/matrix_multiplication/single_core/run_makefile_1.lit b/programming_examples/basic/matrix_multiplication/single_core/run_makefile_1.lit index 6b198065c1..76e86dad05 100644 --- a/programming_examples/basic/matrix_multiplication/single_core/run_makefile_1.lit +++ b/programming_examples/basic/matrix_multiplication/single_core/run_makefile_1.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_2 // RUN: cd %S/test_2 diff --git a/programming_examples/basic/matrix_multiplication/single_core/run_makefile_alt.lit b/programming_examples/basic/matrix_multiplication/single_core/run_makefile_alt.lit index 7c11ec3de3..c5a0ff383d 100644 --- a/programming_examples/basic/matrix_multiplication/single_core/run_makefile_alt.lit +++ b/programming_examples/basic/matrix_multiplication/single_core/run_makefile_alt.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_alt // RUN: cd %S/test_alt diff --git a/programming_examples/basic/matrix_multiplication/single_core/run_makefile_chess.lit b/programming_examples/basic/matrix_multiplication/single_core/run_makefile_chess.lit new file mode 100644 index 0000000000..1e6a64cf1f --- /dev/null +++ b/programming_examples/basic/matrix_multiplication/single_core/run_makefile_chess.lit @@ -0,0 +1,9 @@ +// (c) Copyright 2024 Advanced Micro Devices, Inc. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// REQUIRES: ryzen_ai, chess +// +// RUN: make -f %S/Makefile.chess clean +// RUN: make -f %S/Makefile.chess +// RUN: %run_on_npu make -f %S/Makefile.chess run | FileCheck %s +// CHECK: PASS! diff --git a/programming_examples/basic/matrix_multiplication/single_core/run_makefile_i8.lit b/programming_examples/basic/matrix_multiplication/single_core/run_makefile_i8.lit index 77e318dbc0..cc457ddb59 100644 --- a/programming_examples/basic/matrix_multiplication/single_core/run_makefile_i8.lit +++ b/programming_examples/basic/matrix_multiplication/single_core/run_makefile_i8.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_i8 // RUN: cd %S/test_i8 diff --git a/programming_examples/basic/matrix_multiplication/whole_array/Makefile b/programming_examples/basic/matrix_multiplication/whole_array/Makefile index 1a70838cd4..3aa1a0283e 100644 --- a/programming_examples/basic/matrix_multiplication/whole_array/Makefile +++ b/programming_examples/basic/matrix_multiplication/whole_array/Makefile @@ -29,11 +29,11 @@ include ${srcdir}/../makefile-common build/mm_b_row_maj_${m}x${k}x${n}.o: ${kernels_dir}/mm.cc mkdir -p ${@D} - cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -D${dtype_in}_${dtype_out}_ONLY -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DBIT_WIDTH=8 -D${dtype_in}_${dtype_out}_ONLY -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} build/mm_b_col_maj_${m}x${k}x${n}.o: ${kernels_dir}/mm_b_col_maj.cc mkdir -p ${@D} - cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} ifneq (${b_col_maj}, 1) build/mm_${m}x${k}x${n}.o: build/mm_b_row_maj_${m}x${k}x${n}.o diff --git a/programming_examples/basic/matrix_multiplication/whole_array/Makefile.chess b/programming_examples/basic/matrix_multiplication/whole_array/Makefile.chess new file mode 100644 index 0000000000..df8178d460 --- /dev/null +++ b/programming_examples/basic/matrix_multiplication/whole_array/Makefile.chess @@ -0,0 +1,48 @@ +##===- Makefile -----------------------------------------------------------===## +# +# This file licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# Copyright (C) 2024, Advanced Micro Devices, Inc. +# +##===----------------------------------------------------------------------===## +srcdir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +subdir=whole_array +targetname=matrixMultiplication + +M?=640 +K?=896 +N?=768 +m?=16 +k?=32 +n?=48 +n_aie_cols?=2 +b_col_maj?=0 + +kernels=mm_${m}x${k}x${n} +aieargs+=-m $m -k $k -n $n --n-aie-cols ${n_aie_cols} --b-col-maj ${b_col_maj} +runargs+=--b_col_maj ${b_col_maj} +target_suffix=${M}x${K}x${N}_${m}x${k}x${n}_${n_aie_cols}c + +include ${srcdir}/../makefile-common + +CHESS=true + +build/mm_b_row_maj_${m}x${k}x${n}.o: ${kernels_dir}/mm.cc + mkdir -p ${@D} + cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -D${dtype_in}_${dtype_out}_ONLY -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} + +build/mm_b_col_maj_${m}x${k}x${n}.o: ${kernels_dir}/mm_b_col_maj.cc + mkdir -p ${@D} + cd ${@D} && xchesscc_wrapper ${CHESSCCWRAP2_FLAGS} -DBIT_WIDTH=8 -DDIM_M=${m} -DDIM_K=${k} -DDIM_N=${n} -c $< -o ${@F} + +ifneq (${b_col_maj}, 1) +build/mm_${m}x${k}x${n}.o: build/mm_b_row_maj_${m}x${k}x${n}.o + mkdir -p ${@D} + ar rvs $@ $^ +else +build/mm_${m}x${k}x${n}.o: build/mm_b_col_maj_${m}x${k}x${n}.o + mkdir -p ${@D} + ar rvs $@ $^ +endif diff --git a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_1_col.lit b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_1_col.lit index 9234eb1e67..db6bbcce1a 100644 --- a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_1_col.lit +++ b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_1_col.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_1_col // RUN: cd %S/test_1_col diff --git a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_2_col.lit b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_2_col.lit index 859d669d0d..7bfcfffa15 100644 --- a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_2_col.lit +++ b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_2_col.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_2_col // RUN: cd %S/test_2_col diff --git a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col.lit b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col.lit index 170a68df0e..b101683158 100644 --- a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col.lit +++ b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_4_col // RUN: cd %S/test_4_col diff --git a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col_i8.lit b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col_i8.lit index c9007d1065..011bc05005 100644 --- a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col_i8.lit +++ b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_4_col_i8.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_4_col_i8 // RUN: cd %S/test_4_col_i8 diff --git a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_chess.lit b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_chess.lit new file mode 100644 index 0000000000..1e6a64cf1f --- /dev/null +++ b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_chess.lit @@ -0,0 +1,9 @@ +// (c) Copyright 2024 Advanced Micro Devices, Inc. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// REQUIRES: ryzen_ai, chess +// +// RUN: make -f %S/Makefile.chess clean +// RUN: make -f %S/Makefile.chess +// RUN: %run_on_npu make -f %S/Makefile.chess run | FileCheck %s +// CHECK: PASS! diff --git a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_col_maj.lit b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_col_maj.lit index b4503c39bc..5bfdf7bdfe 100644 --- a/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_col_maj.lit +++ b/programming_examples/basic/matrix_multiplication/whole_array/run_makefile_col_maj.lit @@ -1,7 +1,7 @@ // (c) Copyright 2024 Advanced Micro Devices, Inc. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// REQUIRES: ryzen_ai, chess +// REQUIRES: ryzen_ai, peano // // RUN: mkdir -p %S/test_b_col_maj // RUN: cd %S/test_b_col_maj diff --git a/programming_examples/basic/matrix_scalar_add/Makefile b/programming_examples/basic/matrix_scalar_add/Makefile index 35b3d0df0c..5a35e9b3d5 100644 --- a/programming_examples/basic/matrix_scalar_add/Makefile +++ b/programming_examples/basic/matrix_scalar_add/Makefile @@ -23,6 +23,7 @@ all: build/final.xclbin build/final.xclbin: build/aie.mlir mkdir -p ${@D} cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \ + --no-xchesscc --no-xbridge --peano ${PEANO_INSTALL_DIR} \ --xclbin-name=${@F} --npu-insts-name=insts.txt ${ **NOTE:** This example makes use of the [Peano](https://github.com/Xilinx/llvm-aie) compiler to compile an elf executed on the AIE core. Peano is an open source single-core compiler for AI Engines. It is a fork of LLVM extended to support the in-order, exposed-pipeline VLIW processor core. - The kernel executes on AIE tile (`col`, 2). Both input vectors are brought into the tile from Shim tile (`col`, 0). The value of `col` is dependent on whether the application is targeting NPU or VCK5000. The AIE tile performs the summation operations and the Shim tile brings the data back out to external memory. ## Source Files Overview diff --git a/programming_examples/basic/vector_vector_modulo/Makefile b/programming_examples/basic/vector_vector_modulo/Makefile index 9bea289476..cb9d8ab29e 100755 --- a/programming_examples/basic/vector_vector_modulo/Makefile +++ b/programming_examples/basic/vector_vector_modulo/Makefile @@ -25,6 +25,7 @@ build/aie.mlir: ${srcdir}/aie2.py build/final.xclbin: build/aie.mlir mkdir -p ${@D} cd ${@D} && aiecc.py --aie-generate-cdo --aie-generate-npu --no-compile-host \ + --no-xchesscc --no-xbridge --peano ${PEANO_INSTALL_DIR} \ --xclbin-name=${@F} --npu-insts-name=insts.txt ${/dev/null 2>&1 && echo yes || echo no) ifeq ($(TEST_POWERSHELL),yes) diff --git a/programming_examples/ml/bottleneck/Makefile b/programming_examples/ml/bottleneck/Makefile index 5c696af170..6fd659a894 100755 --- a/programming_examples/ml/bottleneck/Makefile +++ b/programming_examples/ml/bottleneck/Makefile @@ -23,18 +23,23 @@ insts.txt: build/${mlirFileName}.mlir aiecc.py -v --aie-only-generate-npu --npu-insts-name=$@ $< build/conv2dk1.o: conv2dk1.cc - xchesscc -d ${CHESSCC2_FLAGS} -DINT8_ACT -c $< -o $@ + mkdir -p ${@D} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang ${PEANOWRAP2_FLAGS} -DINT8_ACT -c $< -o ${@F} build/conv2dk3.o: conv2dk3.cc - xchesscc -d ${CHESSCC2_FLAGS} -DUINT8_ACT -c $< -o $@ + mkdir -p ${@D} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang ${PEANOWRAP2_FLAGS} -DUINT8_ACT -c $< -o ${@F} build/conv2dk1_skip.o: conv2dk1_skip.cc - xchesscc -d ${CHESSCC2_FLAGS} -DINT8_ACT -c $< -o $@ + mkdir -p ${@D} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang ${PEANOWRAP2_FLAGS} -DINT8_ACT -c $< -o$ ${@F} build/final.xclbin: build/${mlirFileName}.mlir build/conv2dk1.o build/conv2dk3.o build/conv2dk1_skip.o - cd build && aiecc.py -v --aie-generate-cdo --aie-generate-npu --no-compile-host \ + mkdir -p ${@D} + cd ${@D} && aiecc.py -v --aie-generate-cdo --aie-generate-npu --no-compile-host \ --basic-alloc-scheme \ - --xclbin-name=${@F} --npu-insts-name=insts.txt ${ $@ build/conv2dk1_i8.o: conv2dk1.cc - xchesscc -d ${CHESSCC2_FLAGS} -DINT8_ACT -c $< -o $@ + mkdir -p ${@D} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DINT8_ACT -c $< -o ${@F} build/conv2dk3.o: conv2dk3.cc - xchesscc -d ${CHESSCC2_FLAGS} -DUINT8_ACT -c $< -o $@ + mkdir -p ${@D} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DUINT8_ACT -c $< -o ${@F} build/conv2dk1_skip_init.o: conv2dk1_skip_init.cc - xchesscc -d ${CHESSCC2_FLAGS} -DINT8_ACT -c $< -o $@ + mkdir -p ${@D} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DINT8_ACT -c $< -o ${@F} build/conv2dk1_ui8.o: conv2dk1.cc - xchesscc -d ${CHESSCC2_FLAGS} -DUINT8_ACT -c $< -o $@ + mkdir -p ${@D} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DUINT8_ACT -c $< -o ${@F} build/conv2dk1_skip.o: conv2dk1_skip.cc - xchesscc -d ${CHESSCC2_FLAGS} -DUINT8_ACT -c $< -o $@ + mkdir -p ${@D} + cd ${@D} && ${PEANO_INSTALL_DIR}/bin/clang++ ${PEANOWRAP2_FLAGS} -DUINT8_ACT -c $< -o ${@F} build/final.xclbin: build/${mlirFileName}.mlir build/conv2dk1_i8.o build/conv2dk1_skip_init.o build/conv2dk3.o build/conv2dk1_skip.o build/conv2dk1_ui8.o - cd build && aiecc.py --basic-alloc-scheme --aie-generate-cdo --aie-generate-npu --no-compile-host \ - --xclbin-name=${@F} --npu-insts-name=insts.txt ${ +# source env_setup.sh +# +# # -# e.g. source env_setup.sh /scratch/mlir-aie/install /scratch/llvm/install +# e.g. source env_setup.sh /scratch/mlir-aie/install +# /scratch/llvm/install +# /scratch/llvm-aie/install # ##===----------------------------------------------------------------------===## -if [ "$#" -ne 2 ]; then +if [ "$#" -lt 2 ]; then echo "ERROR: Needs 2 arguments for and " return 1 fi export MLIR_AIE_INSTALL_DIR=`realpath $1` export LLVM_INSTALL_DIR=`realpath $2` +if [ "$#" -eq 3 ]; then + export PEANO_INSTALL_DIR=`realpath $3` +fi -export PATH=${MLIR_AIE_INSTALL_DIR}/bin:${LLVM_INSTALL_DIR}/bin:${PATH} -export PYTHONPATH=${MLIR_AIE_INSTALL_DIR}/python:${PYTHONPATH} -export LD_LIBRARY_PATH=${MLIR_AIE_INSTALL_DIR}/lib:${LLVM_INSTALL_DIR}/lib:${LD_LIBRARY_PATH} +if [[ $PEANO_INSTALL_DIR == "" ]]; then + mkdir -p my_install + pushd my_install + pip -q download llvm-aie -f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly + unzip -q llvm_aie*.whl + rm -rf llvm_aie*.whl + export PEANO_INSTALL_DIR=`realpath llvm-aie` +fi +export PATH=${PEANO_INSTALL_DIR}/bin:${MLIR_AIE_INSTALL_DIR}/bin:${LLVM_INSTALL_DIR}/bin:${PATH} +export PYTHONPATH=${MLIR_AIE_INSTALL_DIR}/python:${PYTHONPATH} +export LD_LIBRARY_PATH=${PEANO_INSTALL_DIR}/bin:${MLIR_AIE_INSTALL_DIR}/lib:${LLVM_INSTALL_DIR}/lib:${LD_LIBRARY_PATH} \ No newline at end of file diff --git a/utils/quick_setup.sh b/utils/quick_setup.sh index e31624a55c..f03f1f457e 100755 --- a/utils/quick_setup.sh +++ b/utils/quick_setup.sh @@ -59,15 +59,16 @@ if test -f "$VPP"; then unzip -q llvm_aie*.whl rm -rf mlir*.whl rm -rf llvm_aie*.whl - export PATH=`realpath llvm-aie/bin`:`realpath mlir_aie/bin`:`realpath mlir/bin`:$PATH - export LD_LIBRARY_PATH=`realpath llvm-aie/lib`:`realpath mlir_aie/lib`:`realpath mlir/lib`:$LD_LIBRARY_PATH - export PYTHONPATH=`realpath mlir_aie/python`:$PYTHONPATH - export PEANO_DIR=`realpath llvm-aie` + export PEANO_INSTALL_DIR=`realpath llvm-aie` popd python3 -m pip install --upgrade --force-reinstall --no-cache-dir -r python/requirements.txt HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie python3 -m pip install --upgrade --force-reinstall --no-cache-dir -r python/requirements_extras.txt python3 -m pip install --upgrade --force-reinstall --no-cache-dir -r python/requirements_ml.txt + source utils/env_setup.sh my_install/mlir_aie my_install/mlir pushd programming_examples + echo "PATH : $PATH" + echo "LD_LIBRARY_PATH : $LD_LIBRARY_PATH" + echo "PYTHONPATH : $PYTHONPATH" else echo "Vitis not found! Exiting..." fi