diff --git a/.github/workflows/buildAndTestRyzenAISw.yml b/.github/workflows/buildAndTestRyzenAISw.yml new file mode 100644 index 0000000000..f9b116385a --- /dev/null +++ b/.github/workflows/buildAndTestRyzenAISw.yml @@ -0,0 +1,133 @@ +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: uraimo/run-on-arch-action@v2.5.0 + name: Build and Test + id: runcmd + with: + distro: none + base_image: ghcr.io/fifield/mlir-aie/ubuntu22-ryzenai-1.3.0ea + githubToken: ${{ github.token }} + dockerRunArgs: | + --mac-address ${{ secrets.XILINX_MAC }} + run: | + cd /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 + + git clone https://github.com/Xilinx/mlir-aie.git + pushd mlir-aie + + git checkout ${{ github.ref_name }} + if [ x"${{ inputs.AIE_COMMIT }}" != x"" ]; then + git reset --hard ${{ inputs.AIE_COMMIT }} + fi + + git submodule update --init --recursive + + pip install onnxruntime==1.17.0 + pip install -r python/requirements.txt + pip install -r python/requirements_ml.txt + + VERSION=$(utils/clone-llvm.sh --get-wheel-version) + popd + + 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 /workspace/mlir-aie -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=/workspace/mlir-aie/cmake/modulesXilinx \ + -DMLIR_DIR=/workspace/mlir/lib/cmake/mlir + + ninja install + ninja check-aie + + popd diff --git a/aie_kernels/CMakeLists.txt b/aie_kernels/CMakeLists.txt index 3a5fde4df6..b47139cad1 100644 --- a/aie_kernels/CMakeLists.txt +++ b/aie_kernels/CMakeLists.txt @@ -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) diff --git a/aie_runtime_lib/CMakeLists.txt b/aie_runtime_lib/CMakeLists.txt index b97a29e204..1871dede4f 100644 --- a/aie_runtime_lib/CMakeLists.txt +++ b/aie_runtime_lib/CMakeLists.txt @@ -15,6 +15,7 @@ function(add_aie_runtime_libs arch) 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 diff --git a/cmake/modulesXilinx b/cmake/modulesXilinx index 2573b106e1..cad10ac057 160000 --- a/cmake/modulesXilinx +++ b/cmake/modulesXilinx @@ -1 +1 @@ -Subproject commit 2573b106e106f3c86b66e8d7899f578799aa6d3d +Subproject commit cad10ac0571675aaa4a978df104b1c35e2e8c9c4 diff --git a/mlir_tutorials/lit.local.cfg b/mlir_tutorials/lit.local.cfg index c44053e843..d694af145b 100755 --- a/mlir_tutorials/lit.local.cfg +++ b/mlir_tutorials/lit.local.cfg @@ -7,5 +7,5 @@ config.unsupported = [] -if not config.has_libxaie: - config.unsupported = ['tutorials'] +if 'AIE' not in config.vitis_components: + config.unsupported = ['mlir-tutorials'] diff --git a/mlir_tutorials/lit.site.cfg.py.in b/mlir_tutorials/lit.site.cfg.py.in index 37fefd5dc8..3525b84b09 100755 --- a/mlir_tutorials/lit.site.cfg.py.in +++ b/mlir_tutorials/lit.site.cfg.py.in @@ -9,6 +9,7 @@ @LIT_SITE_CFG_IN_HEADER@ import sys +import lit.util config.host_triple = "@LLVM_HOST_TRIPLE@" config.target_triple = "@TARGET_TRIPLE@" @@ -54,6 +55,12 @@ config.extraAieCcFlags = "@extraAieCcFlags@" config.aieHostTarget = "@AIE_RUNTIME_TEST_TARGET@" 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@"): + config.vitis_components.append("AIE2") + # Support substitution of the tools_dir with user parameters. This is # used when we can't determine the tool dir at configuration time. try: diff --git a/programming_examples/lit.cfg.py b/programming_examples/lit.cfg.py index 44169227a1..40191d9f38 100755 --- a/programming_examples/lit.cfg.py +++ b/programming_examples/lit.cfg.py @@ -247,9 +247,10 @@ def prepend_path(path): except Exception as e: print("Peano not found, but expected at ", config.peano_tools_dir) -print("Looking for Chess...") -# test if LM_LICENSE_FILE valid -if config.enable_chess_tests: +if not config.enable_chess_tests: + print("Chess tests disabled") +else: + print("Looking for Chess...") result = None if config.vitis_root: result = shutil.which("xchesscc") @@ -265,6 +266,7 @@ def prepend_path(path): if xilinxd_license_file != None: llvm_config.with_environment("XILINXD_LICENSE_FILE", xilinxd_license_file) + # test if LM_LICENSE_FILE valid validate_chess = False if validate_chess: import subprocess @@ -288,6 +290,14 @@ def prepend_path(path): else: print("Chess not found") + # look for aiesimulator + result = shutil.which("aiesimulator") + if result != None: + print("aiesimulator found: " + result) + config.available_features.add("aiesimulator") + else: + print("aiesimulator not found") + tool_dirs = [config.aie_tools_dir, config.peano_tools_dir, config.llvm_tools_dir] tools = [ "aie-opt", diff --git a/programming_examples/lit.local.cfg b/programming_examples/lit.local.cfg index d143865177..10e0d0a26e 100755 --- a/programming_examples/lit.local.cfg +++ b/programming_examples/lit.local.cfg @@ -7,5 +7,5 @@ config.unsupported = [] -if not config.has_libxaie: - config.unsupported = ["programming_examples"] +if 'AIE2' not in config.vitis_components: + config.unsupported = True diff --git a/programming_examples/lit.site.cfg.py.in b/programming_examples/lit.site.cfg.py.in index ad32695fcf..c4687ec097 100755 --- a/programming_examples/lit.site.cfg.py.in +++ b/programming_examples/lit.site.cfg.py.in @@ -65,6 +65,12 @@ config.extraAieCcFlags = "@extraAieCcFlags@" config.aieHostTarget = "@AIE_RUNTIME_TEST_TARGET@" 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@"): + config.vitis_components.append("AIE2") + # Support substitution of the tools_dir with user parameters. This is # used when we can't determine the tool dir at configuration time. try: diff --git a/programming_examples/mlir/lit.local.cfg b/programming_examples/mlir/lit.local.cfg index ac4a5964a6..4f125c2536 100644 --- a/programming_examples/mlir/lit.local.cfg +++ b/programming_examples/mlir/lit.local.cfg @@ -8,5 +8,5 @@ config.suffixes = ['.lit'] config.unsupported = [] -if not config.has_libxaie: - config.unsupported = ['mlir'] +if 'AIE' not in config.vitis_components: + config.unsupported = ["mlir"] diff --git a/programming_guide/lit.cfg.py b/programming_guide/lit.cfg.py index b82658665d..370d624d5f 100755 --- a/programming_guide/lit.cfg.py +++ b/programming_guide/lit.cfg.py @@ -247,9 +247,10 @@ def prepend_path(path): except Exception as e: print("Peano not found, but expected at ", config.peano_tools_dir) -print("Looking for Chess...") -# test if LM_LICENSE_FILE valid -if config.enable_chess_tests: +if not config.enable_chess_tests: + print("Chess tests disabled") +else: + print("Looking for Chess...") result = None if config.vitis_root: result = shutil.which("xchesscc") @@ -265,6 +266,7 @@ def prepend_path(path): if xilinxd_license_file != None: llvm_config.with_environment("XILINXD_LICENSE_FILE", xilinxd_license_file) + # test if LM_LICENSE_FILE valid validate_chess = False if validate_chess: import subprocess @@ -288,6 +290,14 @@ def prepend_path(path): else: print("Chess not found") + # look for aiesimulator + result = shutil.which("aiesimulator") + if result != None: + print("aiesimulator found: " + result) + config.available_features.add("aiesimulator") + else: + print("aiesimulator not found") + tool_dirs = [config.aie_tools_dir, config.peano_tools_dir, config.llvm_tools_dir] tools = [ "aie-opt", diff --git a/programming_guide/lit.local.cfg b/programming_guide/lit.local.cfg index bd10fd2b0a..2e46b95b48 100755 --- a/programming_guide/lit.local.cfg +++ b/programming_guide/lit.local.cfg @@ -9,5 +9,5 @@ config.unsupported = [] config.suffixes = ['.lit'] -if not config.has_libxaie: - config.unsupported = ["programming_guide"] +if 'AIE2' not in config.vitis_components: + config.unsupported = True diff --git a/programming_guide/lit.site.cfg.py.in b/programming_guide/lit.site.cfg.py.in index ad32695fcf..c4687ec097 100755 --- a/programming_guide/lit.site.cfg.py.in +++ b/programming_guide/lit.site.cfg.py.in @@ -65,6 +65,12 @@ config.extraAieCcFlags = "@extraAieCcFlags@" config.aieHostTarget = "@AIE_RUNTIME_TEST_TARGET@" 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@"): + config.vitis_components.append("AIE2") + # Support substitution of the tools_dir with user parameters. This is # used when we can't determine the tool dir at configuration time. try: diff --git a/python/compiler/aiecc/main.py b/python/compiler/aiecc/main.py index ef43a08bff..3a5b4382d5 100644 --- a/python/compiler/aiecc/main.py +++ b/python/compiler/aiecc/main.py @@ -1181,20 +1181,35 @@ def run(mlir_module, args=None): if args is not None: opts = aie.compiler.aiecc.cl_arguments.parse_args(args) - opts.aietools_path = "" - # Try to find vitis in the path + ryzen_ai_version = None + opts.aietools_path = None + + try: + import ryzen_ai.__about__ + version = ryzen_ai.__about__.__version__ + path = os.path.realpath(ryzen_ai.__path__[0]) + print(f"Found Ryzen AI software version {version} at {path}") + # if ryzenai software is pip installed then the path is something like: + # /venv/lib/python3.10/site-packages/ + opts.aietools_path = os.path.join(path, "..") + except: + print("Ryzen AI software not found.") + pass + + # Try to find xchesscc in the path xchesscc_path = shutil.which("xchesscc") if xchesscc_path: xchesscc_bin_path = os.path.dirname(os.path.realpath(xchesscc_path)) xchesscc_path = os.path.dirname(xchesscc_bin_path) - os.environ["AIETOOLS"] = xchesscc_path - print("Found xchesscc at " + xchesscc_path) + print(f"Found xchesscc at {xchesscc_path}") os.environ["PATH"] = os.pathsep.join([os.environ["PATH"], xchesscc_bin_path]) - opts.aietools_path = xchesscc_path + if opts.aietools_path is None: + opts.aietools_path = xchesscc_path else: - print("xchesscc not found...") + print("xchesscc not found.") + + os.environ["AIETOOLS"] = opts.aietools_path - # This path should be generated from cmake aie_path = aie.compiler.aiecc.configure.install_path() peano_path = os.path.join(opts.peano_install_dir, "bin") os.environ["PATH"] = os.pathsep.join([aie_path, os.environ["PATH"]]) diff --git a/python/requirements.txt b/python/requirements.txt index 5fd349f732..ada34514c0 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1,6 +1,6 @@ PyYAML>=5.3.1, <=6.0.1 aiofiles -cmake==3.27.9 +cmake>=3.29 dataclasses>=0.6, <=0.8 filelock==3.13.1 lit diff --git a/test/benchmarks/lit.local.cfg b/test/benchmarks/lit.local.cfg index f624053940..b496911e18 100644 --- a/test/benchmarks/lit.local.cfg +++ b/test/benchmarks/lit.local.cfg @@ -7,5 +7,8 @@ config.unsupported = [] +if len([c for c in config.vitis_components if c == 'AIE']) == 0: + config.unsupported = True + if not config.enable_chess_tests: config.unsupported = True diff --git a/test/lit.cfg.py b/test/lit.cfg.py index 1cd347942b..65a3402332 100644 --- a/test/lit.cfg.py +++ b/test/lit.cfg.py @@ -253,9 +253,10 @@ def prepend_path(path): except Exception as e: print("Peano not found, but expected at ", peano_tools_dir) -print("Looking for Chess...") -# test if LM_LICENSE_FILE valid -if config.enable_chess_tests: +if not config.enable_chess_tests: + print("Chess tests disabled") +else: + print("Looking for Chess...") result = None if config.vitis_root: result = shutil.which("xchesscc") @@ -271,6 +272,7 @@ def prepend_path(path): if xilinxd_license_file != None: llvm_config.with_environment("XILINXD_LICENSE_FILE", xilinxd_license_file) + # test if LM_LICENSE_FILE valid validate_chess = False if validate_chess: import subprocess @@ -294,6 +296,14 @@ def prepend_path(path): else: print("Chess not found") + # look for aiesimulator + result = shutil.which("aiesimulator") + if result != None: + print("aiesimulator found: " + result) + config.available_features.add("aiesimulator") + else: + print("aiesimulator not found") + tools = [ "aie-opt", "aie-translate", diff --git a/test/lit.site.cfg.py.in b/test/lit.site.cfg.py.in index ea3f8783d6..464a8268cb 100644 --- a/test/lit.site.cfg.py.in +++ b/test/lit.site.cfg.py.in @@ -70,6 +70,12 @@ config.extraAieCcFlags = "@extraAieCcFlags@" config.aieHostTarget = "@AIE_RUNTIME_TEST_TARGET@" 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@"): + config.vitis_components.append("AIE2") + # Support substitution of the tools_dir with user parameters. This is # used when we can't determine the tool dir at configuration time. try: diff --git a/test/objectFifo_tests/lit.local.cfg b/test/objectFifo_tests/lit.local.cfg index b817c5f050..0ed128cd5c 100755 --- a/test/objectFifo_tests/lit.local.cfg +++ b/test/objectFifo_tests/lit.local.cfg @@ -8,5 +8,8 @@ config.unsupported = [] +if len([c for c in config.vitis_components if c == 'AIE']) == 0: + config.unsupported = True + if not config.has_libxaie: - config.unsupported = ['objectFifo_tests'] + config.unsupported = True diff --git a/test/unit_tests/aie/29_aie2_nd_dma_even_odd/aie.mlir b/test/unit_tests/aie/29_aie2_nd_dma_even_odd/aie.mlir index b6d0179497..ac85bd4df7 100644 --- a/test/unit_tests/aie/29_aie2_nd_dma_even_odd/aie.mlir +++ b/test/unit_tests/aie/29_aie2_nd_dma_even_odd/aie.mlir @@ -23,7 +23,7 @@ // The DMA receives this data and writes it to a buffer linearly, which is // checked from the host code to be correct. -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %extraAieCcFlags% %S/test.cpp -o test.elf // RUN: %run_on_vck5000 ./test.elf // RUN: sh -c 'aie.mlir.prj/aiesim.sh; exit 0' | FileCheck %s diff --git a/test/unit_tests/aie/30_aie2_nd_dma_transpose_repeat/aie.mlir b/test/unit_tests/aie/30_aie2_nd_dma_transpose_repeat/aie.mlir index 8d62a5d587..054b191bba 100644 --- a/test/unit_tests/aie/30_aie2_nd_dma_transpose_repeat/aie.mlir +++ b/test/unit_tests/aie/30_aie2_nd_dma_transpose_repeat/aie.mlir @@ -11,7 +11,7 @@ // This tests the multi-dimensional (n-D) address generation function of AIE2 // buffer descriptors. -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %extraAieCcFlags% %S/test.cpp -o test.elf // RUN: %run_on_vck5000 ./test.elf // RUN: sh -c 'aie.mlir.prj/aiesim.sh; exit 0' | FileCheck %s diff --git a/test/unit_tests/aie/31_stream_core/aie.mlir b/test/unit_tests/aie/31_stream_core/aie.mlir index 99262c6549..40f9c9f3b0 100644 --- a/test/unit_tests/aie/31_stream_core/aie.mlir +++ b/test/unit_tests/aie/31_stream_core/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: peano, !hsa +// REQUIRES: aiesimulator, peano, !hsa // RUN: %PYTHON aiecc.py --aiesim --no-xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %S/test.cpp -o test.elf // RUN: %run_on_board ./test.elf diff --git a/test/unit_tests/aie/lit.local.cfg b/test/unit_tests/aie/lit.local.cfg new file mode 100644 index 0000000000..615fb16808 --- /dev/null +++ b/test/unit_tests/aie/lit.local.cfg @@ -0,0 +1,11 @@ +# +# This file is 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. All rights reserved. + +config.unsupported = [] + +if len([c for c in config.vitis_components if c == 'AIE']) == 0: + config.unsupported = True diff --git a/test/unit_tests/aie2/lit.local.cfg b/test/unit_tests/aie2/lit.local.cfg new file mode 100644 index 0000000000..868e0a6d6c --- /dev/null +++ b/test/unit_tests/aie2/lit.local.cfg @@ -0,0 +1,11 @@ +# +# This file is 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. All rights reserved. + +config.unsupported = [] + +if len([c for c in config.vitis_components if c == 'AIE2']) == 0: + config.unsupported = True diff --git a/test/unit_tests/aievec_tests/lit.local.cfg b/test/unit_tests/aievec_tests/lit.local.cfg new file mode 100644 index 0000000000..615fb16808 --- /dev/null +++ b/test/unit_tests/aievec_tests/lit.local.cfg @@ -0,0 +1,11 @@ +# +# This file is 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. All rights reserved. + +config.unsupported = [] + +if len([c for c in config.vitis_components if c == 'AIE']) == 0: + config.unsupported = True diff --git a/test/unit_tests/chess_compiler_tests/01_precompiled_core_function/aie.mlir b/test/unit_tests/chess_compiler_tests/01_precompiled_core_function/aie.mlir index df2bbf9665..2b24bd9051 100644 --- a/test/unit_tests/chess_compiler_tests/01_precompiled_core_function/aie.mlir +++ b/test/unit_tests/chess_compiler_tests/01_precompiled_core_function/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: xchesscc_wrapper aie -c %S/kernel.cc // RUN: %PYTHON aiecc.py --aiesim --xbridge --xchesscc %s %test_lib_flags %S/test.cpp -o test.elf // RUN: %run_on_board ./test.elf diff --git a/test/unit_tests/chess_compiler_tests/02_precompiled_kernel/aie.mlir b/test/unit_tests/chess_compiler_tests/02_precompiled_kernel/aie.mlir index 1f3b24a88f..c0fce32da1 100644 --- a/test/unit_tests/chess_compiler_tests/02_precompiled_kernel/aie.mlir +++ b/test/unit_tests/chess_compiler_tests/02_precompiled_kernel/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %S/test.cpp -o test.elf // RUN: xchesscc_wrapper aie +l aie.mlir.prj/core_1_3.bcf %S/kernel.cc -o custom_1_3.elf // RUN: %run_on_board ./test.elf diff --git a/test/unit_tests/chess_compiler_tests/03_cascade_core_functions/aie.mlir b/test/unit_tests/chess_compiler_tests/03_cascade_core_functions/aie.mlir index db990c77a3..97da111d6e 100644 --- a/test/unit_tests/chess_compiler_tests/03_cascade_core_functions/aie.mlir +++ b/test/unit_tests/chess_compiler_tests/03_cascade_core_functions/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: xchesscc_wrapper aie -c %S/kernel.cc // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %s %test_lib_flags %S/test.cpp -o test.elf // RUN: %run_on_board ./test.elf diff --git a/test/unit_tests/chess_compiler_tests/04_shared_memory/aie.mlir b/test/unit_tests/chess_compiler_tests/04_shared_memory/aie.mlir index 7a5986fee5..ccea7c31cf 100644 --- a/test/unit_tests/chess_compiler_tests/04_shared_memory/aie.mlir +++ b/test/unit_tests/chess_compiler_tests/04_shared_memory/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: !hsa +// REQUIRES: aiesimulator, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %extraAieCcFlags% %S/test.cpp -o test.elf // RUN: %run_on_board ./test.elf // RUN: aie.mlir.prj/aiesim.sh | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests/04_shared_memory/aie_row.mlir b/test/unit_tests/chess_compiler_tests/04_shared_memory/aie_row.mlir index 479d9dc6a3..ee49c4d8bd 100644 --- a/test/unit_tests/chess_compiler_tests/04_shared_memory/aie_row.mlir +++ b/test/unit_tests/chess_compiler_tests/04_shared_memory/aie_row.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: !hsa +// REQUIRES: aiesimulator, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %s %test_lib_flags %extraAieCcFlags% %S/test.cpp -o test.elf // RUN: %run_on_board ./test.elf // RUN: aie_row.mlir.prj/aiesim.sh | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests/04_shim_dma_kernel/aie.mlir b/test/unit_tests/chess_compiler_tests/04_shim_dma_kernel/aie.mlir index f04c742cb3..d34f3a6ddc 100644 --- a/test/unit_tests/chess_compiler_tests/04_shim_dma_kernel/aie.mlir +++ b/test/unit_tests/chess_compiler_tests/04_shim_dma_kernel/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %S/test.cpp -o test.elf // RUN: xchesscc_wrapper aie +l aie.mlir.prj/core_7_3.bcf %S/kernel.cc -o custom_7_3.elf // RUN: %run_on_board ./test.elf diff --git a/test/unit_tests/chess_compiler_tests/05_shim_dma_core_function/aie.mlir b/test/unit_tests/chess_compiler_tests/05_shim_dma_core_function/aie.mlir index ea72e59a24..a935c862aa 100644 --- a/test/unit_tests/chess_compiler_tests/05_shim_dma_core_function/aie.mlir +++ b/test/unit_tests/chess_compiler_tests/05_shim_dma_core_function/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: xchesscc_wrapper aie -c %S/kernel.cc // RUN: %PYTHON aiecc.py --aiesim --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %S/test.cpp -o test.elf // RUN: %run_on_board ./test.elf diff --git a/test/unit_tests/chess_compiler_tests/07_shim_dma_core_function_with_loop/aie.mlir b/test/unit_tests/chess_compiler_tests/07_shim_dma_core_function_with_loop/aie.mlir index 6f6e685138..5ab2eea79d 100644 --- a/test/unit_tests/chess_compiler_tests/07_shim_dma_core_function_with_loop/aie.mlir +++ b/test/unit_tests/chess_compiler_tests/07_shim_dma_core_function_with_loop/aie.mlir @@ -9,7 +9,7 @@ //===----------------------------------------------------------------------===// // clang -O2 --target=aie -c %S/kernel.cc -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: xchesscc_wrapper aie -c %S/kernel.cc // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %S/test.cpp -o test.elf // RUN: %run_on_board ./test.elf diff --git a/test/unit_tests/chess_compiler_tests/08_tile_locks/aie.mlir b/test/unit_tests/chess_compiler_tests/08_tile_locks/aie.mlir index d8220e22fb..df4821ce2a 100644 --- a/test/unit_tests/chess_compiler_tests/08_tile_locks/aie.mlir +++ b/test/unit_tests/chess_compiler_tests/08_tile_locks/aie.mlir @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %VitisSysrootFlag% --host-target=%aieHostTargetTriplet% %link_against_hsa% %s %test_lib_flags %S/test.cpp -o test.elf // RUN: %run_on_board ./test.elf // RUN: aie.mlir.prj/aiesim.sh | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests/lit.local.cfg b/test/unit_tests/chess_compiler_tests/lit.local.cfg new file mode 100644 index 0000000000..615fb16808 --- /dev/null +++ b/test/unit_tests/chess_compiler_tests/lit.local.cfg @@ -0,0 +1,11 @@ +# +# This file is 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. All rights reserved. + +config.unsupported = [] + +if len([c for c in config.vitis_components if c == 'AIE']) == 0: + config.unsupported = True diff --git a/test/unit_tests/chess_compiler_tests_aie2/01_precompiled_core_function/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/01_precompiled_core_function/aie.mlir index 014e33ee86..efb4aa0744 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/01_precompiled_core_function/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/01_precompiled_core_function/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: xchesscc_wrapper aie2 -c %S/kernel.cc // RUN: %PYTHON aiecc.py -v --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp // RUN: aie.mlir.prj/aiesim.sh | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests_aie2/02_precompiled_kernel/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/02_precompiled_kernel/aie.mlir index 71c16c2522..e81acab9c4 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/02_precompiled_kernel/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/02_precompiled_kernel/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp // RUN: xchesscc_wrapper aie2 +l aie.mlir.prj/core_1_3.bcf %S/kernel.cc -o custom_1_3.elf // RUN: aie.mlir.prj/aiesim.sh | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests_aie2/03_cascade_core_functions/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/03_cascade_core_functions/aie.mlir index 1b38f68030..d1234e54bd 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/03_cascade_core_functions/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/03_cascade_core_functions/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: xchesscc_wrapper aie2 -c %S/kernel.cc // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp // RUN: aie.mlir.prj/aiesim.sh | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests_aie2/03_simple/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/03_simple/aie.mlir index da1c784653..f15d502a5c 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/03_simple/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/03_simple/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp // RUN: sh -c 'aie.mlir.prj/aiesim.sh; exit 0' | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests_aie2/04_shared_memory/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/04_shared_memory/aie.mlir index 1728421afe..57bdcf830d 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/04_shared_memory/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/04_shared_memory/aie.mlir @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge %s %test_lib_flags %S/test.cpp // RUN: aie.mlir.prj/aiesim.sh | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests_aie2/04_shared_memory/aie_row.mlir b/test/unit_tests/chess_compiler_tests_aie2/04_shared_memory/aie_row.mlir index 68430fcf14..70fe3222a9 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/04_shared_memory/aie_row.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/04_shared_memory/aie_row.mlir @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp // RUN: aie_row.mlir.prj/aiesim.sh | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests_aie2/04_shim_dma_kernel/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/04_shim_dma_kernel/aie.mlir index 62df528fd1..52b775e360 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/04_shim_dma_kernel/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/04_shim_dma_kernel/aie.mlir @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !!hsa +// REQUIRES: aiesimulator, valid_xchess_license, !!hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp // RUN: xchesscc_wrapper aie2 +l aie.mlir.prj/core_7_3.bcf %S/kernel.cc -o custom_7_3.elf diff --git a/test/unit_tests/chess_compiler_tests_aie2/05_shim_dma_core_function/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/05_shim_dma_core_function/aie.mlir index bf39ce5580..f9d2803571 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/05_shim_dma_core_function/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/05_shim_dma_core_function/aie.mlir @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: xchesscc_wrapper aie2 -c %S/kernel.cc // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp diff --git a/test/unit_tests/chess_compiler_tests_aie2/07_shim_dma_core_function_with_loop/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/07_shim_dma_core_function_with_loop/aie.mlir index fe0dba9e5a..71f48b5660 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/07_shim_dma_core_function_with_loop/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/07_shim_dma_core_function_with_loop/aie.mlir @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: xchesscc_wrapper aie2 -c %S/kernel.cc // RUN: %PYTHON aiecc.py --aiesim --chesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp diff --git a/test/unit_tests/chess_compiler_tests_aie2/08_tile_locks/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/08_tile_locks/aie.mlir index a3d4a8dc54..51ca1c910b 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/08_tile_locks/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/08_tile_locks/aie.mlir @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp // RUN: sh -c 'aie.mlir.prj/aiesim.sh; exit 0' | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests_aie2/09_memtile_locks/aie.mlir b/test/unit_tests/chess_compiler_tests_aie2/09_memtile_locks/aie.mlir index 4d0d871169..ddcc75b4d1 100644 --- a/test/unit_tests/chess_compiler_tests_aie2/09_memtile_locks/aie.mlir +++ b/test/unit_tests/chess_compiler_tests_aie2/09_memtile_locks/aie.mlir @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: valid_xchess_license, !hsa +// REQUIRES: aiesimulator, valid_xchess_license, !hsa // RUN: %PYTHON aiecc.py --aiesim --xchesscc --xbridge --no-compile-host %s %test_lib_flags %S/test.cpp // RUN: sh -c 'aie.mlir.prj/aiesim.sh; exit 0' | FileCheck %s diff --git a/test/unit_tests/chess_compiler_tests_aie2/lit.local.cfg b/test/unit_tests/chess_compiler_tests_aie2/lit.local.cfg new file mode 100644 index 0000000000..868e0a6d6c --- /dev/null +++ b/test/unit_tests/chess_compiler_tests_aie2/lit.local.cfg @@ -0,0 +1,11 @@ +# +# This file is 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. All rights reserved. + +config.unsupported = [] + +if len([c for c in config.vitis_components if c == 'AIE2']) == 0: + config.unsupported = True diff --git a/test/unit_tests/lit.local.cfg b/test/unit_tests/lit.local.cfg index 0f525addfe..bfd37644f4 100644 --- a/test/unit_tests/lit.local.cfg +++ b/test/unit_tests/lit.local.cfg @@ -7,12 +7,6 @@ config.unsupported = [] -if not config.has_libxaie: - config.unsupported = ['unit_tests'] - -if not config.enable_chess_tests: - config.unsupported += 'unit_tests/aievec_tests' - if config.enable_chess_tests: # args for using xchesscc_wrapper xchesscc_aie2_args = 'aie2 -f -g +s' @@ -35,5 +29,3 @@ if "peano" in config.available_features: config.substitutions.append(('%vector-to-llvmir%', vector_to_aievec+' '+aievec_to_llvmir)) config.substitutions.append(('%vector-to-generic-llvmir%', vector_to_generic_llvmir)) config.substitutions.append(('%llvmir-to-ll%', llvmir_to_ll)) - - diff --git a/tools/chess-clang/xchesscc_wrapper b/tools/chess-clang/xchesscc_wrapper index f09a931e4a..ab747008fe 100755 --- a/tools/chess-clang/xchesscc_wrapper +++ b/tools/chess-clang/xchesscc_wrapper @@ -7,11 +7,20 @@ # (c) Copyright 2021 Xilinx Inc. # (c) Copyright 2022-2024 Advanced Micro Devices, Inc. -AIETOOLS=`realpath $(dirname $(which xchesscc))/../` - TARGET=${1^^} shift +# check to see if the next command line argument is -aietools +if [ "$1" == "-aietools" ] + then + AIETOOLS=$2 + shift + shift +fi + +AIETOOLS_PATH=`realpath $(dirname $(which xchesscc))/../` +AIETOOLS="${AIETOOLS:-${AIETOOLS_PATH}}" + if [ $TARGET != "AIE" -a $TARGET != "AIE2" ] then echo "xchesscc_wrapper: first argument is expected to be the target architecture (aie or aie2)" @@ -35,6 +44,7 @@ if [ -z "$AIETOOLS" ] fi LIBDIR=${AIETOOLS}/data/${AIETARGET}/lib +INCDIR=${AIETOOLS}/include DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -xchesscc --aiearch ${AIEARCH} -p me -C Release_LLVM -D__AIENGINE__ $EXTRA_DEFS -P $LIBDIR -d -f $@ +xchesscc --aiearch ${AIEARCH} -p me -C Release_LLVM -D__AIENGINE__ $EXTRA_DEFS -I $INCDIR -P $LIBDIR -d -f $@