CoreFlow 1.0.0
A modern orchestration and execution runtime
Loading...
Searching...
No Matches
coreflow::Kernel Class Reference

#include <vx_kernel.h>

Inheritance diagram for coreflow::Kernel:
coreflow::Reference

Classes

struct  Param
 The parameter of the kernel. More...
 

Public Member Functions

 Kernel (vx_context context, vx_reference scope)
 Construct a new Kernel object.
 
 Kernel (vx_context context, vx_enum kenum, vx_kernel_f function, vx_char name[VX_MAX_KERNEL_NAME], vx_param_description_t *parameters, vx_uint32 numParams, vx_reference scope)
 Construct a new Kernel object.
 
 ~Kernel ()=default
 Destroy the Kernel object.
 
vx_uint32 numParameters () const
 Get the number of kernel parameters.
 
const vx_charkernelName () const
 Get the kernel name.
 
vx_enum kernelEnum () const
 Get the kernel enuemration.
 
vx_size localDataSize () const
 Get the local data size.
 
vx_uint32 pipeupInputDepth () const
 Get the pipeup input depth.
 
vx_uint32 pipeupOutputDepth () const
 Get the pipeup output depth.
 
void setLocalDataSize (vx_size size)
 Set the local data size.
 
void setInputDepth (vx_uint32 depth)
 Set the pipeup input depth.
 
void setOutputDepth (vx_uint32 depth)
 Set the pipeup output depth.
 
vx_status initializeKernel (vx_enum kenum, vx_kernel_f function, vx_char name[VX_MAX_KERNEL_NAME], vx_param_description_t *parameters, vx_uint32 numParams, vx_kernel_validate_f validator, vx_kernel_input_validate_f input_validator, vx_kernel_output_validate_f output_validator, vx_kernel_initialize_f initialize, vx_kernel_deinitialize_f deinitialize)
 Used to initialize a kernel object in a target kernel list.
 
vx_status finalize ()
 This API is called after all parameters have been added to the kernel and the kernel is ready to be used. Notice that the reference to the kernel created by addKernel is still valid after the call to finalize. If an error occurs, the kernel is not available for usage by the clients of the framework. Typically this is due to a mismatch between the number of parameters requested and given.
 
vx_status addParameter (vx_uint32 index, vx_enum dir, vx_enum data_type, vx_enum state)
 Allows users to set the signatures of the custom kernel.
 
vx_status deinitializeKernel ()
 Used to deinitialize a kernel object in a target kernel list.
 
vx_uint32 refCount () const
 Returns the reference count of the object.
 
vx_enum dataType () const
 Returns the type of the reference.
 
const vx_charrefName () const
 Returns the name of the reference.
 
void setName (const vx_char *name)
 Sets the name of the reference.
 
vx_uint32 incrementReference (vx_reftype_e refType)
 Increments the ref count.
 
vx_uint32 decrementReference (vx_reftype_e refType)
 Decrements the ref count.
 
vx_uint32 totalReferenceCount ()
 Returns the total reference count of the object.
 
void initReferenceForDelay (vx_delay delay, vx_int32 index)
 Used to initialize any vx_reference as a delay element.
 
virtual void destruct ()
 Destruct reference.
 

Static Public Member Functions

static vx_kernel registerCustomKernel (vx_context context, std::string name, const std::vector< Kernel::Param > &params, vx_kernel_f function, vx_kernel_validate_f validate=nullptr, vx_kernel_initialize_f initialize=nullptr, vx_kernel_deinitialize_f deinitialize=nullptr)
 Register a custom kernel.
 
static vx_bool isKernelUnique (vx_kernel kernel)
 Determines if a kernel is unique in the system.
 
static vx_kernel addkernel (vx_context context, const vx_char name[VX_MAX_KERNEL_NAME], vx_enum enumeration, vx_kernel_f func_ptr, vx_uint32 numParams, vx_kernel_validate_f validate, vx_kernel_input_validate_f input, vx_kernel_output_validate_f output, vx_kernel_initialize_f initialize, vx_kernel_deinitialize_f deinitialize, vx_bool valid_rect_reset)
 Add Kernel.
 
static vx_status removeKernel (vx_kernel kernel)
 Removes a custom kernel from its context and releases it.
 
