From 07c9030561e8cf4905ae5d93bd7f84f3aa598017 Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Thu, 22 Aug 2024 19:58:18 -0500 Subject: [PATCH] hardcode npu1 for now (different pcie id) --- .github/workflows/ci-linux.yml | 9 +++--- build_tools/ci/cpu_comparison/run_test.py | 2 +- build_tools/ci/run_matmul_test.sh | 26 ++++++++++++----- .../AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp | 29 ++++++++++--------- 4 files changed, 39 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index b70aa8f80..2f6c7730a 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -94,7 +94,7 @@ jobs: strategy: fail-fast: true env: - XILINXD_LICENSE_FILE: /home/svcnod/Xilinx.lic + XILINXD_LICENSE_FILE: /opt/xilinx/aie.lic steps: - name: "Checking out repository" # for test scripts uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 @@ -146,7 +146,7 @@ jobs: # sudo visudo -f /etc/sudoers.d/github # ``` # on the guthub CI machine. - # sudo prlimit -lunlimited --pid $$ + sudo prlimit -lunlimited --pid $$ source /opt/xilinx/xrt/setup.sh bash build_tools/ci/run_matmul_test.sh \ @@ -166,9 +166,8 @@ jobs: iree-install \ $PWD/llvm-aie \ --xrt-dir /opt/xilinx/xrt \ - --reset_npu_between_runs=0 \ - --test_set='Smoke' \ - --do_not_run_aie=1 + --test-set='Smoke' \ + --do-not-run-aie # Assert that output.log is empty (because verbose=0) if [ -s output.log ]; then diff --git a/build_tools/ci/cpu_comparison/run_test.py b/build_tools/ci/cpu_comparison/run_test.py index 3524e4a12..3622f3ac9 100755 --- a/build_tools/ci/cpu_comparison/run_test.py +++ b/build_tools/ci/cpu_comparison/run_test.py @@ -613,7 +613,7 @@ def run(self, config): output_dir = config.output_dir for name in [ - "two_matmul_switching", + # "two_matmul_switching", "matmul_f32_8_8_4", "matmul_f32_8_4_8", ]: diff --git a/build_tools/ci/run_matmul_test.sh b/build_tools/ci/run_matmul_test.sh index 01fdff83b..c461e9002 100755 --- a/build_tools/ci/run_matmul_test.sh +++ b/build_tools/ci/run_matmul_test.sh @@ -144,6 +144,7 @@ export XRT_HACK_UNSECURE_LOADING_XCLBIN=1 cd ${OUTPUT_DIR} +export MATMUL_TESTS_RUN=0 export MATMUL_TESTS_FAILS=0 ############################################################################### @@ -353,6 +354,8 @@ function run_matmul_test() { exit 1 fi + export MATMUL_TESTS_RUN=$(( $MATMUL_TESTS_RUN+1 )) + # Re-enable exit on failure: set -e @@ -403,14 +406,14 @@ function run_matmul_test() { --iree-amdaie-enable-ukernels=all" fi + set +e + echo "**** Generating matmul .vmfb file for ${name} ****" ${IREE_COMPILE_EXE} "${matmul_ir}" \ ${compilation_flags} -o "${matmul_vmfb}" - compileResult=$? - # Handle cases other than when compilation is expected to, and does, succeed: if [ $expect_compile_failure -ne 0 ]; then if [ $compileResult -ne 0 ]; then @@ -418,22 +421,30 @@ function run_matmul_test() { return 0 else echo "Expected compilation failure, got compilation success." - exit 1 + export MATMUL_TESTS_FAILS=$(( $MATMUL_TESTS_FAILS+1 )) + return fi else if [ $compileResult -ne 0 ]; then echo "Expected compilation success, got compilation failure." - exit 1 + export MATMUL_TESTS_FAILS=$(( $MATMUL_TESTS_FAILS+1 )) + return fi fi # Renable exit on failure: - set -e echo "**** Generating calls .vmfb file for ${name} ****" ${IREE_COMPILE_EXE} "${calls_ir}" \ --iree-hal-target-backends=${target_backend} \ -o "${calls_vmfb}" + return_status=$? + if [ $return_status -ne 0 ]; then + echo "'${name}' matmul compile failed!" + export MATMUL_TESTS_FAILS=$(( $MATMUL_TESTS_FAILS+1 )) + return + fi + compiled_time=$(date +%s%3N) echo "**** Running '${name}' matmul tests ****" @@ -444,8 +455,6 @@ function run_matmul_test() { --device=${device} \ --max_elements_to_check=${max_elements_to_check}" - set +e - total_num_runs=$(( num_repeat_runs * num_corruption_repeat_runs)) echo "**** Running '${name}' matmul test ${total_num_runs} times (command ${COMMAND}) ****" for i in $(seq 1 $num_repeat_runs); do @@ -917,6 +926,9 @@ if [ -d "$VITIS" ]; then fi +echo "\n\n" + +echo "$MATMUL_TESTS_RUN matmul tests run!" if [ $MATMUL_TESTS_FAILS -ne 0 ]; then echo "$MATMUL_TESTS_FAILS matmul tests failed! Scroll up and look for the 🦄 and 🐞..." exit 1 diff --git a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp index a9dccafe7..0425746bc 100644 --- a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp +++ b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp @@ -94,20 +94,21 @@ using Path = std::filesystem::path; namespace { FailureOr getNPUVersion() { - std::string errorMessage; - auto maybeVbnv = - openInputFile("/sys/bus/pci/devices/0000:c5:00.1/vbnv", &errorMessage); - if (!maybeVbnv) { - llvm::errs() << "couldn't read pci info for npu because: " << errorMessage; - return failure(); - } - - std::string vbnv = std::string{maybeVbnv->getBuffer()}; - std::regex rgx("RyzenAI-(.*)"); - std::smatch matches; - if (std::regex_search(vbnv, matches, rgx)) return {matches[1]}; - llvm::errs() << "couldn't find npu version in " << vbnv; - return failure(); + // std::string errorMessage; + // auto maybeVbnv = + // openInputFile("/sys/bus/pci/devices/0000:c5:00.1/vbnv", &errorMessage); + // if (!maybeVbnv) { + // llvm::errs() << "couldn't read pci info for npu because: " << errorMessage; + // return failure(); + // } + // + // std::string vbnv = std::string{maybeVbnv->getBuffer()}; + // std::regex rgx("RyzenAI-(.*)"); + // std::smatch matches; + // if (std::regex_search(vbnv, matches, rgx)) return {matches[1]}; + // llvm::errs() << "couldn't find npu version in " << vbnv; + // return failure(); + return std::string{"npu1"}; } FailureOr getTargetDir() {