This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VMXEVM: How to set : "tivxSetNodeParameterNumBufByIndex" ?

Part Number: TDA4VMXEVM

Hello TI team,

I wish to introduce pipelining in my application. It is a multi-node application with TIDL node.

I would like to know how to decide the parameters for the "tivxSetNodeParameterNumBufByIndex" function.

I understand that these parameters would need to be set according to the application design.

So, can you explain, on what basis are these parameters set in AVP application?

  • The tivxSetNodeParameterNumBufByIndex() function accepts 3 parameters

    1. Reference to a node

    2. Index to node parameter (starts from -1, 0, 1, etc. -1 is the "graph" argument)

    3. Number of buffers (aka buffer depth) per parameter.

    This function is used for a fine-grain control of intermediate outputs shared between nodes. As a thumb rule, you could apply the following,

    1. If two nodes are executed back-to-back on the same core then the buffer depth could simply be 1. This is because the nodes are executed sequentially on the same target. By default the framework assigns a buffer depth of 1 to all intermediate outputs, which basically makes the code run sequentially. 

    2. If two nodes are executed back-to-back on different cores, then you have an opportunity to make these two nodes run in parallel by sizing the buffer depth accordingly. One assumption made in the AVP demos is that all nodes take the same time to execute irrespective of what core they are running. This allows a simple fixed allocation of buffers. For example, if node1 and node2 runs on C66x_1 and C71x_1 then assuming that both take same cycles the minimum buffer depth required is 2. (ping-pong). 

    3. If two nodes are executed on different cores but are connected later in the pipeline, then a buffer depth of 2 will not help. For example, lets say we have 3 nodes, node1, node2 and node3. If node1 output is consumed by both node2 AND node3 then sizing the output of node1 as just 2 is not sufficient as node3 will be starved. So to keep all the nodes running in parallel then the minimum number of buffers required is 3 (circular-buffer).

    4. If two nodes run on different cores and run back-to-back but take different time to execute, which is mostly the case, you can size the buffer depth such that the producer and consumer is not stalled. But as long as your use-case is met, it is not required to stress memory allocation and let one node wait for the other node to produce/consume accordingly. In the AVP demo, there is an underlying assumption that all nodes take same time and we simply do static allocation of buffer depth.

    Hope this gives you an overview of what you can do with this function. This is required for all intermediate buffers in the graph. Basically the ones which are not graph parameters.

    We mostly have one-graph parameter for input/output depending on the usecase. But it is possible to make all intermediate outputs as graph parameter as well but this is mostly not required.

    Regards,
    Shyam