-
Notifications
You must be signed in to change notification settings - Fork 1
198 lines (176 loc) · 7.07 KB
/
Copy pathci-riscv.yml
File metadata and controls
198 lines (176 loc) · 7.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# *******************************************************************************
# Copyright 2024-2025 Arm Limited and affiliates.
# Copyright 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# *******************************************************************************
name: "CI RISC-V"
#* To avoid duplicate jobs running when both push and PR is satisfied, we use this:
#* https://github.com/orgs/community/discussions/26940#discussioncomment-5686753
on:
push:
branches: [main, "rls-*"]
paths:
- ".github/automation/riscv/**"
- ".github/workflows/ci-riscv.yml"
- "cmake/**"
- "examples/**"
- "include/**"
- "src/common/**"
- "src/cpu/*"
- "src/cpu/rv64/**"
- "tests/**"
- "CMakeLists.txt"
pull_request:
types: [opened, synchronize, reopened]
paths:
- ".github/automation/riscv/**"
- ".github/workflows/ci-riscv.yml"
- "cmake/**"
- "examples/**"
- "include/**"
- "src/common/**"
- "src/cpu/*"
- "src/cpu/rv64/**"
- "tests/**"
- "CMakeLists.txt"
#* allow manual trigger of workflow when needed.
workflow_dispatch:
#* Stop stale workflows when pull requests are updated: https://stackoverflow.com/a/70972844
#* Does not apply to the main branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
# Declare default permissions as read only.
permissions: read-all
jobs:
build:
strategy:
matrix:
config: [
{ name: riscv-build, label: ubuntu-24.04, threading: OMP, toolset: gcc, build: RelWithAssert, testset: SMOKE }
]
name: ${{ matrix.config.name }}, ${{ matrix.config.toolset }}, ${{ matrix.config.threading }}, ${{ matrix.config.build }}
runs-on: ${{ matrix.config.label }}
steps:
- name: Checkout oneDNN
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
path: oneDNN
- name: Read version file
id: get-versions
run: |
content=`cat ${{ github.workspace }}/oneDNN/.github/automation/riscv/ci.json`
content="${content//[$'\t\r\n$ ']}"
echo "output=$content" >> $GITHUB_OUTPUT
# Note: This will create a github actions cache
- name: Get latest CMake and Ninja
uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
with:
cmakeVersion: 3.31.0
ninjaVersion: 1.12.0
# Install cross-compilation tools
- name: Install cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y gcc-${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}-riscv64-linux-gnu g++-${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}-riscv64-linux-gnu
- name: Configure oneDNN
run: ${{ github.workspace }}/oneDNN/.github/automation/riscv/build.sh
working-directory: ${{ github.workspace }}/oneDNN
env:
BUILD_TOOLSET: ${{ matrix.config.toolset }}
CMAKE_BUILD_TYPE: ${{ matrix.config.build }}
CMAKE_GENERATOR: Ninja
GCC_VERSION: ${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}
ONEDNN_ACTION: configure
ONEDNN_TEST_SET: ${{ matrix.config.testset }}
ONEDNN_THREADING: ${{ matrix.config.threading }}
- name: Build oneDNN
run: ${{ github.workspace }}/oneDNN/.github/automation/riscv/build.sh
working-directory: ${{ github.workspace }}/oneDNN
env:
ONEDNN_ACTION: build
- name: Create archive with preserved permissions
working-directory: ${{ github.workspace }}/oneDNN
run: |
tar -czf build.tar.gz build
# Upload build artifacts
- name: Upload build artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-artifact
path: |
${{ github.workspace }}/oneDNN/build.tar.gz
retention-days: 1
test:
needs: build
strategy:
matrix:
config: [
# Test with different vector lengths and threading modes
{ name: riscv-test-vlen128, threading: OMP, testset: SMOKE, vlen: 128, build: RelWithAssert },
{ name: riscv-test-vlen256, threading: OMP, testset: SMOKE, vlen: 256, build: RelWithAssert }
]
name: ${{ matrix.config.name }}, ${{ matrix.config.threading }}
runs-on: ubuntu-24.04
steps:
- name: Checkout oneDNN
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
path: oneDNN
- name: Read version file
id: get-versions
run: |
content=`cat ${{ github.workspace }}/oneDNN/.github/automation/riscv/ci.json`
content="${content//[$'\t\r\n$ ']}"
echo "output=$content" >> $GITHUB_OUTPUT
# Setup QEMU for RISC-V platform support
- name: Set up QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
with:
platforms: riscv64
# Install cross-compilation tools
- name: Install cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y gcc-${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}-riscv64-linux-gnu g++-${{ fromJson(steps.get-versions.outputs.output).dependencies.gcc }}-riscv64-linux-gnu
# Download build artifacts
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build-artifact
path: ${{ github.workspace }}/oneDNN/
- name: Extract archive
working-directory: ${{ github.workspace }}/oneDNN/
run: |
tar -xzf build.tar.gz
- name: Run oneDNN tests
run: ${{ github.workspace }}/oneDNN/.github/automation/riscv/test.sh
working-directory: ${{ github.workspace }}/oneDNN/build
env:
CTEST_PARALLEL_LEVEL: 4
ONEDNN_THREADING: ${{ matrix.config.threading }}
ONEDNN_TEST_SET: ${{ matrix.config.testset }}
QEMU_CPU: "rv64,v=true,vlen=${{ matrix.config.vlen }},vext_spec=v1.0"
# This job adds a check named "CI RISC-V" that represents overall
# workflow status and can be used in branch rulesets
status:
needs: [build, test]
runs-on: ubuntu-24.04
name: "CI RISC-V"
steps:
- name: Print success
run: echo Success