Skip to content

Commit

Permalink
Enable riscv64 ci jobs in pkgci.yml. (#18274)
Browse files Browse the repository at this point in the history
ci-exactly: build_packages, test_riscv64

Signed-off-by: Alex Chiang <alex.chiang@sifive.com>
  • Loading branch information
alexsifivetw authored Aug 23, 2024
1 parent 56ecef7 commit 70d212b
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 14 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/pkgci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
92 changes: 92 additions & 0 deletions .github/workflows/pkgci_test_riscv64.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 0 additions & 8 deletions build_tools/cmake/test_riscv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 70d212b

Please sign in to comment.