static vx_status loadKernels (vx_context context, const vx_char *name)
 Loads a library of kernels, called module, into the context.
 
static vx_status unloadKernels (vx_context context, const vx_char *name)
 Unloads all kernels from the context that had been loaded from the module using the loadKernels function.
 
static vx_kernel getKernelByName (vx_context context, const vx_char string[VX_MAX_KERNEL_NAME])
 Get the Kernel By Name.
 
static vx_kernel getKernelByEnum (vx_context context, vx_enum kernelenum)
 Get the Kernel By Enum.
 
static void printKernel (vx_kernel kernel)
 Print kernel object.
 
static vx_reference createReference (vx_context context, vx_enum type, vx_reftype_e refType, vx_reference scope)
 Used to create a reference.
 
static void printReference (vx_reference ref)
 Prints the values of a reference.
 
static vx_bool isValidReference (vx_reference ref)
 Used to validate everything but vx_context, vx_image and vx_buffer.
 
static vx_bool isValidReference (vx_reference ref, vx_enum type)
 Used to validate everything but vx_context, vx_image and vx_buffer.
 
static vx_size sizeOfType (vx_enum type)
 Returns the number of bytes in the internal structure for a given type.
 
static vx_status releaseReference (vx_reference *ref, vx_enum type, vx_reftype_e reftype, vx_destructor_f special_destructor)
 Used to destroy a reference.
 

Public Attributes

vx_char name [VX_MAX_KERNEL_NAME]
 The name of the kernel.
 
vx_enum enumeration
 The kernel enum ID.
 
vx_kernel_f function
 The kernel function pointer.
 
vx_signature_t signature
 The kernel signature.
 
vx_bool enabled
 Indicates that the kernel is not yet enabled.
 
vx_bool user_kernel
 Indicates that this kernel is added by user.
 
vx_kernel_validate_f validate
 The kernel validate function pointer.
 
vx_kernel_input_validate_f validate_input
 The kernel input validate function pointer.
 
vx_kernel_output_validate_f validate_output
 The kernel output validate function pointer.
 
vx_kernel_initialize_f initialize
 The kernel init function pointer.
 
vx_kernel_deinitialize_f deinitialize
 The kernel deinit function pointer.
 
vx_kernel_attr_t attributes
 The collection of attributes of a kernel.
 
vx_uint32 affinity
 Target Index, back reference for the later nodes to inherit affinity.
 
vx_kernel_object_deinitialize_f kernel_object_deinitialize
 The pointer to the kernel object deinitializer.
 
vx_uint32 input_depth
 The kernel's input depth required to start.
 
vx_uint32 output_depth
 The kernel's output depth required to start.
 
vx_uint32 pipeUpCounter
 Indicates whether kernel has piped up.
 
struct _vx_platform * platform
 Platform for ICD compatibility.
 
vx_uint32 magic
 Used to validate references, must be set to VX_MAGIC.
 
vx_enum type
 Set to an enum value in vx_type_e.
 
vx_context context
 Pointer to the top level context. If this reference is the context, this will be NULL.
 
vx_reference scope
 The pointer to the object's scope parent. When virtual objects are scoped within a graph, this will point to that parent graph. This is left generic to allow future scoping variations. By default scope should be the same as context.
 
vx_uint32 external_count
 The count of the number of users with this reference. When greater than 0, this can not be freed. When zero, the value can be considered inaccessible.
 
vx_uint32 internal_count
 The count of the number of framework references. When greater than 0, this can not be freed.
 
vx_uint32 read_count
 The number of times the object has been read (in some portion)
 
vx_uint32 write_count
 The number of times the object has been written to (in some portion)
 
vx_sem_t lock
 The reference lock which is used to protect access to "in-fly" data.
 
void * reserved
 A reserved field which can be used to store anonymous data.
 
vx_uint32 index
 A field which can be used to store a temporary, per-graph index.
 
vx_bool extracted
 This indicates if the object was extracted from another object.
 
vx_bool is_virtual
 This indicates if the object is virtual or not.
 
vx_delay delay
 
vx_int32 delay_slot_index
 
vx_bool is_accessible
 This indicates that if the object is virtual whether it is accessible at the moment or not.
 

