-
Notifications
You must be signed in to change notification settings - Fork 2
417 lines (355 loc) · 15.3 KB
/
Copy pathci.yml
File metadata and controls
417 lines (355 loc) · 15.3 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
benchmark-khronos-mivisionx:
runs-on: ubuntu-latest
name: Khronos & MIVisionX - Build, Benchmark & Compare
steps:
- name: Checkout openvx-mark
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y cmake build-essential
# --- Khronos Sample Implementation ---
- name: Build Khronos OpenVX sample
run: |
git clone --recursive --depth 1 https://github.com/KhronosGroup/OpenVX-sample-impl.git /tmp/openvx-khronos
cd /tmp/openvx-khronos
python Build.py --os=Linux --arch=64 --conf=Release
- name: Find Khronos libraries
id: khronos
run: |
LIB_DIR=$(dirname $(find /tmp/openvx-khronos -name "libopenvx.so" -not -path "*/build/*" | head -1))
echo "lib_dir=$LIB_DIR" >> "$GITHUB_OUTPUT"
echo "Found Khronos libraries in: $LIB_DIR"
ls -la "$LIB_DIR"/libopenvx* "$LIB_DIR"/libvxu* 2>/dev/null || true
- name: Build openvx-mark (Khronos)
run: |
mkdir build-khronos && cd build-khronos
cmake -DOPENVX_INCLUDES=/tmp/openvx-khronos/api-docs/include \
-DOPENVX_LIB_DIR=${{ steps.khronos.outputs.lib_dir }} ..
cmake --build . -j$(nproc)
- name: Run benchmark (Khronos)
run: |
cd build-khronos
export LD_LIBRARY_PATH=${{ steps.khronos.outputs.lib_dir }}:$LD_LIBRARY_PATH
./openvx-mark --resolution VGA --iterations 10 --warmup 3
# --- MIVisionX (AMD OpenVX) ---
- name: Build MIVisionX (CPU backend)
run: |
git clone --depth 1 --branch develop https://github.com/ROCm/MIVisionX.git /tmp/openvx-mivisionx
cd /tmp/openvx-mivisionx && mkdir build && cd build
cmake -DBACKEND=CPU -DNEURAL_NET=OFF -DLOOM=OFF -DMIGRAPHX=OFF \
-DCMAKE_INSTALL_PREFIX=/tmp/openvx-mivisionx/install ..
make -j$(nproc)
make install
- name: Find MIVisionX libraries
id: mivisionx
run: |
LIB_DIR=$(dirname $(find /tmp/openvx-mivisionx -name "libopenvx.so" -not -path "*/build/*" | head -1))
echo "lib_dir=$LIB_DIR" >> "$GITHUB_OUTPUT"
echo "Found MIVisionX libraries in: $LIB_DIR"
ls -la "$LIB_DIR"/libopenvx* "$LIB_DIR"/libvxu* 2>/dev/null || true
- name: Build openvx-mark (MIVisionX)
run: |
mkdir build-mivisionx && cd build-mivisionx
cmake -DOPENVX_INCLUDES=/tmp/openvx-mivisionx/install/include/mivisionx \
-DOPENVX_LIB_DIR=${{ steps.mivisionx.outputs.lib_dir }} ..
cmake --build . -j$(nproc)
- name: Run benchmark (MIVisionX)
run: |
cd build-mivisionx
export LD_LIBRARY_PATH=${{ steps.mivisionx.outputs.lib_dir }}:$LD_LIBRARY_PATH
./openvx-mark --resolution VGA --iterations 10 --warmup 3
# --- Compare Results ---
- name: Compare benchmark results
run: |
KHRONOS=build-khronos/benchmark_results/benchmark_results.json
MIVISIONX=build-mivisionx/benchmark_results/benchmark_results.json
if [ ! -f "$KHRONOS" ] || [ ! -f "$MIVISIONX" ]; then
echo "Skipping comparison — one or both benchmark results missing"
exit 0
fi
python3 scripts/compare_reports.py "$KHRONOS" "$MIVISIONX" \
--output comparison
- name: Post comparison to job summary
if: always()
run: |
if [ -f comparison.md ]; then
cat comparison.md >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload Khronos results
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results-khronos-sample
path: build-khronos/benchmark_results/
if-no-files-found: ignore
- name: Upload MIVisionX results
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results-mivisionx-cpu
path: build-mivisionx/benchmark_results/
if-no-files-found: ignore
- name: Upload comparison report
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-comparison-khronos-mivisionx
path: comparison.*
if-no-files-found: ignore
benchmark-mivisionx-tiovx:
runs-on: ubuntu-latest
name: MIVisionX & TIOVX - Build, Benchmark & Compare
steps:
- name: Checkout openvx-mark
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y cmake build-essential
# --- MIVisionX (AMD OpenVX) ---
- name: Build MIVisionX (CPU backend)
run: |
git clone --depth 1 --branch develop https://github.com/ROCm/MIVisionX.git /tmp/openvx-mivisionx
cd /tmp/openvx-mivisionx && mkdir build && cd build
cmake -DBACKEND=CPU -DNEURAL_NET=OFF -DLOOM=OFF -DMIGRAPHX=OFF \
-DCMAKE_INSTALL_PREFIX=/tmp/openvx-mivisionx/install ..
make -j$(nproc)
make install
- name: Find MIVisionX libraries
id: mivisionx
run: |
LIB_DIR=$(dirname $(find /tmp/openvx-mivisionx -name "libopenvx.so" -not -path "*/build/*" | head -1))
echo "lib_dir=$LIB_DIR" >> "$GITHUB_OUTPUT"
echo "Found MIVisionX libraries in: $LIB_DIR"
ls -la "$LIB_DIR"/libopenvx* "$LIB_DIR"/libvxu* 2>/dev/null || true
- name: Build openvx-mark (MIVisionX)
run: |
mkdir build-mivisionx && cd build-mivisionx
cmake -DOPENVX_INCLUDES=/tmp/openvx-mivisionx/install/include/mivisionx \
-DOPENVX_LIB_DIR=${{ steps.mivisionx.outputs.lib_dir }} ..
cmake --build . -j$(nproc)
- name: Run benchmark (MIVisionX)
run: |
cd build-mivisionx
export LD_LIBRARY_PATH=${{ steps.mivisionx.outputs.lib_dir }}:$LD_LIBRARY_PATH
./openvx-mark --resolution VGA --iterations 10 --warmup 3
# --- TIOVX (TI OpenVX - PC emulation build) ---
- name: Clone TIOVX
run: |
git clone --depth 1 https://github.com/TexasInstruments/tiovx.git /tmp/tiovx
- name: Build TIOVX (PC/Linux emulation)
run: |
cd /tmp/tiovx
# Create stub headers for missing TI SDK dependencies
# Stubs mirror the include paths used by TIOVX source files
mkdir -p stubs/utils/mem/include
mkdir -p stubs/utils/perf_stats/include
cat > stubs/app_mem_map.h << 'STUB_EOF'
#ifndef APP_MEM_MAP_H
#define APP_MEM_MAP_H
#define TIOVX_OBJ_DESC_MEM_SIZE (128U * 1024U * 1024U)
#endif
STUB_EOF
cat > stubs/utils/perf_stats/include/app_perf_stats.h << 'STUB_EOF'
#ifndef APP_PERF_STATS_H
#define APP_PERF_STATS_H
typedef struct { int dummy; } app_perf_stats_t;
static inline int appPerfStatsRegisterTask(void *a, const char *b) { (void)a; (void)b; return 0; }
static inline int appPerfStatsDeRegisterTask(void *a) { (void)a; return 0; }
#endif
STUB_EOF
# tivx_mem.c includes <utils/mem/include/app_mem.h>
cat > stubs/utils/mem/include/app_mem.h << 'STUB_EOF'
#ifndef APP_MEM_H
#define APP_MEM_H
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
/* Heap ID enums used by tivx_mem.c */
#define APP_MEM_HEAP_DDR (0U)
#define APP_MEM_HEAP_L3 (1U)
#define APP_MEM_HEAP_L2 (2U)
#define APP_MEM_HEAP_L1 (3U)
#define APP_MEM_HEAP_DDR_SCRATCH (4U)
#define APP_MEM_HEAP_DDR_NON_CACHE (5U)
#define APP_MEM_HEAP_DDR_NON_CACHE_SCRATCH (6U)
#define APP_MEM_HEAP_DDR_WT_CACHE (7U)
#define APP_MEM_HEAP_DDR_SHARED (8U)
static inline uint32_t appMemRegionQuery(uint32_t heap_id) {
(void)heap_id;
return 1U;
}
static inline void *appMemAlloc(uint32_t heap_id, uint32_t size, uint32_t align) {
(void)heap_id; (void)align;
void *ptr = malloc(size);
if (ptr) memset(ptr, 0, size);
return ptr;
}
static inline int32_t appMemFree(uint32_t heap_id, void *ptr, uint32_t size) {
(void)heap_id; (void)size;
free(ptr);
return 0;
}
static inline uint64_t appMemGetVirt2PhyBufPtr(uint64_t virt, uint32_t heap_id) {
(void)heap_id;
return virt;
}
static inline int32_t appMemGetDmaBufFd(void *virtAddr, int32_t *offset) {
(void)virtAddr;
if (offset) *offset = 0;
return -1;
}
static inline int32_t appMemTranslateDmaBufFd(uint32_t fd, uint32_t size, uint64_t *virtAddr, uint64_t *phyAddr) {
(void)fd; (void)size;
if (virtAddr) *virtAddr = 0;
if (phyAddr) *phyAddr = 0;
return -1;
}
static inline void *appMemMap(void *phys_ptr, uint32_t size) {
(void)size;
return phys_ptr;
}
static inline int32_t appMemUnMap(void *virt_ptr, uint32_t size) {
(void)virt_ptr; (void)size;
return 0;
}
#endif
STUB_EOF
# Also place app_mem.h at stubs/ for any direct includes
cp stubs/utils/mem/include/app_mem.h stubs/app_mem.h
cat > stubs/app_init.h << 'STUB_EOF'
#ifndef APP_INIT_H
#define APP_INIT_H
#endif
STUB_EOF
# Create a CMakeLists.txt for standalone PC build
cat > CMakeLists.txt << 'CMAKE_EOF'
cmake_minimum_required(VERSION 3.10)
project(tiovx C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# SOC definition (required by tivx_config.h, J721E is the default)
add_definitions(-DSOC_J721E -DHOST_EMULATION -DLINUX -DPC)
# Include paths
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/source/include
${CMAKE_SOURCE_DIR}/source/platform/pc/common
${CMAKE_SOURCE_DIR}/source/platform/common/os/posix
${CMAKE_SOURCE_DIR}/stubs
${CMAKE_SOURCE_DIR}/kernels/include
)
# Suppress warnings for third-party code
add_compile_options(-w)
# Framework sources
file(GLOB FRAMEWORK_SRC source/framework/*.c)
# VXU sources
file(GLOB VXU_SRC source/vxu/*.c)
# Platform PC sources
file(GLOB PLATFORM_PC_SRC
source/platform/pc/linux/*.c
source/platform/pc/common/*.c
)
# POSIX OS abstraction
file(GLOB POSIX_SRC source/platform/common/os/posix/*.c)
# Platform common
set(PLATFORM_COMMON_SRC source/platform/common/tivx_host.c)
if(EXISTS "${CMAKE_SOURCE_DIR}/source/platform/common/tivx_init.c")
list(APPEND PLATFORM_COMMON_SRC source/platform/common/tivx_init.c)
endif()
# Core kernel host sources (kernel registration, not DSP implementations)
file(GLOB CORE_KERNEL_HOST_SRC kernels/openvx-core/host/*.c)
# Combine all sources
set(ALL_SRC
${FRAMEWORK_SRC}
${VXU_SRC}
${PLATFORM_PC_SRC}
${POSIX_SRC}
${PLATFORM_COMMON_SRC}
${CORE_KERNEL_HOST_SRC}
)
# Build shared libraries
add_library(openvx SHARED ${ALL_SRC})
target_link_libraries(openvx pthread rt dl m)
add_library(vxu SHARED ${VXU_SRC})
target_link_libraries(vxu openvx)
# Install
install(TARGETS openvx vxu DESTINATION lib)
install(DIRECTORY include/VX DESTINATION include)
CMAKE_EOF
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/tmp/tiovx/install .. 2>&1 || true
make -j$(nproc) 2>&1 || echo "TIOVX build had warnings/errors — checking if libraries were produced"
ls -la libopenvx.so libvxu.so 2>/dev/null || echo "Libraries not produced — TIOVX build failed"
- name: Find TIOVX libraries
id: tiovx
run: |
if [ -f /tmp/tiovx/build/libopenvx.so ]; then
echo "lib_dir=/tmp/tiovx/build" >> "$GITHUB_OUTPUT"
echo "build_ok=true" >> "$GITHUB_OUTPUT"
echo "Found TIOVX libraries"
ls -la /tmp/tiovx/build/libopenvx.so /tmp/tiovx/build/libvxu.so
else
echo "build_ok=false" >> "$GITHUB_OUTPUT"
echo "TIOVX build did not produce libraries — skipping benchmark"
fi
- name: Build openvx-mark (TIOVX)
if: steps.tiovx.outputs.build_ok == 'true'
run: |
mkdir build-tiovx && cd build-tiovx
cmake -DOPENVX_INCLUDES=/tmp/tiovx/include \
-DOPENVX_LIB_DIR=${{ steps.tiovx.outputs.lib_dir }} ..
cmake --build . -j$(nproc)
- name: Run benchmark (TIOVX)
if: steps.tiovx.outputs.build_ok == 'true'
run: |
cd build-tiovx
export LD_LIBRARY_PATH=${{ steps.tiovx.outputs.lib_dir }}:$LD_LIBRARY_PATH
./openvx-mark --resolution VGA --iterations 10 --warmup 3
# --- Compare Results ---
- name: Compare benchmark results
if: steps.tiovx.outputs.build_ok == 'true'
run: |
MIVISIONX=build-mivisionx/benchmark_results/benchmark_results.json
TIOVX=build-tiovx/benchmark_results/benchmark_results.json
if [ ! -f "$MIVISIONX" ] || [ ! -f "$TIOVX" ]; then
echo "Skipping comparison — one or both benchmark results missing"
exit 0
fi
python3 scripts/compare_reports.py "$MIVISIONX" "$TIOVX" \
--output comparison-mivisionx-tiovx
- name: Post comparison to job summary
if: always()
run: |
if [ -f comparison-mivisionx-tiovx.md ]; then
cat comparison-mivisionx-tiovx.md >> "$GITHUB_STEP_SUMMARY"
else
echo "## TIOVX Comparison" >> "$GITHUB_STEP_SUMMARY"
echo "TIOVX build did not succeed — comparison skipped." >> "$GITHUB_STEP_SUMMARY"
echo "TIOVX requires TI Processor SDK dependencies that may not be available in CI." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload MIVisionX results
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results-mivisionx-cpu-tiovx-job
path: build-mivisionx/benchmark_results/
if-no-files-found: ignore
- name: Upload TIOVX results
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results-tiovx-pc
path: build-tiovx/benchmark_results/
if-no-files-found: ignore
- name: Upload comparison report
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-comparison-mivisionx-tiovx
path: comparison-mivisionx-tiovx.*
if-no-files-found: ignore