Skip to content

Commit f53a77f

Browse files
authored
Updates to successful openvx conformance and added conformance test suite as submodule (#3)
* Passing all base openvx conformance tests * Adding openvx-cts test suite repo as submodule * Adding workflow to run openvx conformance tests in CI * Enabling the NN_16 conformance test
1 parent 4924adc commit f53a77f

File tree

8 files changed

+64
-11
lines changed

8 files changed

+64
-11
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ jobs:
3939
- name: OpenVX Integration Test
4040
run: VX_CL_SOURCE_DIR=$GITHUB_WORKSPACE/kernels/opencl bazel run //tests:vx_test
4141

42+
# Run OpenVX Conformance tests
43+
- name: OpenVX Conformance Tests
44+
run: ./test_vx_conformance.sh
45+
4246
# Test the project
4347
# - name: Run Bazel tests
4448
# run: |

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# vscode files
22
**/.vscode
33

4+
# dev container files
5+
**/.devcontainer/**
6+
47
# Prerequisites
58
*.d
69

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "cts"]
2+
path = cts
3+
url = https://github.com/amikhail48/OpenVX-cts.git

cts

Submodule cts added at a5d7b1f

framework/src/vx_context.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,11 @@ Context::~Context()
9393
vx_uint32 r;
9494
for (r = 0; r < VX_INT_MAX_REF; r++)
9595
{
96-
vx_reference ref = reftable[r];
97-
if (ref)
96+
if (reftable[r])
9897
{
9998
// VX_PRINT(VX_ZONE_INFO, "ref removed:\n");
10099
// Reference::printReference(ref); // For debugging
101-
delete reftable[r];
100+
// delete reftable[r];
102101
reftable[r] = nullptr;
103102
num_references--;
104103
}
@@ -358,11 +357,11 @@ vx_bool Context::removeReference(vx_reference& ref)
358357
if (reftable[r] &&
359358
reftable[r] == ref)
360359
{
361-
if (0u == ref->totalReferenceCount())
360+
// if (0u == ref->totalReferenceCount())
362361
{
363362
VX_PRINT(VX_ZONE_LOG, "Removing:\n");
364363
Reference::printReference(ref); // For debugging
365-
delete reftable[r];
364+
// delete reftable[r];
366365
reftable[r] = nullptr;
367366
}
368367
ref = nullptr;

framework/src/vx_debug.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616

1717
#include <VX/vx.h>
18-
#include <vx_debug.h>
18+
19+
#include "vx_debug.h"
20+
#include "vx_internal.h"
1921

2022
#include <cstdarg>
2123
#include <cstdio>
@@ -237,6 +239,8 @@ const char* ownGetObjectTypeName(vx_enum type) {
237239
name = "NODE"; break;
238240
case VX_TYPE_KERNEL:
239241
name = "KERNEL"; break;
242+
case VX_TYPE_TARGET:
243+
name = "TARGET"; break;
240244
case VX_TYPE_PARAMETER:
241245
name = "PARAMETER"; break;
242246
case VX_TYPE_DELAY:

kernels/c_model/c_khr_nn.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ void PoolingKernelImpl(
508508
if (!max_pooling)
509509
{
510510
//result = conversion_24_8(result / (int16_t)(size_x * size_y));
511-
result = static_cast<int_fast32_t>(CLAMP(result / static_cast<vx_int32>(size_x * size_y), getMinValue(fmt), getMaxValue(fmt)));
511+
result = static_cast<int32_t>(CLAMP(result / static_cast<int32_t>(size_x * size_y), getMinValue(fmt), getMaxValue(fmt)));
512512
}
513513

514514
const size_t output_byte_offset =
@@ -804,10 +804,10 @@ void ROIPoolingKernelImpl(
804804
const int dy_after = ((y + 1) * roi_h + (out_h - 1)) / out_h;
805805

806806
// clamp in case roi_x or roi_y were unreasonable
807-
const int x_begin = static_cast<int>(CLAMP(roi_x0 + dx_begin, 0, static_cast<int>(data_w)));
808-
const int y_begin = static_cast<int>(CLAMP(roi_y0 + dy_begin, 0, static_cast<int>(data_h)));
809-
const int x_after = static_cast<int>(CLAMP(roi_x0 + dx_after, 0, static_cast<int>(data_w)));
810-
const int y_after = static_cast<int>(CLAMP(roi_y0 + dy_after, 0, static_cast<int>(data_h)));
807+
const int x_begin = static_cast<int>(CLAMP(static_cast<size_t>(roi_x0 + dx_begin), 0, data_w));
808+
const int y_begin = static_cast<int>(CLAMP(static_cast<size_t>(roi_y0 + dy_begin), 0, data_h));
809+
const int x_after = static_cast<int>(CLAMP(static_cast<size_t>(roi_x0 + dx_after), 0, data_w));
810+
const int y_after = static_cast<int>(CLAMP(static_cast<size_t>(roi_y0 + dy_after), 0, data_h));
811811

812812
const char * data_b_ptr = (char*)in0_ptr + in0.strides[3] * b + in0.strides[2] * c;
813813

test_vx_conformance.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#! /bin/bash
2+
3+
mkdir -p cts/build
4+
5+
# Set the environment variables
6+
export OPENVX_DIR=$PWD
7+
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$OPENVX_DIR/bazel-bin:$OPENVX_DIR/bazel-bin/vxu:$OPENVX_DIR/bazel-bin/targets/c_model:$OPENVX_DIR/bazel-bin/targets/extras:$OPENVX_DIR/bazel-bin/targets/debug:$OPENVX_DIR/bazel-bin/targets/opencl:$OPENVX_DIR/cts/build/lib/
8+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPENVX_DIR/bazel-bin:$OPENVX_DIR/bazel-bin/vxu:$OPENVX_DIR/bazel-bin/targets/c_model:$OPENVX_DIR/bazel-bin/targets/extras:$OPENVX_DIR/bazel-bin/targets/debug:$OPENVX_DIR/bazel-bin/targets/opencl:$OPENVX_DIR/cts/build/lib/
9+
export VX_TEST_DATA_PATH=$HOME/Projects/OpenVX-sample-impl/cts/test_data/
10+
export VX_CL_SOURCE_DIR=$OPENVX_DIR/kernels/opencl/
11+
12+
# Build the conformance test suite
13+
cd cts/build
14+
cmake \
15+
-DCMAKE_BUILD_TYPE=Debug \
16+
-DOPENVX_INCLUDES=$OPENVX_DIR/include \
17+
-DOPENVX_LIBRARIES=$OPENVX_DIR/bazel-bin/libopenvx.dylib\;$OPENVX_DIR/bazel-bin/vxu/libvxu.dylib\;pthread\;dl\;m \
18+
-DOPENVX_USE_USER_DATA_OBJECT=ON \
19+
-DOPENVX_USE_IX=ON \
20+
-DOPENVX_USE_U1=ON \
21+
-DOPENVX_USE_NN=ON \
22+
-DOPENVX_USE_NN_16=ON \
23+
-DOPENVX_CONFORMANCE_NNEF_IMPORT=ON \
24+
-DOPENVX_CONFORMANCE_NEURAL_NETWORKS=ON \
25+
..
26+
27+
# -DOPENVX_CONFORMANCE_VISION=ON \
28+
# -DOPENVX_USE_ENHANCED_VISION=ON \
29+
# -DOPENVX_USE_PIPELINING=ON \
30+
# -DOPENVX_USE_STREAMING=ON \
31+
32+
cmake --build .
33+
34+
# Run the conformance test suite
35+
./bin/vx_test_conformance
36+
37+
# Clean up
38+
cd ../../
39+
rm -rf cts/build

0 commit comments

Comments
 (0)