Member Data Documentation

◆ affinity

vx_uint32 coreflow::Kernel::affinity

Target Index, back reference for the later nodes to inherit affinity.

◆ attributes

vx_kernel_attr_t coreflow::Kernel::attributes

The collection of attributes of a kernel.

◆ context

vx_context coreflow::Reference::context
inherited

Pointer to the top level context. If this reference is the context, this will be NULL.

◆ deinitialize

vx_kernel_deinitialize_f coreflow::Kernel::deinitialize

The kernel deinit function pointer.

◆ delay

vx_delay coreflow::Reference::delay
inherited

◆ delay_slot_index

vx_int32 coreflow::Reference::delay_slot_index
inherited

◆ enabled

vx_bool coreflow::Kernel::enabled

Indicates that the kernel is not yet enabled.

◆ enumeration

vx_enum coreflow::Kernel::enumeration

The kernel enum ID.

◆ external_count

vx_uint32 coreflow::Reference::external_count
inherited

The count of the number of users with this reference. When greater than 0, this can not be freed. When zero, the value can be considered inaccessible.

◆ extracted

vx_bool coreflow::Reference::extracted
inherited

This indicates if the object was extracted from another object.

◆ function

vx_kernel_f coreflow::Kernel::function

The kernel function pointer.

◆ index

vx_uint32 coreflow::Reference::index
inherited

A field which can be used to store a temporary, per-graph index.

◆ initialize

vx_kernel_initialize_f coreflow::Kernel::initialize

The kernel init function pointer.

◆ input_depth

vx_uint32 coreflow::Kernel::input_depth

The kernel's input depth required to start.

◆ internal_count

vx_uint32 coreflow::Reference::internal_count
inherited

The count of the number of framework references. When greater than 0, this can not be freed.

◆ is_accessible

vx_bool coreflow::Reference::is_accessible
inherited

This indicates that if the object is virtual whether it is accessible at the moment or not.

◆ is_virtual

vx_bool coreflow::Reference::is_virtual
inherited

This indicates if the object is virtual or not.

◆ kernel_object_deinitialize

vx_kernel_object_deinitialize_f coreflow::Kernel::kernel_object_deinitialize

The pointer to the kernel object deinitializer.

◆ lock

vx_sem_t coreflow::Reference::lock
inherited

The reference lock which is used to protect access to "in-fly" data.

◆ magic

vx_uint32 coreflow::Reference::magic
inherited

Used to validate references, must be set to VX_MAGIC.

◆ name

vx_char coreflow::Kernel::name[VX_MAX_KERNEL_NAME]

The name of the kernel.

◆ output_depth

vx_uint32 coreflow::Kernel::output_depth

The kernel's output depth required to start.

◆ pipeUpCounter

vx_uint32 coreflow::Kernel::pipeUpCounter

Indicates whether kernel has piped up.

◆ platform

struct _vx_platform* coreflow::Reference::platform
inherited

Platform for ICD compatibility.

◆ read_count

vx_uint32 coreflow::Reference::read_count
inherited

The number of times the object has been read (in some portion)

◆ reserved

void* coreflow::Reference::reserved
inherited

A reserved field which can be used to store anonymous data.

◆ scope

vx_reference coreflow::Reference::scope
inherited

The pointer to the object's scope parent. When virtual objects are scoped within a graph, this will point to that parent graph. This is left generic to allow future scoping variations. By default scope should be the same as context.

◆ signature

vx_signature_t coreflow::Kernel::signature

The kernel signature.

◆ type

vx_enum coreflow::Reference::type
inherited

Set to an enum value in vx_type_e.

◆ user_kernel

vx_bool coreflow::Kernel::user_kernel

Indicates that this kernel is added by user.

◆ validate

vx_kernel_validate_f coreflow::Kernel::validate

The kernel validate function pointer.

◆ validate_input

vx_kernel_input_validate_f coreflow::Kernel::validate_input

The kernel input validate function pointer.

◆ validate_output

vx_kernel_output_validate_f coreflow::Kernel::validate_output

The kernel output validate function pointer.

◆ write_count

vx_uint32 coreflow::Reference::write_count
inherited

The number of times the object has been written to (in some portion)