Skip to content

Commit 52df5de

Browse files
kiritigowdaclaude
andcommitted
Remove TIOVX CI job and add OpenVX 1.1/1.3 version compatibility
TIOVX PC emulation requires TI Processor SDK dependencies and doesn't run reliably outside TI hardware. Keep OpenVX version detection and compatibility wrappers so openvx-mark can build against 1.1 or 1.3. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
1 parent 9839cdf commit 52df5de

5 files changed

Lines changed: 67 additions & 302 deletions

File tree

.github/workflows/ci.yml

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

include/openvx_version.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,43 @@
4949
#define OPENVX_HAS_1_3 0
5050
#endif
5151

52+
// Compatibility wrappers: OpenVX 1.3 APIs that map to 1.1 equivalents
53+
#if !OPENVX_HAS_1_3
54+
55+
static inline vx_threshold vxCreateThresholdForImage(vx_context ctx,
56+
vx_enum thresh_type, vx_df_image /*in_fmt*/, vx_df_image /*out_fmt*/) {
57+
return vxCreateThreshold(ctx, thresh_type, VX_TYPE_UINT8);
58+
}
59+
60+
static inline vx_status vxCopyThresholdValue(vx_threshold thresh,
61+
vx_pixel_value_t *value, vx_enum usage, vx_enum /*mem_type*/) {
62+
if (usage == VX_WRITE_ONLY) {
63+
vx_int32 v = value->U8;
64+
return vxSetThresholdAttribute(thresh,
65+
VX_THRESHOLD_THRESHOLD_VALUE, &v, sizeof(v));
66+
}
67+
return VX_ERROR_NOT_SUPPORTED;
68+
}
69+
70+
static inline vx_status vxCopyThresholdRange(vx_threshold thresh,
71+
vx_pixel_value_t *lower, vx_pixel_value_t *upper,
72+
vx_enum usage, vx_enum /*mem_type*/) {
73+
if (usage == VX_WRITE_ONLY) {
74+
vx_int32 lo = lower->U8, hi = upper->U8;
75+
vx_status s = vxSetThresholdAttribute(thresh,
76+
VX_THRESHOLD_THRESHOLD_LOWER, &lo, sizeof(lo));
77+
if (s != VX_SUCCESS) return s;
78+
return vxSetThresholdAttribute(thresh,
79+
VX_THRESHOLD_THRESHOLD_UPPER, &hi, sizeof(hi));
80+
}
81+
return VX_ERROR_NOT_SUPPORTED;
82+
}
83+
84+
// OpenVX 1.1 uses vxSetRemapPoint per pixel instead of vxCopyRemapPatch
85+
#define OPENVX_USE_SET_REMAP_POINT 1
86+
87+
#else
88+
#define OPENVX_USE_SET_REMAP_POINT 0
89+
#endif
90+
5291
#endif // OPENVX_VERSION_H

src/benchmarks/node_feature.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "benchmark_runner.h"
2828
#include "benchmark_config.h"
29+
#include "openvx_version.h"
2930
#include "verify_utils.h"
3031
#include <VX/vx.h>
3132
#include <VX/vxu.h>

src/benchmarks/node_geometric.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
////////////////////////////////////////////////////////////////////////////////
2626

2727
#include "benchmark_runner.h"
28+
#include "openvx_version.h"
2829
#include "verify_utils.h"
2930
#include <VX/vx.h>
3031
#include <VX/vx_nodes.h>
@@ -247,6 +248,11 @@ std::vector<BenchmarkCase> registerGeometricBenchmarks() {
247248
if (!in) return true;
248249
vx_image out = vxCreateImage(ctx, 64, 64, VX_DF_IMAGE_U8);
249250
vx_remap remap = vxCreateRemap(ctx, 64, 64, 64, 64);
251+
#if OPENVX_USE_SET_REMAP_POINT
252+
for (vx_uint32 y = 0; y < 64; y++)
253+
for (vx_uint32 x = 0; x < 64; x++)
254+
vxSetRemapPoint(remap, x, y, (vx_float32)x, (vx_float32)y);
255+
#else
250256
vx_rectangle_t rect = {0, 0, 64, 64};
251257
vx_size stride = 64 * sizeof(vx_coordinates2df_t);
252258
std::vector<vx_coordinates2df_t> coords(64 * 64);
@@ -257,6 +263,7 @@ std::vector<BenchmarkCase> registerGeometricBenchmarks() {
257263
}
258264
vxCopyRemapPatch(remap, &rect, stride, coords.data(),
259265
VX_TYPE_COORDINATES2DF, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST);
266+
#endif
260267
vx_status status = vxuRemap(ctx, in, remap, VX_INTERPOLATION_BILINEAR, out);
261268
if (status != VX_SUCCESS) {
262269
vxReleaseRemap(&remap);

0 commit comments

Comments
 (0)