Elffuss BraidHub

kikocis/kleidiai public

main · 8.7 KiBRawPermalink
1# SPDX-FileCopyrightText: Copyright 2026 Arm Limited and/or its affiliates <open-source-office@arm.com>
2#
3# SPDX-License-Identifier: Apache-2.0
4#
5# Summary:
6# Build and test experimental/ops across different targets.
7# Purpose and scope:
8# - Validate experimental/ops native benchmark builds with Clang and GCC.
9# - Run GEMM, convolution and depthwise soak test plans against native builds.
10# - Cover ASan variants with reduced test limits for diagnostic coverage.
11# - Keep experimental/ops checks change-gated in MRs while preserving default
12# branch and protected tag coverage when re-enabled.
13# Main jobs (high-level):
14# - build-experimental-ops-* : compile experimental/ops benchmark binaries.
15# - test-experimental-ops-* : execute experimental/ops soak test plans.
16# Usage notes:
17# - Temporarily disabled while the experimental/ops CI coverage is reworked.
18# - Changes to shared root CI config are listed because shared defaults, runner
19# settings and variables can affect experimental/ops when re-enabled.
20#
21
22# Base template: .experimental-ops-rules
23# Notice: Temporarily disabled while the experimental/ops CI coverage is reworked.
24# Purpose: Run experimental/ops checks only when relevant in MRs, and always on default branch/protected tags.
25.experimental-ops-rules:
26 timeout: 1h
27 rules:
28 - when: never
29 - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
30 changes:
31 - .gitlab-ci.yml
32 - .gitlab/ci/experimental-ops.yml
33 - experimental/ops/**/*
34 exists:
35 - experimental/ops/CMakeLists.txt
36 - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
37 exists:
38 - experimental/ops/CMakeLists.txt
39 variables:
40 CACHE_POLICY: pull-push
41 - if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
42 exists:
43 - experimental/ops/CMakeLists.txt
44
45.macos-android-ndk-setup:
46 script:
47 - &macos_android_ndk_setup |
48 MACOS_ANDROID_SDK="${ANDROID_HOME:-${HOME}/Library/Android/sdk}"
49 MACOS_ANDROID_NDK="${ANDROID_NDK_HOME:-${MACOS_ANDROID_SDK}/ndk/${MACOS_ANDROID_NDK_VERSION}}"
50 test -f "${MACOS_ANDROID_NDK}/build/cmake/android.toolchain.cmake" || { echo "Android NDK toolchain file not found under ${MACOS_ANDROID_NDK}"; exit 1; }
51
52# Base template: .build-experimental-ops-native
53# Purpose: Build the experimental/ops benchmark executable for native test jobs.
54.build-experimental-ops-native:
55 extends:
56 - .experimental-ops-rules
57 stage: build
58 script:
59 - cmake -G Ninja
60 --toolchain ${CI_PROJECT_DIR}/${EXPERIMENTAL_OPS_TOOLCHAIN_FILE}
61 -DCMAKE_C_COMPILER=${EXPERIMENTAL_OPS_C_COMPILER}
62 -DCMAKE_CXX_COMPILER=${EXPERIMENTAL_OPS_CXX_COMPILER}
63 -DKLEIDIAI_OPS_ENABLE_BUILD_BENCHMARK=ON
64 ${EXPERIMENTAL_OPS_CMAKE_EXTRA:-}
65 -S experimental/ops
66 -B ${CI_JOB_NAME_SLUG}
67 - cmake --build ${CI_JOB_NAME_SLUG} -j${PARALLEL_JOBS} --verbose
68 artifacts:
69 expire_in: 1 day
70 paths:
71 - ${CI_JOB_NAME_SLUG}/benchmark/gemm
72
73# Base template: .test-experimental-ops-native
74# Purpose: Run the native GEMM, convolution, and depthwise test plans.
75.test-experimental-ops-native:
76 extends:
77 - .experimental-ops-rules
78 stage: test
79 timeout: 2h
80 variables:
81 RUNNER_SCRIPT_TIMEOUT: 2h
82 script:
83 - |
84 if [ -n "${EXPERIMENTAL_OPS_ASAN_OPTIONS:-}" ]; then
85 export ASAN_OPTIONS="${EXPERIMENTAL_OPS_ASAN_OPTIONS}"
86 fi
87 - echo "Running soak tests with ${PARALLEL_JOBS} threads"
88 - |
89 set -o pipefail
90 python3 experimental/ops/scripts/soak-full.py \
91 --test_plan_file experimental/ops/tests/configs/conv_tests.cfg \
92 --run_test_plan \
93 --conv \
94 --threads ${PARALLEL_JOBS} \
95 ${EXPERIMENTAL_OPS_SOAK_EXTRA_ARGS:-} \
96 --binary ${EXPERIMENTAL_OPS_BUILD_DIR}/benchmark/gemm 2>&1 \
97 | tee conv_tests.log
98 - |
99 set -o pipefail
100 python3 experimental/ops/scripts/soak-full.py \
101 --test_plan_file experimental/ops/tests/configs/depthwise_tests.cfg \
102 --run_test_plan \
103 --conv \
104 --kernel_filter depthwise \
105 --threads ${PARALLEL_JOBS} \
106 ${EXPERIMENTAL_OPS_SOAK_EXTRA_ARGS:-} \
107 --binary ${EXPERIMENTAL_OPS_BUILD_DIR}/benchmark/gemm 2>&1 \
108 | tee depthwise_tests.log
109 - |
110 set -o pipefail
111 python3 experimental/ops/scripts/soak-full.py \
112 --test_plan_file experimental/ops/tests/configs/gemm_tests.cfg \
113 --run_test_plan \
114 --threads ${PARALLEL_JOBS} \
115 ${EXPERIMENTAL_OPS_SOAK_EXTRA_ARGS:-} \
116 --binary ${EXPERIMENTAL_OPS_BUILD_DIR}/benchmark/gemm 2>&1 \
117 | tee gemm_tests.log
118 artifacts:
119 when: always
120 expire_in: 7 days
121 paths:
122 - conv_tests.log
123 - depthwise_tests.log
124 - gemm_tests.log
125 - soak-*/
126
127build-experimental-ops-clang-linux-aarch64:
128 extends:
129 - .build-experimental-ops-native
130 variables:
131 EXPERIMENTAL_OPS_C_COMPILER: clang
132 EXPERIMENTAL_OPS_CXX_COMPILER: clang++
133 EXPERIMENTAL_OPS_TOOLCHAIN_FILE: experimental/ops/toolchains/native/native-linux-aarch64-gnu.cmake
134
135build-experimental-ops-clang-asan-linux-aarch64:
136 extends:
137 - .build-experimental-ops-native
138 variables:
139 EXPERIMENTAL_OPS_C_COMPILER: clang
140 EXPERIMENTAL_OPS_CXX_COMPILER: clang++
141 EXPERIMENTAL_OPS_TOOLCHAIN_FILE: experimental/ops/toolchains/native/native-linux-aarch64-gnu.cmake
142 EXPERIMENTAL_OPS_CMAKE_EXTRA: >-
143 -DCMAKE_BUILD_TYPE=Debug
144 -DKLEIDIAI_OPS_CCXX_FLAGS_INIT:STRING=-g;-fsanitize=address;-fno-omit-frame-pointer;-fno-common
145 -DKLEIDIAI_OPS_LINKER_FLAGS_INIT:STRING=-fsanitize=address
146
147build-experimental-ops-gcc-linux-aarch64:
148 extends:
149 - .build-experimental-ops-native
150 variables:
151 EXPERIMENTAL_OPS_C_COMPILER: gcc
152 EXPERIMENTAL_OPS_CXX_COMPILER: g++
153 EXPERIMENTAL_OPS_TOOLCHAIN_FILE: experimental/ops/toolchains/native/native-linux-aarch64-gnu.cmake
154
155build-experimental-ops-clang-macos:
156 extends:
157 - .build-experimental-ops-native
158 tags:
159 - apple_silicon
160 variables:
161 EXPERIMENTAL_OPS_C_COMPILER: clang
162 EXPERIMENTAL_OPS_CXX_COMPILER: clang++
163 EXPERIMENTAL_OPS_TOOLCHAIN_FILE: experimental/ops/toolchains/native/native-macos-aarch64-clang.cmake
164
165build-experimental-ops-clang-asan-macos:
166 extends:
167 - .build-experimental-ops-native
168 tags:
169 - apple_silicon
170 variables:
171 EXPERIMENTAL_OPS_C_COMPILER: clang
172 EXPERIMENTAL_OPS_CXX_COMPILER: clang++
173 EXPERIMENTAL_OPS_TOOLCHAIN_FILE: experimental/ops/toolchains/native/native-macos-aarch64-clang.cmake
174 EXPERIMENTAL_OPS_CMAKE_EXTRA: >-
175 -DCMAKE_BUILD_TYPE=Debug
176 -DKLEIDIAI_OPS_CCXX_FLAGS_INIT:STRING=-g;-fsanitize=address;-fno-omit-frame-pointer;-fno-common
177 -DKLEIDIAI_OPS_LINKER_FLAGS_INIT:STRING=-fsanitize=address
178
179build-experimental-ops-android-arm64-v8a:
180 extends:
181 - .experimental-ops-rules
182 stage: build
183 needs: []
184 tags:
185 - apple_silicon
186 script:
187 - *macos_android_ndk_setup
188 - export ANDROID_NDK_HOME="${MACOS_ANDROID_NDK}"
189 - cmake -G Ninja
190 --toolchain ${CI_PROJECT_DIR}/experimental/ops/toolchains/cross/cross-android-arm64-v8a.cmake
191 -DCMAKE_ANDROID_NDK=${MACOS_ANDROID_NDK}
192 -DKLEIDIAI_OPS_ENABLE_BUILD_BENCHMARK=ON
193 -S experimental/ops
194 -B ${CI_JOB_NAME_SLUG}
195 - cmake --build ${CI_JOB_NAME_SLUG} -j${PARALLEL_JOBS} --verbose
196
197test-experimental-ops-clang-linux-aarch64:
198 extends:
199 - .test-experimental-ops-native
200 needs:
201 - build-experimental-ops-clang-linux-aarch64
202 variables:
203 EXPERIMENTAL_OPS_BUILD_DIR: build-experimental-ops-clang-linux-aarch64
204
205test-experimental-ops-clang-asan-linux-aarch64:
206 extends:
207 - .test-experimental-ops-native
208 needs:
209 - build-experimental-ops-clang-asan-linux-aarch64
210 variables:
211 EXPERIMENTAL_OPS_BUILD_DIR: build-experimental-ops-clang-asan-linux-aarch64
212 EXPERIMENTAL_OPS_ASAN_OPTIONS: halt_on_error=1:print_stacktrace=1
213 EXPERIMENTAL_OPS_SOAK_EXTRA_ARGS: --case_limit 20
214 KUBERNETES_CPU_REQUEST: 8
215 KUBERNETES_CPU_LIMIT: 12
216 PARALLEL_JOBS: 4
217
218test-experimental-ops-gcc-linux-aarch64:
219 extends:
220 - .test-experimental-ops-native
221 needs:
222 - build-experimental-ops-gcc-linux-aarch64
223 variables:
224 EXPERIMENTAL_OPS_BUILD_DIR: build-experimental-ops-gcc-linux-aarch64
225 KUBERNETES_CPU_REQUEST: 32
226 KUBERNETES_CPU_LIMIT: 48
227 PARALLEL_JOBS: 32
228
229test-experimental-ops-clang-macos:
230 extends:
231 - .test-experimental-ops-native
232 needs:
233 - build-experimental-ops-clang-macos
234 tags:
235 - apple_silicon
236 variables:
237 EXPERIMENTAL_OPS_BUILD_DIR: build-experimental-ops-clang-macos
238
239test-experimental-ops-clang-asan-macos:
240 extends:
241 - .test-experimental-ops-native
242 needs:
243 - build-experimental-ops-clang-asan-macos
244 tags:
245 - apple_silicon
246 variables:
247 EXPERIMENTAL_OPS_BUILD_DIR: build-experimental-ops-clang-asan-macos
248 EXPERIMENTAL_OPS_ASAN_OPTIONS: halt_on_error=1:print_stacktrace=1
249 EXPERIMENTAL_OPS_SOAK_EXTRA_ARGS: --case_limit 20