[NFC] Canonicalize the "platform" in CI (#11413)
diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 748478e..7858c59 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml
@@ -98,22 +98,22 @@ matrix: target: - platform: "linux" - architecture: "x86_64" + arch: "x86_64" docker_image: "gcr.io/iree-oss/base@sha256:605d86ccf4197e978a24867fabb7fc100334c926b067ee0518e46d0a4396e206" # Builds tools on the host and assumes the builder is Linux x86_64. build_script: "./build_tools/cmake/build_runtime.sh" - - platform: "riscv" - architecture: "rv64" + - platform: "linux" + arch: "riscv_64" docker_image: "gcr.io/iree-oss/riscv@sha256:5034a40068f14d91d5caf07d615f323561416caee8afda32ae622746a4dd8b04" build_script: "./build_tools/cmake/build_riscv.sh" outputs: benchmark-tools-gcs-artifacts: ${{ toJSON(steps.upload.outputs) }} env: PLATFORM: ${{ matrix.target.platform }} - ARCHITECTURE: ${{ matrix.target.architecture }} + ARCH: ${{ matrix.target.arch }} DOCKER_IMAGE: ${{ matrix.target.docker_image }} BUILD_SCRIPT: ${{ matrix.target.build_script }} - BUILD_TOOLS_DIR: ${{ matrix.target.platform }}-${{ matrix.target.architecture }}-benchmark-tools-dir + BUILD_TOOLS_DIR: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmark-tools-dir BUILD_DIR: ${{ inputs.build-dir }} BUILD_DIR_ARCHIVE: ${{ inputs.build-dir-archive }} BUILD_DIR_GCS_ARTIFACT: ${{ inputs.build-dir-gcs-artifact }} @@ -130,7 +130,8 @@ id: build run: | ./build_tools/github_actions/docker_run.sh \ - --env "${PLATFORM^^}_ARCH=${ARCHITECTURE}" \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ --env "BUILD_PRESET=benchmark" \ --env "IREE_HOST_BINARY_ROOT=${BUILD_DIR}/install" \ "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build" @@ -138,14 +139,15 @@ id: build-with-tracing run: | ./build_tools/github_actions/docker_run.sh \ - --env "${PLATFORM^^}_ARCH=${ARCHITECTURE}" \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ --env "BUILD_PRESET=benchmark-with-tracing" \ --env "IREE_HOST_BINARY_ROOT=${BUILD_DIR}/install" \ "${DOCKER_IMAGE}" "${BUILD_SCRIPT}" "${BUILD_TOOLS_DIR}/build-traced" - name: "Creating the benchmark tools archive" id: archive env: - BENCHMARK_TOOLS_ARCHIVE: ${{ matrix.target.platform }}-${{ matrix.target.architecture }}-benchmarks-tools.tar + BENCHMARK_TOOLS_ARCHIVE: ${{ matrix.target.platform }}-${{ matrix.target.arch }}-benchmarks-tools.tar run: | tar -cf "${BENCHMARK_TOOLS_ARCHIVE}" \ "${BUILD_TOOLS_DIR}"/*/tools/iree-benchmark-module @@ -157,4 +159,4 @@ BENCHMARK_TOOLS_GCS_ARTIFACT: ${{ env.GCS_DIR }}/${{ steps.archive.outputs.benchmark-tools-archive }} run: | gcloud alpha storage cp "${BENCHMARK_TOOLS_ARCHIVE}" "${BENCHMARK_TOOLS_GCS_ARTIFACT}" - echo "${PLATFORM}-${ARCHITECTURE}-benchmark-tools-gcs-artifact=${BENCHMARK_TOOLS_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}" + echo "${PLATFORM}-${ARCH}-benchmark-tools-gcs-artifact=${BENCHMARK_TOOLS_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 087f4ee..77be17b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml
@@ -763,35 +763,40 @@ matrix: target: - platform: android - architecture: arm64-v8a + arch: armv8.2-a abi: arm64-v8a docker_image: "gcr.io/iree-oss/android@sha256:e5f45760ab2dc8a1d72dc6e9d90056719bedac5678ee90e6d9f9b958172b4834" + build_script: "./build_tools/cmake/build_android.sh" # No test_script - - platform: riscv - architecture: rv64 + - platform: linux + arch: riscv_64 abi: lp64d docker_image: "gcr.io/iree-oss/riscv@sha256:5034a40068f14d91d5caf07d615f323561416caee8afda32ae622746a4dd8b04" + build_script: "./build_tools/cmake/build_riscv.sh" test_script: "./build_tools/cmake/test_riscv.sh" - - platform: riscv - architecture: rv32-linux + - platform: linux + arch: riscv_32 abi: ilp32d docker_image: "gcr.io/iree-oss/riscv@sha256:5034a40068f14d91d5caf07d615f323561416caee8afda32ae622746a4dd8b04" + build_script: "./build_tools/cmake/build_riscv.sh" test_script: "./build_tools/cmake/test_riscv.sh" - - platform: riscv - architecture: rv32-baremetal + - platform: generic + arch: riscv_32 abi: ilp32 docker_image: "gcr.io/iree-oss/riscv@sha256:5034a40068f14d91d5caf07d615f323561416caee8afda32ae622746a4dd8b04" + build_script: "./build_tools/cmake/build_riscv.sh" test_script: "./tests/riscv32/smoke.sh" env: PLATFORM: ${{ matrix.target.platform }} - ARCHITECTURE: ${{ matrix.target.architecture }} - TARGET_BUILD_DIR: build-${{ matrix.target.platform }}-${{ matrix.target.architecture }} + ARCH: ${{ matrix.target.arch }} ABI: ${{ matrix.target.abi }} DOCKER_IMAGE: ${{ matrix.target.docker_image }} + BUILD_SCRIPT: ${{ matrix.target.build_script }} TEST_SCRIPT: ${{ matrix.target.test_script }} HOST_BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} HOST_BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} HOST_BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} + TARGET_BUILD_DIR: build-${{ matrix.target.platform }}-${{ matrix.target.arch }} IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }} steps: - name: "Checking out repository" @@ -808,22 +813,24 @@ --env "IREE_CCACHE_GCP_TOKEN=$(gcloud auth application-default print-access-token)" \ --env "IREE_WRITE_REMOTE_CCACHE=${IREE_WRITE_REMOTE_CCACHE}" \ --env "CCACHE_NAMESPACE=${DOCKER_IMAGE}" \ - --env "${PLATFORM^^}_ARCH=${ARCHITECTURE}" \ - --env "${PLATFORM^^}_ABI=${ABI}" \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ + --env "IREE_TARGET_ABI=${ABI}" \ + --env "IREE_TARGET_BUILD_DIR=${TARGET_BUILD_DIR}" \ --env "BUILD_PRESET=test" \ --env "IREE_HOST_BINARY_ROOT=${HOST_BUILD_DIR}/install" \ "${DOCKER_IMAGE}" \ - "./build_tools/cmake/build_${PLATFORM}.sh" \ - "${TARGET_BUILD_DIR}" + "${BUILD_SCRIPT}" - name: "Test cross-compiling target" if: ${{ matrix.target.test_script }} run: | ./build_tools/github_actions/docker_run.sh \ - --env "${PLATFORM^^}_ARCH=${ARCHITECTURE}" \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ + --env "IREE_TARGET_BUILD_DIR=${TARGET_BUILD_DIR}" \ --env "BUILD_PRESET=test" \ "${DOCKER_IMAGE}" \ - "${TEST_SCRIPT}" \ - "${TARGET_BUILD_DIR}" + "${TEST_SCRIPT}" emscripten: needs: [setup, build_all] @@ -866,26 +873,27 @@ strategy: matrix: target: - - platform: riscv - architecture: rv64 + - platform: linux + arch: riscv_64 docker_image: "gcr.io/iree-oss/riscv@sha256:5034a40068f14d91d5caf07d615f323561416caee8afda32ae622746a4dd8b04" run_scripts: "./build_tools/cmake/build_riscv.sh && ./build_tools/cmake/test_riscv.sh" - - platform: riscv - architecture: rv32-linux + - platform: linux + arch: riscv_32 docker_image: "gcr.io/iree-oss/riscv@sha256:5034a40068f14d91d5caf07d615f323561416caee8afda32ae622746a4dd8b04" run_scripts: "./build_tools/cmake/build_riscv.sh && ./build_tools/cmake/test_riscv.sh" - - platform: host - architecture: x86_64 + - platform: linux + arch: x86_64 docker_image: "gcr.io/iree-oss/base@sha256:605d86ccf4197e978a24867fabb7fc100334c926b067ee0518e46d0a4396e206" - run_scripts: "./build_tools/cmake/test_benchmark_suites_host.sh" + run_scripts: "./build_tools/cmake/test_benchmark_suites_on_linux.sh" env: PLATFORM: ${{ matrix.target.platform }} - ARCHITECTURE: ${{ matrix.target.architecture }} + ARCH: ${{ matrix.target.arch }} DOCKER_IMAGE: ${{ matrix.target.docker_image }} RUN_SCRIPTS: ${{ matrix.target.run_scripts }} HOST_BUILD_DIR: ${{ needs.build_all.outputs.build-dir }} HOST_BUILD_DIR_ARCHIVE: ${{ needs.build_all.outputs.build-dir-archive }} HOST_BUILD_DIR_GCS_ARTIFACT: ${{ needs.build_all.outputs.build-dir-gcs-artifact }} + TARGET_BUILD_DIR: build-${{ matrix.target.platform }}-${{ matrix.target.arch }} E2E_TEST_ARTIFACTS_DIR: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-dir }} E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ needs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-gcs-artifact-dir }} steps: @@ -911,8 +919,9 @@ - name: "Build iree-run-module and test benchmark suite modules" run: | ./build_tools/github_actions/docker_run.sh \ - --env "${PLATFORM^^}_ARCH=${ARCHITECTURE}" \ - --env "IREE_BUILD_${PLATFORM^^}_DIR=build-${PLATFORM}-${ARCHITECTURE}" \ + --env "IREE_TARGET_PLATFORM=${PLATFORM}" \ + --env "IREE_TARGET_ARCH=${ARCH}" \ + --env "IREE_TARGET_BUILD_DIR=${TARGET_BUILD_DIR}" \ --env "BUILD_PRESET=benchmark-suite-test" \ --env "IREE_HOST_BINARY_ROOT=${HOST_BUILD_DIR}/install" \ --env "E2E_TEST_ARTIFACTS_DIR=${E2E_TEST_ARTIFACTS_DIR}" \
diff --git a/build_tools/cmake/build_android.sh b/build_tools/cmake/build_android.sh index ad74170..548002f 100755 --- a/build_tools/cmake/build_android.sh +++ b/build_tools/cmake/build_android.sh
@@ -9,13 +9,13 @@ # Cross-compile the runtime using CMake targeting Android # # The required IREE_HOST_BINARY_ROOT environment variable indicates the location -# of the precompiled IREE binaries. Also requires that ANDROID_ABI and +# of the precompiled IREE binaries. Also requires that IREE_TARGET_ABI and # ANDROID_NDK variables be set. The BUILD_PRESET environment variable indicates # how the project should be configured: "test", "benchmark", # "benchmark-with-tracing", or "benchmark-suite-test". Defaults to "test". # # The desired build directory can be passed as the first argument. Otherwise, it -# uses the environment variable IREE_ANDROID_BUILD_DIR, defaulting to +# uses the environment variable IREE_TARGET_BUILD_DIR, defaulting to # "build-android". Designed for CI, but can be run manually. It reuses the build # directory if it already exists. Expects to be run from the root of the IREE # repository. @@ -23,7 +23,8 @@ set -xeuo pipefail -BUILD_DIR="${1:-${IREE_BUILD_ANDROID_DIR:-build-android}}" +BUILD_DIR="${1:-${IREE_TARGET_BUILD_DIR:-build-android}}" +ANDROID_ABI="${IREE_TARGET_ABI}" IREE_HOST_BINARY_ROOT="$(realpath ${IREE_HOST_BINARY_ROOT})" E2E_TEST_ARTIFACTS_DIR="${E2E_TEST_ARTIFACTS_DIR:-build-e2e-test-artifacts/e2e_test_artifacts}" BUILD_PRESET="${BUILD_PRESET:-test}"
diff --git a/build_tools/cmake/build_riscv.sh b/build_tools/cmake/build_riscv.sh index 84b0290..10d20ff 100755 --- a/build_tools/cmake/build_riscv.sh +++ b/build_tools/cmake/build_riscv.sh
@@ -14,15 +14,16 @@ # "benchmark-with-tracing", or "benchmark-suite-test". Defaults to "test". # # The desired build directory can be passed as the first argument. Otherwise, it -# uses the environment variable IREE_RISCV_BUILD_DIR, defaulting to +# uses the environment variable IREE_TARGET_BUILD_DIR, defaulting to # "build-riscv". Designed for CI, but can be run manually. It reuses the build # directory if it already exists. Expects to be run from the root of the IREE # repository. set -xeuo pipefail -BUILD_DIR="${1:-${IREE_BUILD_RISCV_DIR:-build-riscv}}" -RISCV_ARCH="${RISCV_ARCH:-rv64}" +BUILD_DIR="${1:-${IREE_TARGET_BUILD_DIR:-build-riscv}}" +RISCV_PLATFORM="${IREE_TARGET_PLATFORM:-linux}" +RISCV_ARCH="${IREE_TARGET_ARCH:-riscv_64}" RISCV_COMPILER_FLAGS="${RISCV_COMPILER_FLAGS:--O3}" IREE_HOST_BINARY_ROOT="$(realpath ${IREE_HOST_BINARY_ROOT})" E2E_TEST_ARTIFACTS_DIR="${E2E_TEST_ARTIFACTS_DIR:-build-e2e-test-artifacts/e2e_test_artifacts}" @@ -30,7 +31,8 @@ source build_tools/cmake/setup_build.sh -echo "Build riscv target with the config of ${RISCV_ARCH}" +RISCV_PLATFORM_ARCH="${RISCV_PLATFORM}-${RISCV_ARCH}" +echo "Build riscv target with the config of ${RISCV_PLATFORM_ARCH}" TOOLCHAIN_FILE="$(realpath build_tools/cmake/riscv.toolchain.cmake)" declare -a args args=( @@ -38,25 +40,25 @@ "-B" "${BUILD_DIR}" -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" -DIREE_HOST_BINARY_ROOT="${IREE_HOST_BINARY_ROOT}" - -DRISCV_CPU="${RISCV_ARCH}" + -DRISCV_CPU="${RISCV_PLATFORM_ARCH}" -DRISCV_COMPILER_FLAGS="${RISCV_COMPILER_FLAGS}" -DIREE_BUILD_COMPILER=OFF # CPU info doesn't work on RISCV -DIREE_ENABLE_CPUINFO=OFF ) -if [[ "${RISCV_ARCH}" == "rv64" || "${RISCV_ARCH}" == "rv32-linux" ]]; then +if [[ "${RISCV_PLATFORM}" == "linux" ]]; then args+=( -DRISCV_TOOLCHAIN_ROOT="${RISCV_RV64_LINUX_TOOLCHAIN_ROOT}" ) -elif [[ "${RISCV_ARCH}" == "rv32-baremetal" ]]; then +elif [[ "${RISCV_PLATFORM_ARCH}" == "generic-riscv_32" ]]; then args+=( # TODO(#6353): Off until tools/ are refactored to support threadless config. -DIREE_BUILD_TESTS=OFF -DRISCV_TOOLCHAIN_ROOT="${RISCV_RV32_NEWLIB_TOOLCHAIN_ROOT}" ) else - echo "riscv config not supported yet" + echo "riscv config for ${RISCV_PLATFORM_ARCH} not supported yet" return -1 fi @@ -96,16 +98,19 @@ "${CMAKE_BIN}" "${args[@]}" -if [[ "${BUILD_PRESET}" == "benchmark-suite-test" ]] && \ - [[ "${RISCV_ARCH}" == "rv64" || "${RISCV_ARCH}" == "rv32-linux" ]]; then - echo "Building iree-run-module and run-module-test deps for RISC-V" - echo "------------------------------------------------------------" - "${CMAKE_BIN}" --build "${BUILD_DIR}" --target iree-run-module \ - iree-run-module-test-deps -- -k 0 +if [[ "${BUILD_PRESET}" == "benchmark-suite-test" ]]; then + if [[ "${RISCV_PLATFORM}" == "linux" ]]; then + echo "Building iree-run-module and run-module-test deps for RISC-V" + echo "------------------------------------------------------------" + "${CMAKE_BIN}" --build "${BUILD_DIR}" --target iree-run-module \ + iree-run-module-test-deps -- -k 0 + else + echo "benchmark-suite-test on ${RISCV_PLATFORM_ARCH} not supported yet" + return -1 + fi else "${CMAKE_BIN}" --build "${BUILD_DIR}" -- -k 0 - - if [[ "${RISCV_ARCH}" == "rv64" || "${RISCV_ARCH}" == "rv32-linux" ]]; then + if [[ "${RISCV_PLATFORM}" == "linux" ]]; then echo "Building test deps for RISC-V" echo "-----------------------------" "${CMAKE_BIN}" --build "${BUILD_DIR}" --target iree-test-deps -- -k 0
diff --git a/build_tools/cmake/build_runtime.sh b/build_tools/cmake/build_runtime.sh index e79f918..9468073 100755 --- a/build_tools/cmake/build_runtime.sh +++ b/build_tools/cmake/build_runtime.sh
@@ -9,13 +9,13 @@ # # Designed for CI, but can be run locally. The desired build directory can be # passed as the first argument. Otherwise, it uses the environment variable -# IREE_RUNTIME_BUILD_DIR, defaulting to "build-runtime". It reuses the build +# IREE_TARGET_BUILD_DIR, defaulting to "build-runtime". It reuses the build # directory if it already exists. Expects to be run from the root of the IREE # repository. set -xeuo pipefail -BUILD_DIR="${1:-${IREE_RUNTIME_BUILD_DIR:-build-runtime}}" +BUILD_DIR="${1:-${IREE_TARGET_BUILD_DIR:-build-runtime}}" BUILD_PRESET="${BUILD_PRESET:-test}" source build_tools/cmake/setup_build.sh
diff --git a/build_tools/cmake/riscv.toolchain.cmake b/build_tools/cmake/riscv.toolchain.cmake index 4188b6a..61481b2 100644 --- a/build_tools/cmake/riscv.toolchain.cmake +++ b/build_tools/cmake/riscv.toolchain.cmake
@@ -39,7 +39,7 @@ set(RISCV_LINKER_FLAGS) set(RISCV_LINKER_FLAGS_EXE) -if(RISCV_CPU STREQUAL "rv64") +if(RISCV_CPU STREQUAL "linux-riscv_64") set(CMAKE_SYSTEM_PROCESSOR riscv64) set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_LIBRARY_PATH "${RISCV_TOOLCHAIN_ROOT}/sysroot/usr/lib") @@ -56,7 +56,7 @@ "--riscv-v-fixed-length-vector-lmul-max=8" "--riscv-v-vector-bits-min=512" CACHE INTERNAL "Default llvm codegen flags for testing purposes") -elseif(RISCV_CPU STREQUAL "rv32-linux") +elseif(RISCV_CPU STREQUAL "linux-riscv_32") set(CMAKE_SYSTEM_PROCESSOR riscv32) set(CMAKE_SYSTEM_NAME Linux) list(APPEND CMAKE_SYSTEM_LIBRARY_PATH @@ -75,7 +75,7 @@ "--riscv-v-fixed-length-vector-lmul-max=8" "--riscv-v-vector-bits-min=512" CACHE INTERNAL "Default llvm codegen flags for testing purposes") -elseif(RISCV_CPU STREQUAL "rv32-baremetal") +elseif(RISCV_CPU STREQUAL "generic-riscv_32") set(CMAKE_SYSTEM_PROCESSOR riscv32) set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_CROSSCOMPILING ON CACHE BOOL "")
diff --git a/build_tools/cmake/run_riscv_test.sh b/build_tools/cmake/run_riscv_test.sh index f0af625..e4431c9 100755 --- a/build_tools/cmake/run_riscv_test.sh +++ b/build_tools/cmake/run_riscv_test.sh
@@ -13,16 +13,18 @@ set -x set -e -RISCV_ARCH="${RISCV_ARCH:-rv64}" +RISCV_PLATFORM="${IREE_TARGET_PLATFORM:-linux}" +RISCV_ARCH="${IREE_TARGET_ARCH:-riscv_64}" +RISCV_PLATFORM_ARCH="${RISCV_PLATFORM}-${RISCV_ARCH}" # A QEMU Linux emulator must be available Within the system that matches the # processor architecturue. The emulators are at the path specified by the # `QEMU_RV64_BIN` or `QEMU_RV32_BIN` environment variable to run the artifacts # under the emulator. -if [[ "${RISCV_ARCH}" == "rv64" ]] && [[ ! -z "${QEMU_RV64_BIN}" ]]; then +if [[ "${RISCV_PLATFORM_ARCH}" == "linux-riscv_64" ]] && [[ ! -z "${QEMU_RV64_BIN}" ]]; then "${QEMU_RV64_BIN}" "-cpu" "rv64,x-v=true,x-k=true,vlen=512,elen=64,vext_spec=v1.0" \ "-L" "${RISCV_RV64_LINUX_TOOLCHAIN_ROOT}/sysroot" "$@" -elif [[ "${RISCV_ARCH}" == "rv32-linux" ]] && [[ ! -z "${QEMU_RV32_BIN}" ]]; then +elif [[ "${RISCV_PLATFORM_ARCH}" == "linux-riscv_32" ]] && [[ ! -z "${QEMU_RV32_BIN}" ]]; then "${QEMU_RV32_BIN}" "-cpu" "rv32,x-v=true,x-k=true,vlen=512,elen=32,vext_spec=v1.0" \ "-L" "${RISCV_RV64_LINUX_TOOLCHAIN_ROOT}/sysroot" "$@" else
diff --git a/build_tools/cmake/test_benchmark_suites_host.sh b/build_tools/cmake/test_benchmark_suites_host.sh deleted file mode 100755 index e761ec0..0000000 --- a/build_tools/cmake/test_benchmark_suites_host.sh +++ /dev/null
@@ -1,64 +0,0 @@ -#!/bin/bash - -# Copyright 2022 The IREE Authors -# -# 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 - -# Build tests based on benchmark suites for IREE. -# Designed for CI, but can be run locally. -set -xeuo pipefail - -ROOT_DIR="${ROOT_DIR:-$(git rev-parse --show-toplevel)}" -cd "${ROOT_DIR}" - -CMAKE_BIN=${CMAKE_BIN:-$(which cmake)} -E2E_TEST_ARTIFACTS_DIR="$(realpath ${E2E_TEST_ARTIFACTS_DIR:-$ROOT_DIR/build-e2e-test-artifacts/e2e_test_artifacts})" -IREE_HOST_BINARY_ROOT="$(realpath ${IREE_HOST_BINARY_ROOT})" -BUILD_HOST_DIR="${BUILD_HOST_DIR:-build-benchmark-suites-test}" - -"$CMAKE_BIN" --version -ninja --version - -# --------------------------------------------------------------------------- # -if [[ -d "${BUILD_HOST_DIR}" ]]; then - echo "${BUILD_HOST_DIR} directory already exists. Will use cached results there." -else - echo "${BUILD_HOST_DIR} directory does not already exist. Creating a new one." - mkdir -p "${BUILD_HOST_DIR}" -fi - -# Configure, build, test -declare -a CMAKE_ARGS=( - "-G" "Ninja" - "-B" "${BUILD_HOST_DIR}" - "-DCMAKE_BUILD_TYPE=RelWithDebInfo" - "-DIREE_BUILD_COMPILER=OFF" - "-DIREE_HOST_BINARY_ROOT=${IREE_HOST_BINARY_ROOT}" - "-DIREE_BUILD_TESTS=ON" - "-DIREE_BUILD_SAMPLES=OFF" - "-DIREE_E2E_TEST_ARTIFACTS_DIR=${E2E_TEST_ARTIFACTS_DIR}" -) - -echo "Configuring to build tests for benchmark suites" -"${CMAKE_BIN}" "${CMAKE_ARGS[@]}" - -echo "Building tests artifacts" -"${CMAKE_BIN}" --build "${BUILD_HOST_DIR}" \ - --target iree-run-module iree-run-module-test-deps -- -k 0 - -ctest_args=( - "--timeout 900" - "--output-on-failure" - "--no-tests=error" -) - -declare -a label_args=( - "^test-type=run-module-test$" -) -label_include_regex="($(IFS="|" ; echo "${label_args[*]}"))" - -echo "******** Running run-module CTest ********" -ctest --test-dir ${BUILD_HOST_DIR} ${ctest_args[@]} \ - --label-regex ${label_include_regex}
diff --git a/build_tools/cmake/test_benchmark_suites_on_linux.sh b/build_tools/cmake/test_benchmark_suites_on_linux.sh new file mode 100755 index 0000000..85fab8e --- /dev/null +++ b/build_tools/cmake/test_benchmark_suites_on_linux.sh
@@ -0,0 +1,56 @@ +#!/bin/bash + +# Copyright 2022 The IREE Authors +# +# 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 + +# Build tests based on benchmark suites for IREE. +# +# The desired build directory can be passed as the first argument. Otherwise, it +# uses the environment variable IREE_TARGET_BUILD_DIR, defaulting to +# "build-benchmark-suites-test". Designed for CI, but can be run manually. It +# reuses the build directory if it already exists. Expects to be run from the +# root of the IREE repository. +set -xeuo pipefail + +BUILD_DIR="${1:-${IREE_TARGET_BUILD_DIR:-build-benchmark-suites-test}}" +E2E_TEST_ARTIFACTS_DIR="$(realpath ${E2E_TEST_ARTIFACTS_DIR:-build-e2e-test-artifacts/e2e_test_artifacts})" +IREE_HOST_BINARY_ROOT="$(realpath ${IREE_HOST_BINARY_ROOT})" + +source build_tools/cmake/setup_build.sh + +# Configure, build, test +declare -a CMAKE_ARGS=( + "-G" "Ninja" + "-B" "${BUILD_DIR}" + "-DCMAKE_BUILD_TYPE=RelWithDebInfo" + "-DIREE_BUILD_COMPILER=OFF" + "-DIREE_HOST_BINARY_ROOT=${IREE_HOST_BINARY_ROOT}" + "-DIREE_BUILD_TESTS=ON" + "-DIREE_BUILD_SAMPLES=OFF" + "-DIREE_E2E_TEST_ARTIFACTS_DIR=${E2E_TEST_ARTIFACTS_DIR}" +) + +echo "Configuring to build tests for benchmark suites" +"${CMAKE_BIN}" "${CMAKE_ARGS[@]}" + +echo "Building tests artifacts" +"${CMAKE_BIN}" --build "${BUILD_DIR}" \ + --target iree-run-module iree-run-module-test-deps -- -k 0 + +ctest_args=( + "--timeout 900" + "--output-on-failure" + "--no-tests=error" +) + +declare -a label_args=( + "^test-type=run-module-test$" +) +label_include_regex="($(IFS="|" ; echo "${label_args[*]}"))" + +echo "******** Running run-module CTest ********" +ctest --test-dir ${BUILD_DIR} ${ctest_args[@]} \ + --label-regex ${label_include_regex}
diff --git a/build_tools/cmake/test_riscv.sh b/build_tools/cmake/test_riscv.sh index c6c2308..0ed3db9 100755 --- a/build_tools/cmake/test_riscv.sh +++ b/build_tools/cmake/test_riscv.sh
@@ -9,14 +9,15 @@ # Test the cross-compiled RISCV 64-bit Linux targets. # # The desired build directory can be passed as the first argument. Otherwise, it -# uses the environment variable IREE_RISCV_BUILD_DIR, defaulting to +# uses the environment variable IREE_TARGET_BUILD_DIR, defaulting to # "build-riscv". Designed for CI, but can be run manually. Expects to be run # from the root of the IREE repository. set -xeuo pipefail -BUILD_DIR="${1:-${IREE_BUILD_RISCV_DIR:-build-riscv}}" -RISCV_ARCH="${RISCV_ARCH:-rv64}" +BUILD_DIR="${1:-${IREE_TARGET_BUILD_DIR:-build-riscv}}" +RISCV_PLATFORM="${IREE_TARGET_PLATFORM:-linux}" +RISCV_ARCH="${IREE_TARGET_ARCH:-riscv_64}" BUILD_PRESET="${BUILD_PRESET:-test}" # Environment variable used by the emulator. @@ -77,7 +78,7 @@ echo "******** Running tools CTest ********" ctest ${tools_ctest_args[@]} -if [[ "${RISCV_ARCH}" == "rv32-linux" ]]; then +if [[ "${RISCV_PLATFORM}-${RISCV_ARCH}" == "linux-riscv_32" ]]; then # mhlo.power is also disabled because musl math library is not compiled for # 32-bit. test_exclude_args+=(
diff --git a/docs/website/docs/building-from-source/riscv.md b/docs/website/docs/building-from-source/riscv.md index b8abc0b..ca2fcfb 100644 --- a/docs/website/docs/building-from-source/riscv.md +++ b/docs/website/docs/building-from-source/riscv.md
@@ -77,7 +77,7 @@ cmake -GNinja -B ../iree-build-riscv/ \ -DCMAKE_TOOLCHAIN_FILE="./build_tools/cmake/riscv.toolchain.cmake" \ -DIREE_HOST_BINARY_ROOT=$(realpath ../iree-build/install) \ - -DRISCV_CPU=rv64 \ + -DRISCV_CPU=linux-riscv_64 \ -DIREE_BUILD_COMPILER=OFF \ -DRISCV_TOOLCHAIN_ROOT=${RISCV_TOOLCHAIN_ROOT} \ -DIREE_ENABLE_CPUINFO=OFF \
diff --git a/tests/riscv32/smoke.sh b/tests/riscv32/smoke.sh index 7e84c61..686afe5 100755 --- a/tests/riscv32/smoke.sh +++ b/tests/riscv32/smoke.sh
@@ -8,13 +8,13 @@ # Smoke test the cross-compiled RISCV-32 targets. # -# The build directory containing tests can be passed as the first argument. Otherwise, it -# uses the environment variable IREE_RISCV_BUILD_DIR, defaulting to -# "build-riscv". Designed for CI, but can be run manually. +# The build directory containing tests can be passed as the first argument. +# Otherwise, it uses the environment variable IREE_TARGET_BUILD_DIR, defaulting +# to "build-riscv". Designed for CI, but can be run manually. set -xeuo pipefail -BUILD_DIR="${1:-${IREE_BUILD_RISCV_DIR:-build-riscv}}" +BUILD_DIR="${1:-${IREE_TARGET_BUILD_DIR:-build-riscv}}" # Run the embedded_library module loader and simple_embedding under QEMU. echo "Test elf_module_test_binary"