Add output verification for conformance gating #21
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| mkdir -p stubs | |
| cat > stubs/app_mem_map.h << 'STUB_EOF' | |
| #ifndef APP_MEM_MAP_H | |
| #define APP_MEM_MAP_H | |
| #endif | |
| STUB_EOF | |
| mkdir -p stubs/utils/perf_stats/include | |
| 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 | |
| cat > stubs/app_mem.h << 'STUB_EOF' | |
| #ifndef APP_MEM_H | |
| #define APP_MEM_H | |
| #include <stdlib.h> | |
| static inline void *appMemAlloc(unsigned int heap_id, unsigned int size, unsigned int align) { | |
| (void)heap_id; (void)align; | |
| return malloc(size); | |
| } | |
| static inline int appMemFree(unsigned int heap_id, void *ptr, unsigned int size) { | |
| (void)heap_id; (void)size; | |
| free(ptr); | |
| return 0; | |
| } | |
| #endif | |
| STUB_EOF | |
| 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 |