diff --git a/.bazelrc b/.bazelrc index bdb68ed2..d7bf00f2 100644 --- a/.bazelrc +++ b/.bazelrc @@ -11,7 +11,7 @@ build --experimental_ui_max_stdouterr_bytes=-1 # Test settings test --test_output=errors # Show errors from tests -test --test_env=PATH=/usr/local/bin:/usr/bin:/bin # Example of setting environment variables for tests +# test --test_env=PATH=/usr/local/bin:/usr/bin:/bin # Example of setting environment variables for tests # General settings build --jobs=4 # Use 4 parallel jobs for builds diff --git a/framework/include/vx_graph.h b/framework/include/vx_graph.h index 559045fd..d73e24aa 100644 --- a/framework/include/vx_graph.h +++ b/framework/include/vx_graph.h @@ -17,6 +17,7 @@ #define VX_GRAPH_H #include +#include #include "vx_internal.h" #include "vx_reference.h" @@ -171,6 +172,12 @@ class Graph : public Reference vx_status pipelineValidateRefsList( const vx_graph_parameter_queue_params_t graph_parameters_queue_param); + /** + * @brief Streaming loop function + * + */ + void streamingLoop(); + /** * @brief Destruct function for the Graph object * @ingroup group_int_graph @@ -207,9 +214,9 @@ class Graph : public Reference /*! \brief the max buffers that can be enqueued */ vx_uint32 numBufs; /*! \brief The internal data ref queue */ - ExecutionQueue queue; + ExecutionQueue queue; /*! \brief references that can be queued into data ref queue */ - vx_reference refs_list[VX_INT_MAX_QUEUE_DEPTH]; + vx_reference refs_list[VX_INT_MAX_PARAM_QUEUE_DEPTH]; #endif } parameters[VX_INT_MAX_PARAMS]; /*! \brief The number of graph parameters. */ @@ -228,6 +235,16 @@ class Graph : public Reference /*! \brief The number of times to schedule a graph */ vx_size scheduleCount; #endif +#ifdef OPENVX_USE_STREAMING + /*! \brief This indicates that the graph is streaming enabled */ + std::atomic isStreamingEnabled; + /*! \brief This indicates that the graph is currently streaming */ + std::atomic isStreaming; + /*! \brief The index of the trigger node */ + vx_uint32 triggerNodeIndex; + /*! \brief The thread used for streaming */ + vx_thread streamingThread; +#endif }; #endif /* VX_GRAPH_H */ diff --git a/framework/include/vx_internal.h b/framework/include/vx_internal.h index de10ed0e..3b7b81e9 100644 --- a/framework/include/vx_internal.h +++ b/framework/include/vx_internal.h @@ -329,6 +329,10 @@ typedef struct vx_sem_t */ typedef sem_t vx_sem_t; #endif +/*! \brief A C++ STL thread + * \ingroup group_int_osal + */ +typedef std::thread vx_thread; /*! \brief A POSIX thread * \ingroup group_int_osal */ diff --git a/framework/include/vx_kernel.h b/framework/include/vx_kernel.h index f0679bfc..343ffd4d 100644 --- a/framework/include/vx_kernel.h +++ b/framework/include/vx_kernel.h @@ -142,27 +142,27 @@ class Kernel : public Reference */ static void printKernel(vx_kernel kernel); - /*! \brief */ + /*! \brief The name of the kernel */ vx_char name[VX_MAX_KERNEL_NAME]; - /*! \brief */ + /*! \brief The kernel enum ID */ vx_enum enumeration; - /*! \brief */ + /*! \brief The kernel function pointer */ vx_kernel_f function; - /*! \brief */ + /*! \brief The kernel signature */ vx_signature_t signature; - /*! Indicates that the kernel is not yet enabled. */ + /*! \brief Indicates that the kernel is not yet enabled. */ vx_bool enabled; - /*! Indicates that this kernel is added by user. */ + /*! \brief Indicates that this kernel is added by user. */ vx_bool user_kernel; - /*! \brief */ + /*! \brief The kernel validate function pointer */ vx_kernel_validate_f validate; - /*! \brief */ + /*! \brief The kernel input validate function pointer */ vx_kernel_input_validate_f validate_input; - /*! \brief */ + /*! \brief The kernel output validate function pointer */ vx_kernel_output_validate_f validate_output; - /*! \brief */ + /*! \brief The kernel init function pointer */ vx_kernel_initialize_f initialize; - /*! \brief */ + /*! \brief The kernel deinit function pointer */ vx_kernel_deinitialize_f deinitialize; /*! \brief The collection of attributes of a kernel */ vx_kernel_attr_t attributes; @@ -172,9 +172,15 @@ class Kernel : public Reference /*! \brief The tiling function pointer interface */ vx_tiling_kernel_f tilingfast_function; vx_tiling_kernel_f tilingflexible_function; -#endif +#endif /* OPENVX_KHR_TILING */ /*! \brief The pointer to the kernel object deinitializer. */ vx_kernel_object_deinitialize_f kernel_object_deinitialize; + /*! \brief The kernel's input depth required to start */ + vx_uint32 input_depth; + /*! \brief The kernel's output depth required to start */ + vx_uint32 output_depth; + /*! \brief Indicates whether kernel has piped up */ + vx_uint32 pipeUpCounter; }; #endif /* VX_KERNEL_H */ diff --git a/framework/include/vx_node.h b/framework/include/vx_node.h index 79c94349..22980fa6 100644 --- a/framework/include/vx_node.h +++ b/framework/include/vx_node.h @@ -17,6 +17,7 @@ #define VX_NODE_H #include +#include /*! * \file @@ -132,6 +133,8 @@ class Node : public Reference vx_bool is_replicated; /*! \brief The replicated parameters flags */ vx_bool replicated_flags[VX_INT_MAX_PARAMS]; + /*! \brief The node state */ + vx_node_state_e state; }; #endif /* VX_NODE_H */ diff --git a/framework/src/vx_graph.cpp b/framework/src/vx_graph.cpp index bb5187fb..6a386a61 100644 --- a/framework/src/vx_graph.cpp +++ b/framework/src/vx_graph.cpp @@ -230,21 +230,33 @@ void vxContaminateGraphs(vx_reference ref) /* INTERNAL FUNCTIONS */ /******************************************************************************/ -Graph::Graph(vx_context context, vx_reference scope) : Reference(context, VX_TYPE_GRAPH, scope), -nodes(), -perf(), -numNodes(0), -heads(), -numHeads(0), -state(VX_FAILURE), -verified(vx_false_e), -reverify(vx_false_e), -lock(), -parameters(), -numParams(0), -shouldSerialize(vx_false_e), -parentGraph(nullptr), -delays() +Graph::Graph(vx_context context, vx_reference scope) + : Reference(context, VX_TYPE_GRAPH, scope), + nodes(), + perf(), + numNodes(0), + heads(), + numHeads(0), + state(VX_FAILURE), + verified(vx_false_e), + reverify(vx_false_e), + lock(), + parameters(), + numParams(0), + shouldSerialize(vx_false_e), + parentGraph(nullptr), + delays(), + scheduleMode(VX_GRAPH_SCHEDULE_MODE_NORMAL), +#ifdef OPENVX_USE_PIPELINING + numEnqueableParams(0), + scheduleCount(0), +#endif /* OPENVX_USE_PIPELINING */ +#ifdef OPENVX_USE_STREAMING + isStreamingEnabled(vx_false_e), + isStreaming(vx_false_e), + triggerNodeIndex(0), + streamingThread() +#endif /* OPENVX_USE_STREAMING */ { } @@ -1723,6 +1735,35 @@ vx_status Graph::pipelineValidateRefsList( return status; } +void Graph::streamingLoop() +{ +#ifdef OPENVX_USE_STREAMING + while (isStreaming) + { + /* Wait for trigger node event if set */ + // if (triggerNodeIndex != UINT32_MAX) + // { + // /* Wait for the trigger node to complete */ + // while (!nodes[triggerNodeIndex]->executed) + // { + // std::cout << "Waiting for trigger node to complete" << std::endl; + // std::this_thread::sleep_for(std::chrono::milliseconds(1)); + // /* Allow clean exit */ + // if (!isStreaming) return; + // } + // /* Reset the event for the next iteration */ + // nodes[triggerNodeIndex]->executed = vx_false_e; + // } + + /* Schedule and wait for the graph */ + vx_status status = vxScheduleGraph(this); + if (status != VX_SUCCESS) break; + status = vxWaitGraph(this); + if (status != VX_SUCCESS) break; + } +#endif /* OPENVX_USE_STREAMING */ +} + void Graph::destruct() { while (numNodes) @@ -2068,7 +2109,8 @@ VX_API_ENTRY vx_status VX_API_CALL vxVerifyGraph(vx_graph graph) { if (((graph->nodes[n]->kernel->signature.directions[p] == VX_BIDIRECTIONAL) || (graph->nodes[n]->kernel->signature.directions[p] == VX_INPUT)) && - (graph->nodes[n]->parameters[p] != nullptr)) + (graph->nodes[n]->parameters[p] != nullptr) && + (graph->nodes[n]->kernel->validate_input != nullptr)) { vx_status input_validation_status = graph->nodes[n]->kernel->validate_input((vx_node)graph->nodes[n], p); if (input_validation_status != VX_SUCCESS) @@ -2100,25 +2142,30 @@ VX_API_ENTRY vx_status VX_API_CALL vxVerifyGraph(vx_graph graph) if (graph->setupOutput(n, p, &vref, &metas[p], &status, &num_errors) == vx_false_e) break; - output_validation_status = graph->nodes[n]->kernel->validate_output( - (vx_node)graph->nodes[n], p, metas[p]); - if (output_validation_status == VX_SUCCESS) + if (graph->nodes[n]->kernel->validate_output != nullptr) { - if (graph->postprocessOutput(n, p, &vref, metas[p], &status, - &num_errors) == vx_false_e) + output_validation_status = graph->nodes[n]->kernel->validate_output( + (vx_node)graph->nodes[n], p, metas[p]); + if (output_validation_status == VX_SUCCESS) { - break; + if (graph->postprocessOutput(n, p, &vref, metas[p], &status, + &num_errors) == vx_false_e) + { + break; + } + } + else + { + status = output_validation_status; + vxAddLogEntry(reinterpret_cast(graph), status, + "Node %s: parameter[%u] failed output validation! " + "(status = %d)\n", + graph->nodes[n]->kernel->name, p, status); + VX_PRINT(VX_ZONE_ERROR, + "Failed on validation of output parameter[%u] on kernel " + "%s, status=%d\n", + p, graph->nodes[n]->kernel->name, status); } - } - else - { - status = output_validation_status; - vxAddLogEntry(reinterpret_cast(graph), status, "Node %s: parameter[%u] failed output validation! (status = %d)\n", - graph->nodes[n]->kernel->name, p, status); - VX_PRINT(VX_ZONE_ERROR,"Failed on validation of output parameter[%u] on kernel %s, status=%d\n", - p, - graph->nodes[n]->kernel->name, - status); } } } @@ -2511,6 +2558,7 @@ static vx_status vxExecuteGraph(vx_graph graph, vx_uint32 depth) vx_uint32 next_nodes[VX_INT_MAX_REF]; vx_uint32 left_nodes[VX_INT_MAX_REF]; vx_context context = vxGetContext((vx_reference)graph); + vx_uint32 max_pipeup_depth = 1; (void)depth; #if defined(OPENVX_USE_SMP) @@ -2640,6 +2688,34 @@ static vx_status vxExecuteGraph(vx_graph graph, vx_uint32 depth) next_nodes[n], target->name, node->kernel->name); + /* Check for pipeup phase: + * If this is the first time we are executing the graph, we need to pipeup + * all nodes with kernels in the graph that need pipeup of refs. + */ + max_pipeup_depth = std::max( + {max_pipeup_depth, node->kernel->input_depth, node->kernel->output_depth}); + if (node->kernel->pipeUpCounter < max_pipeup_depth - 1) + { + node->state = VX_NODE_STATE_PIPEUP; + std::cout << "max_pipeup_depth: " << max_pipeup_depth << std::endl; + node->kernel->pipeUpCounter++; + // Retain input buffers during PIPEUP + for (vx_uint32 i = 0; i < node->kernel->output_depth - 1; i++) + { + action = target->funcs.process(target, &node, 0, 1); + node->kernel->pipeUpCounter++; + } + // For source nodes, provide new output buffers during PIPEUP + for (vx_uint32 i = 0; i < node->kernel->input_depth - 1; i++) + { + action = target->funcs.process(target, &node, 0, 1); + node->kernel->pipeUpCounter++; + } + } + + /* If this node was in pipeup, update its state */ + node->state = VX_NODE_STATE_STEADY; + action = target->funcs.process(target, &node, 0, 1); VX_PRINT(VX_ZONE_GRAPH, "Returned Node[%u] %s:%s Action %d\n", diff --git a/framework/src/vx_graph_stream.cpp b/framework/src/vx_graph_stream.cpp index b80a1378..5cf3eff6 100644 --- a/framework/src/vx_graph_stream.cpp +++ b/framework/src/vx_graph_stream.cpp @@ -13,29 +13,146 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#ifdef OPENVX_USE_STREAMING - #include -#include #include +#include #include "vx_internal.h" +#ifdef OPENVX_USE_STREAMING + VX_API_ENTRY vx_status VX_API_CALL vxEnableGraphStreaming(vx_graph graph, vx_node trigger_node) { - return VX_ERROR_NOT_IMPLEMENTED; + vx_status status = VX_SUCCESS; + vx_bool triggerNodeSet = vx_false_e; + + if (vx_false_e == Reference::isValidReference(graph, VX_TYPE_GRAPH)) + { + VX_PRINT(VX_ZONE_ERROR, "invalid graph reference\n"); + status = VX_ERROR_INVALID_REFERENCE; + } + + if (VX_SUCCESS == status) + { + graph->isStreamingEnabled = vx_true_e; + + if (vx_true_e == Reference::isValidReference(trigger_node, VX_TYPE_NODE)) + { + for (vx_uint32 i = 0; i < graph->numNodes; i++) + { + if (graph->nodes[i] == trigger_node) + { + graph->triggerNodeIndex = i; + triggerNodeSet = vx_true_e; + break; + } + } + + if (vx_false_e == triggerNodeSet) + { + VX_PRINT(VX_ZONE_ERROR, "trigger_node does not belong to graph\n"); + status = VX_ERROR_INVALID_PARAMETERS; + } + } + } + + return status; } VX_API_ENTRY vx_status VX_API_CALL vxStartGraphStreaming(vx_graph graph) { - return VX_ERROR_NOT_IMPLEMENTED; + vx_status status = VX_SUCCESS; + + if (vx_false_e == Reference::isValidReference(graph, VX_TYPE_GRAPH)) + { + VX_PRINT(VX_ZONE_ERROR, "invalid graph reference\n"); + status = VX_ERROR_INVALID_REFERENCE; + } + + if (VX_SUCCESS == status) + { + if (vx_true_e != graph->isStreamingEnabled) + { + VX_PRINT(VX_ZONE_ERROR, + "streaming has not been enabled. Please enable streaming prior to verifying " + "graph\n"); + status = VX_ERROR_INVALID_PARAMETERS; + } + } + + if (VX_SUCCESS == status) + { + if (vx_false_e == graph->isStreaming) + { + graph->isStreaming = vx_true_e; + graph->streamingThread = std::thread([graph]() { graph->streamingLoop(); }); + VX_PRINT(VX_ZONE_INFO, "Graph streaming thread started\n"); + } + else + { + VX_PRINT(VX_ZONE_WARNING, "this graph is currently already streaming\n"); + } + } + + return status; } VX_API_ENTRY vx_status VX_API_CALL vxStopGraphStreaming(vx_graph graph) { - return VX_ERROR_NOT_IMPLEMENTED; + vx_status status = VX_SUCCESS; + + if (vx_false_e == Reference::isValidReference(graph, VX_TYPE_GRAPH)) + { + VX_PRINT(VX_ZONE_ERROR, "invalid graph reference\n"); + status = VX_ERROR_INVALID_REFERENCE; + } + + if (VX_SUCCESS == status) + { + if (vx_true_e != graph->isStreaming) + { + VX_PRINT(VX_ZONE_ERROR, "Streaming has not been started\n"); + status = VX_ERROR_INVALID_PARAMETERS; + } + } + + if (VX_SUCCESS == status) + { + // First set streaming to false to stop the loop + graph->isStreaming = vx_false_e; + + // Wait up to 5 seconds for the thread to finish + std::this_thread::sleep_for(std::chrono::seconds(5)); + + // Wait for any pending graph executions to complete + vxWaitGraph(graph); + + // Wait and join streaming thread with a timeout + if (graph->streamingThread.joinable()) + { + // If thread is still running, force join + graph->streamingThread.join(); + + VX_PRINT(VX_ZONE_INFO, "Graph streaming joined\n"); + } + + // Reset streaming state + graph->isStreamingEnabled = vx_false_e; + graph->triggerNodeIndex = UINT32_MAX; + + // Reset node states + for (vx_uint32 i = 0; i < graph->numNodes; i++) + { + if (graph->nodes[i] != nullptr) + { + graph->nodes[i]->state = VX_NODE_STATE_STEADY; + graph->nodes[i]->executed = vx_false_e; + } + } + } + + return status; } #endif /* OPENVX_USE_STREAMING */ diff --git a/framework/src/vx_kernel.cpp b/framework/src/vx_kernel.cpp index d0552fbe..5a35cd49 100644 --- a/framework/src/vx_kernel.cpp +++ b/framework/src/vx_kernel.cpp @@ -20,21 +20,29 @@ /******************************************************************************/ /* INTERNAL INTERFACE */ /******************************************************************************/ -Kernel::Kernel(vx_context context, vx_reference scope) : Reference(context, VX_TYPE_KERNEL, scope), -name(""), -enumeration(VX_ERROR_NOT_SUPPORTED), -function(nullptr), -signature(), -enabled(vx_false_e), -user_kernel(vx_false_e), -validate(nullptr), -validate_input(nullptr), -validate_output(nullptr), -initialize(nullptr), -deinitialize(nullptr), -attributes(), -affinity(0), -kernel_object_deinitialize(nullptr) +Kernel::Kernel(vx_context context, vx_reference scope) + : Reference(context, VX_TYPE_KERNEL, scope), + name(""), + enumeration(VX_ERROR_NOT_SUPPORTED), + function(nullptr), + signature(), + enabled(vx_false_e), + user_kernel(vx_false_e), + validate(nullptr), + validate_input(nullptr), + validate_output(nullptr), + initialize(nullptr), + deinitialize(nullptr), + attributes(), + affinity(0), +#ifdef OPENVX_KHR_TILING + tilingfast_function(nullptr), + tilingflexible_function(nullptr), +#endif /* OPENVX_KHR_TILING */ + kernel_object_deinitialize(nullptr), + input_depth(1u), + output_depth(1u), + pipeUpCounter(0) { } @@ -202,13 +210,12 @@ vx_kernel Kernel::addkernel(vx_context context, } if (func_ptr == nullptr || - ((validate == nullptr) && - (input == nullptr || - output == nullptr)) || - numParams > VX_INT_MAX_PARAMS || numParams == 0 || - name == nullptr || - strncmp(name, "", VX_MAX_KERNEL_NAME) == 0) - /* initialize and de-initialize can be nullptr */ +#ifndef OPENVX_USE_STREAMING + ((validate == nullptr) && (input == nullptr || output == nullptr)) || +#endif + numParams > VX_INT_MAX_PARAMS || numParams == 0 || name == nullptr || + strncmp(name, "", VX_MAX_KERNEL_NAME) == 0) + /* initialize and de-initialize can be nullptr */ { VX_PRINT(VX_ZONE_ERROR, "Invalid Parameters!\n"); vxAddLogEntry((vx_reference)context, VX_ERROR_INVALID_PARAMETERS, "Invalid Parameters supplied to vxAddKernel or vxAddUserKernel\n"); @@ -721,7 +728,8 @@ VX_API_ENTRY vx_status VX_API_CALL vxFinalizeKernel(vx_kernel kernel) VX_API_ENTRY vx_status VX_API_CALL vxQueryKernel(vx_kernel kernel, vx_enum attribute, void *ptr, vx_size size) { vx_status status = VX_SUCCESS; - if (kernel && Reference::isValidReference(reinterpret_cast(kernel), VX_TYPE_KERNEL) == vx_true_e) + if (ptr && Reference::isValidReference(reinterpret_cast(kernel), + VX_TYPE_KERNEL) == vx_true_e) { switch (attribute) { @@ -806,6 +814,26 @@ VX_API_ENTRY vx_status VX_API_CALL vxQueryKernel(vx_kernel kernel, vx_enum attri } break; #endif /* OPENVX_USE_OPENCL_INTEROP */ + case VX_KERNEL_PIPEUP_INPUT_DEPTH: + if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3) && *(vx_uint32 *)ptr > 0) + { + *(vx_uint32 *)ptr = kernel->input_depth; + } + else + { + status = VX_ERROR_INVALID_PARAMETERS; + } + break; + case VX_KERNEL_PIPEUP_OUTPUT_DEPTH: + if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3) && *(vx_uint32 *)ptr > 0) + { + *(vx_uint32 *)ptr = kernel->output_depth; + } + else + { + status = VX_ERROR_INVALID_PARAMETERS; + } + break; default: status = VX_ERROR_NOT_SUPPORTED; break; @@ -1052,6 +1080,26 @@ VX_API_ENTRY vx_status VX_API_CALL vxSetKernelAttribute(vx_kernel kernel, vx_enu } break; #endif /* OPENVX_USE_OPENCL_INTEROP */ + case VX_KERNEL_PIPEUP_INPUT_DEPTH: + if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) + { + kernel->input_depth = *(vx_uint32 *)ptr; + } + else + { + status = VX_ERROR_INVALID_VALUE; + } + break; + case VX_KERNEL_PIPEUP_OUTPUT_DEPTH: + if (VX_CHECK_PARAM(ptr, size, vx_uint32, 0x3)) + { + kernel->output_depth = *(vx_uint32 *)ptr; + } + else + { + status = VX_ERROR_INVALID_VALUE; + } + break; default: status = VX_ERROR_NOT_SUPPORTED; break; diff --git a/framework/src/vx_node.cpp b/framework/src/vx_node.cpp index 7c0857a5..83278598 100644 --- a/framework/src/vx_node.cpp +++ b/framework/src/vx_node.cpp @@ -21,23 +21,25 @@ /******************************************************************************/ /* INTERNAL INTERFACE */ /******************************************************************************/ -Node::Node(vx_context context, vx_reference scope) : Reference(context, VX_TYPE_NODE, scope), -kernel(nullptr), -parameters(), -status(VX_FAILURE), -perf(), -callback(nullptr), -local_data_change_is_enabled(vx_false_e), -local_data_set_by_implementation(vx_false_e), -graph(nullptr), -visited(vx_false_e), -executed(vx_false_e), -attributes(), -affinity(0), -child(nullptr), -costs(), -is_replicated(vx_false_e), -replicated_flags() +Node::Node(vx_context context, vx_reference scope) + : Reference(context, VX_TYPE_NODE, scope), + kernel(nullptr), + parameters(), + status(VX_FAILURE), + perf(), + callback(nullptr), + local_data_change_is_enabled(vx_false_e), + local_data_set_by_implementation(vx_false_e), + graph(nullptr), + visited(vx_false_e), + executed(vx_false_e), + attributes(), + affinity(0), + child(nullptr), + costs(), + is_replicated(vx_false_e), + replicated_flags(), + state(VX_NODE_STATE_STEADY) { } @@ -382,7 +384,7 @@ VX_API_ENTRY vx_status VX_API_CALL vxQueryNode(vx_node node, vx_enum attribute, status = VX_ERROR_INVALID_PARAMETERS; } break; -#endif +#endif /* OPENVX_KHR_NODE_MEMORY */ case VX_NODE_BORDER: if (VX_CHECK_PARAM(ptr, size, vx_border_t, 0x3)) { @@ -464,6 +466,16 @@ VX_API_ENTRY vx_status VX_API_CALL vxQueryNode(vx_node node, vx_enum attribute, } break; #endif + case VX_NODE_STATE: + if (VX_CHECK_PARAM(ptr, size, vx_enum, 0x3)) + { + *(vx_enum *)ptr = node->state; + } + else + { + status = VX_ERROR_INVALID_PARAMETERS; + } + break; default: status = VX_ERROR_NOT_SUPPORTED; break; diff --git a/include/VX/vx_corevx_ext.h b/include/VX/vx_corevx_ext.h index 30926449..7e0dee01 100644 --- a/include/VX/vx_corevx_ext.h +++ b/include/VX/vx_corevx_ext.h @@ -111,6 +111,9 @@ VX_API_ENTRY vx_status VX_API_CALL vxSetObjectArrayItem(vx_object_array arr, vx_ */ VX_API_ENTRY vx_status VX_API_CALL vxImportGraphFromDot(vx_graph graph, vx_char dotfile[], vx_bool acceptData); +/* COREVX Internal Macros */ +#define VX_INT_MAX_PARAM_QUEUE_DEPTH 10 + /* ENABLED FEATURES IN COREVX ONLY */ #define OPENVX_USE_USER_DATA_OBJECT 1 #define OPENVX_USE_IX 1 @@ -119,7 +122,8 @@ VX_API_ENTRY vx_status VX_API_CALL vxImportGraphFromDot(vx_graph graph, vx_char #define OPENVX_USE_OPENCL_INTEROP 1 #define OPENVX_USE_NN 1 #define OPENVX_USE_NN_16 1 -// #define OPENVX_USE_PIPELINING 1 +#define OPENVX_USE_PIPELINING 1 +#define OPENVX_USE_STREAMING 1 #if defined(__arm__) || defined(__arm64__) #define OPENVX_USE_TILING 1 diff --git a/include/VX/vx_khr_pipelining.h b/include/VX/vx_khr_pipelining.h index 417aa90f..586c5065 100644 --- a/include/VX/vx_khr_pipelining.h +++ b/include/VX/vx_khr_pipelining.h @@ -494,7 +494,7 @@ typedef struct _vx_event { VX_API_ENTRY vx_status VX_API_CALL vxWaitEvent(vx_context context, vx_event_t *event, vx_bool do_not_block); /*! \brief Enable event generation - * + * * Depending on the implementation, events may be either enabled or disabled by default. * * \param context [in] OpenVX context @@ -593,46 +593,48 @@ enum vx_node_state_e { /*! \brief The node attributes added by this extension. * \ingroup group_streaming */ -enum vx_node_attribute_streaming_e { +enum vx_node_attribute_streaming_e +{ /*! \brief Queries the state of the node. Read-only. See \ref vx_graph_state_e enum. */ - VX_NODE_STATE = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_NODE) + 0x9, + VX_NODE_STATE = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_NODE) + 0xA, }; /*! \brief The kernel attributes added by this extension. * \ingroup group_streaming */ -enum vx_kernel_attribute_streaming_e { +enum vx_kernel_attribute_streaming_e +{ /*! \brief The pipeup output depth required by the kernel. * This is called by kernels that need to be primed with multiple output buffers before it can - * begin to return them. A typical use case for this is a source node which needs to provide and - * retain multiple empty buffers to a camera driver to fill. The first time the graph is executed - * after vxVerifyGraph is called, the framework calls the node associated with this kernel - * (pipeup_output_depth - 1) times before 'expecting' a valid output and calling downstream nodes. - * During this PIPEUP state, the framework provides the same set of input parameters for each - * call, but provides different set of output parameters for each call. During the STEADY state, - * the kernel may return a different set of output parameters than was given during the execution callback. - * Read-write. Can be written only before user-kernel finalization. - * Use a \ref vx_uint32 parameter. + * begin to return them. A typical use case for this is a source node which needs to provide + * and retain multiple empty buffers to a camera driver to fill. The first time the graph is + * executed after vxVerifyGraph is called, the framework calls the node associated with this + * kernel (pipeup_output_depth - 1) times before 'expecting' a valid output and calling + * downstream nodes. During this PIPEUP state, the framework provides the same set of input + * parameters for each call, but provides different set of output parameters for each call. + * During the STEADY state, the kernel may return a different set of output parameters than was + * given during the execution callback. Read-write. Can be written only before user-kernel + * finalization. Use a \ref vx_uint32 parameter. * \note If not set, it will default to 1. * \note Setting a value less than 1 shall return VX_ERROR_INVALID_PARAMETERS */ - VX_KERNEL_PIPEUP_OUTPUT_DEPTH = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_KERNEL) + 0x4, + VX_KERNEL_PIPEUP_OUTPUT_DEPTH = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_KERNEL) + 0x5, /*! \brief The pipeup input depth required by the kernel. * This is called by kernels that need to retain one or more input buffers before it can * begin to return them. A typical use case for this is a sink node which needs to provide and - * retain one or more filled buffers to a display driver to display. The first (pipeup_input_depth - 1) - * times the graph is executed after vxVerifyGraph is called, the framework calls the node associated with this kernel - * without 'expecting' an input to have been consumed and returned by the node. - * During this PIPEUP state, the framework does not reuse any of the input bufers it had given to this node. - * During the STEADY state, the kernel may return a different set of input parameters than was given during - * the execution callback. + * retain one or more filled buffers to a display driver to display. The first + * (pipeup_input_depth - 1) times the graph is executed after vxVerifyGraph is called, the + * framework calls the node associated with this kernel without 'expecting' an input to have + * been consumed and returned by the node. During this PIPEUP state, the framework does not + * reuse any of the input bufers it had given to this node. During the STEADY state, the kernel + * may return a different set of input parameters than was given during the execution callback. * Read-write. Can be written only before user-kernel finalization. * Use a \ref vx_uint32 parameter. * \note If not set, it will default to 1. * \note Setting a value less than 1 shall return VX_ERROR_INVALID_PARAMETERS */ - VX_KERNEL_PIPEUP_INPUT_DEPTH = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_KERNEL) + 0x5, + VX_KERNEL_PIPEUP_INPUT_DEPTH = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_KERNEL) + 0x6, }; /*! \brief Enable streaming mode of graph execution diff --git a/test_vx_conformance.sh b/test_vx_conformance.sh index def1966b..7ad2de3d 100755 --- a/test_vx_conformance.sh +++ b/test_vx_conformance.sh @@ -38,12 +38,12 @@ cmake \ -DOPENVX_USE_NN_16=ON \ -DOPENVX_CONFORMANCE_NNEF_IMPORT=ON \ -DOPENVX_CONFORMANCE_NEURAL_NETWORKS=ON \ +-DOPENVX_USE_PIPELINING=ON \ +-DOPENVX_USE_STREAMING=ON \ .. -# -DOPENVX_USE_PIPELINING=ON \ # -DOPENVX_CONFORMANCE_VISION=ON \ # -DOPENVX_USE_ENHANCED_VISION=ON \ -# -DOPENVX_USE_STREAMING=ON \ cmake --build .