-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graph events multi enqueue #15
base: main
Are you sure you want to change the base?
Graph events multi enqueue #15
Conversation
Signed-off-by: Cano Raphael(XC-AS/EPO3) <Raphael.Cano2@de.bosch.com>
cec56c6
to
4986eeb
Compare
Signed-off-by: Cano Raphael(XC-AS/EPO3) <Raphael.Cano2@de.bosch.com>
@@ -168,6 +170,26 @@ static vx_status ownGraphPipelineValidateRefsList( | |||
return status; | |||
} | |||
|
|||
static vx_status ownDecrementEnqueueCount(vx_reference ref) | |||
{ | |||
ref->obj_desc->flags &= ~TIVX_OBJ_DESC_DATA_REF_GRAPH_PARAM_ENQUEUED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a check if ref is NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This internal function is used in the block from line 551 to 658. Every time we call this function, the ref is previously checked with ownIsValidSpecificReference (lines 581 & 587) and the ref_list is also checked at line 597
So if I add a check in the function to test if this can be NULL, I am afraid it will be difficult to do a test to achieve the branch testing.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it would be unlikely to reach via a test - in that case, would you mind adding a comment stating that the reference has previously been checked for NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can put a comment or add the condition check and later we put a deviation for the coverage? What do you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment will be sufficient, thanks
vx_status status; | ||
vx_context context = context_->vx_context_; | ||
|
||
vx_graph graph1 = vxCreateGraph(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use the ASSERT_VX_OBJECT macro for the vxCreate instances in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
include/TI/tivx.h
Outdated
TIVX_REFERENCE_BUFFER_IS_ALLOCATED = VX_ATTRIBUTE_BASE(VX_ID_TI, (vx_enum)VX_TYPE_REFERENCE) + 0x2, | ||
|
||
/*! \brief Used to query the reference for the current enqueue count. Read-write. Use a <tt>\ref vx_uint32</tt> parameter. */ | ||
TIVX_REFERENCE_ENQUEUE_COUNT = VX_ATTRIBUTE_BASE(VX_ID_TI, (vx_enum)VX_TYPE_REFERENCE) + 0x3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Pipelining Extension says that this is added to main spec, except without the TI prefix. If there is not a plan to add to main header files, then perhaps we add it as a constant to the Pipelining extension since it is paired with that ... or at least change the name here to remove the TI prefix since it is specified in the pipelineing extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you want to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line from tivx.h, and update the pipelining extension header file in this patch to match the latest one from gitlab, it has it defined there as of today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, updated with the latest pipelining header
include/VX/vx_khr_pipelining.h
Outdated
* Notice that there is only one app_value per graph parameter. | ||
* | ||
*/ | ||
VX_API_ENTRY vx_status VX_API_CALL vxRegisterGraphEvent(vx_graph graph, enum vx_event_type_e type, vx_uint32 param, vx_uint32 app_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API here should take a vx_reference as first parameter, which is called graph_or_node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, code and test modified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec says that VX_EVENT_GRAPH_COMPLETED, VX_EVENT_NODE_COMPLETED, and VX_EVENT_NODE_ERROR should also be supported by this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
header updated
include/VX/vx_khr_pipelining.h
Outdated
* | ||
* \ingroup group_event | ||
*/ | ||
VX_API_ENTRY vx_status VX_API_CALL vxSendUserGraphEvent(vx_graph graph, vx_uint32 app_value, const void *parameter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that this header file has both send user events with the last argument as a const qualified pointer, but the spec does not say that. I need to thing more ... should be be const or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question, the "const" says the value it points to is an input parameter (read only). Not sure if this is important for the user of the function as this is specified by the interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new header does not have the const anymore, discussion can be closed?
…h consumers Signed-off-by: Cano Raphael(XC-AS/EPO3) <Raphael.Cano2@de.bosch.com>
Signed-off-by: Cano Raphael(XC-AS/EPO3) <Raphael.Cano2@de.bosch.com>
Signed-off-by: Cano Raphael(XC-AS/EPO3) <Raphael.Cano2@de.bosch.com>
…PI spec, adapt tests to cover all cases Signed-off-by: Cano Raphael(XC-AS/EPO3) <Raphael.Cano2@de.bosch.com>
Signed-off-by: Cano Raphael(XC-AS/EPO3) <Raphael.Cano2@de.bosch.com>
|
||
ASSERT_EQ_VX_STATUS(VX_SUCCESS, vxGraphParameterEnqueueReadyRef(graph1, 0, (vx_reference *)&images[0], 1)); | ||
ASSERT_EQ_VX_STATUS(VX_SUCCESS, status = vxGraphParameterEnqueueReadyRef(graph1, 1, (vx_reference *)&images[0], 1)); | ||
if (VX_SUCCESS == status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphacan I am trying to understand under which conditions it would enter the if statement vs the else statement. Would the else statement need to throw some kind of error or is this a valid condition?
|
||
Therefore, enqueuing the same reference twice SHOULD return an error! | ||
|
||
Note: we modify this rule, proposed change is two rules: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphacan It looks like there was a recent change to the pipelining 2.0 spec, so can we re-word the comment to indicate that this is now mandated by the spec?
vx_context context = context_->vx_context_; | ||
/* Check some basic error returns */ | ||
vx_graph graph = vxCreateGraph(context); | ||
vx_image images[3] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphacan It might be a good idea to define and use a macro here for the size of this array and others within this test which also use this size.
if (ref == graph->parameters[graph_parameter_index].refs_list[buf_id]) | ||
{ | ||
ownPlatformSystemLock((vx_enum)TIVX_PLATFORM_LOCK_DATA_REF_QUEUE); | ||
tivx_obj_desc_t *objd = ref->obj_desc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphacan I am wondering if it makes sense to split out this section into its own dedicated function for readability sake. It seems to me that this section within the lock might be a good candidate for that
/* get queue object descriptor */ | ||
queue_obj_desc_id = data_ref_q->done_q_obj_desc_id; | ||
ownPlatformSystemLock(TIVX_PLATFORM_LOCK_DATA_REF_QUEUE); | ||
status = ownObjDescQueueDequeue(queue_obj_desc_id, &ref_obj_desc_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphacan Would this part of the code also be a good candidate for splitting out into its own function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you between the lock and unlock function calls?
what do you suggest for a function#s name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that probably makes sense, although it is a little hard to read fully in github, so if another spot makes more sense, I am open to it.
As far as a name, inferring from the details of the logic and using the typical convention we have, perhaps something like the below:
ownGraphPipelineDecrementEnqueueCount
vx_status status = (vx_status)VX_SUCCESS; | ||
vx_graph graph; | ||
vx_node node; | ||
if (VX_EVENT_GRAPH_PARAMETER_CONSUMED != type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec says that VX_EVENT_GRAPH_COMPLETED, VX_EVENT_NODE_COMPLETED, and VX_EVENT_NODE_ERROR should also be supported by this function.
…misra corrections Signed-off-by: Cano Raphael(XC-AS/EPO3) <Raphael.Cano2@de.bosch.com>
this PR contains the pipelining extension for events handling and multi graphs enqueuing.
conformance tests ran successfully: