diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ac414af217f..8110e5331c56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -250,12 +250,6 @@ jobs: # matrix: # target: # - platform: linux - # arch: riscv_64 - # abi: lp64d - # docker_image: "gcr.io/iree-oss/riscv@sha256:62e87bad3405d691ddba6f9be0ef44eeb60461a467c8d86f0842c81a1f97da79" - # build_script: "./build_tools/cmake/build_riscv.sh" - # test_script: "./build_tools/cmake/test_riscv.sh" - # - platform: linux # arch: riscv_32 # abi: ilp32d # docker_image: "gcr.io/iree-oss/riscv@sha256:62e87bad3405d691ddba6f9be0ef44eeb60461a467c8d86f0842c81a1f97da79" diff --git a/.github/workflows/pkgci.yml b/.github/workflows/pkgci.yml index 2effd7593fee..f156dd8c9703 100644 --- a/.github/workflows/pkgci.yml +++ b/.github/workflows/pkgci.yml @@ -85,3 +85,10 @@ jobs: uses: ./.github/workflows/pkgci_test_android.yml with: write-caches: ${{ needs.setup.outputs.write-caches }} + + test_riscv64: + needs: [setup, build_packages] + if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_riscv64') + uses: ./.github/workflows/pkgci_test_riscv64.yml + with: + write-caches: ${{ needs.setup.outputs.write-caches }} diff --git a/.github/workflows/pkgci_test_riscv64.yml b/.github/workflows/pkgci_test_riscv64.yml new file mode 100644 index 000000000000..e253360bd2de --- /dev/null +++ b/.github/workflows/pkgci_test_riscv64.yml @@ -0,0 +1,92 @@ +# Copyright 2024 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 + +# Workflow for RISCV64 cross-compilation and test jobs. +# The concurrency of this workflow is controlled by the caller's job. + +name: PkgCI Test RISCV64 + +on: + workflow_call: + inputs: + artifact_run_id: + type: string + default: "" + write-caches: + required: true + type: string + workflow_dispatch: + inputs: + artifact_run_id: + type: string + default: "" + write-caches: + required: true + type: string + +permissions: + contents: read + +jobs: + cross_compile: + runs-on: ubuntu-20.04 + env: + PACKAGE_DOWNLOAD_DIR: ${{ github.workspace }}/.packages + VENV_DIR: ${{ github.workspace }}/.venv + BOOTSTRAP_WORK_DIR: ${{ github.workspace }}/.bootstrap + RISCV_RV64_LINUX_TOOLCHAIN_ROOT: ${{ github.workspace }}/riscv/toolchain + QEMU_PATH_PREFIX: ${{ github.workspace }}/riscv/qemu + steps: + # General setup. + - name: "Checking out repository" + uses: actions/checkout@v4.1.7 + - name: "Checking out runtime submodules" + run: ./build_tools/scripts/git/update_runtime_submodules.sh + - uses: actions/setup-python@v5.1.0 + with: + # Must match the subset of versions built in pkgci_build_packages. + python-version: "3.11" + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.job }} + save: ${{ inputs.write-caches == 1 }} + - uses: actions/download-artifact@v4.1.7 + with: + name: linux_x86_64_release_packages + path: ${{ env.PACKAGE_DOWNLOAD_DIR }} + - name: Install build dependencies + run: | + sudo apt update + sudo apt install -y ninja-build + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV + - name: Setup base venv + run: | + ./build_tools/pkgci/setup_venv.py ${VENV_DIR} \ + --artifact-path=${PACKAGE_DOWNLOAD_DIR} \ + --fetch-gh-workflow=${{ inputs.artifact_run_id }} + - name: Bootstrap + env: + IREE_ARTIFACT_URL: "https://storage.googleapis.com/iree-shared-files" + RISCV_CLANG_TOOLCHAIN_FILE_NAME: "toolchain_iree_manylinux_2_28_20231012.tar.gz" + QEMU_FILE_NAME: "qemu-riscv_8.1.2_manylinux_2.28_20231026.tar.gz" + run: | + mkdir -p ${{ env.BOOTSTRAP_WORK_DIR }} + mkdir -p ${{ env.RISCV_RV64_LINUX_TOOLCHAIN_ROOT }} + mkdir -p ${{ env.QEMU_PATH_PREFIX }} + wget --progress=bar:force:noscroll --directory-prefix="${BOOTSTRAP_WORK_DIR}" "${IREE_ARTIFACT_URL}/${RISCV_CLANG_TOOLCHAIN_FILE_NAME}" + tar -C "${{ env.RISCV_RV64_LINUX_TOOLCHAIN_ROOT }}" -xf "${BOOTSTRAP_WORK_DIR}/${RISCV_CLANG_TOOLCHAIN_FILE_NAME}" --no-same-owner --strip-components=1 + wget --progress=bar:force:noscroll --directory-prefix="${BOOTSTRAP_WORK_DIR}" "${IREE_ARTIFACT_URL}/${QEMU_FILE_NAME}" + tar -C "${{ env.QEMU_PATH_PREFIX }}" -xf "${BOOTSTRAP_WORK_DIR}/${QEMU_FILE_NAME}" --no-same-owner --strip-components=1 + - name: Build riscv64 + env: + IREE_HOST_BIN_DIR: ${{ env.VENV_DIR }}/bin + run: ./build_tools/cmake/build_riscv.sh + - name: Test riscv64 + env: + QEMU_RV64_BIN: ${{ env.QEMU_PATH_PREFIX }}/qemu-riscv64 + run: ./build_tools/cmake/test_riscv.sh diff --git a/build_tools/cmake/test_riscv.sh b/build_tools/cmake/test_riscv.sh index b78f5f730a73..1fa6aeefe56f 100755 --- a/build_tools/cmake/test_riscv.sh +++ b/build_tools/cmake/test_riscv.sh @@ -57,14 +57,6 @@ runtime_ctest_args=( echo "******** Running runtime CTest ********" ctest ${runtime_ctest_args[@]} -tools_ctest_args=( - "--test-dir ${BUILD_DIR}/tools/test" - ${ctest_args[@]} - "--label-exclude ${runtime_label_exclude_regex}" -) -echo "******** Running tools CTest ********" -ctest ${tools_ctest_args[@]} - if [[ "${RISCV_PLATFORM}-${RISCV_ARCH}" == "linux-riscv_32" ]]; then # stablehlo.power is also disabled because musl math library is not compiled for # 32-bit.