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.

TDA2EXEVM: Adding a second input buffer to a compute node in BAM for EVE.

Part Number: TDA2EXEVM

Hello,

I am trying to create a use case that can calculate the integral image of some frame using the BAM framework but i have some
implementation problems. I have code than can work with 3 nodes (source->compute->sink), the compute node has only one input and one output.
I want to alter the code and add a second input buffer to the compute node which will store the results of the integral image so that they can be used with
overlapping to correctly calculate the integral image for the whole image.

The changes i have made to add the second input buffer are :

1)Change the  BAM_EdgeParams EDGELIST .
2)Change the defines to support a second block (2 input blocks 2 internal blocks).
3)Initialize internalBlock[BLOCK2_PARAMS_IDX] parameters. (i am not sure what the internalBlock[BLOCK2_PARAMS_IDX].size should be for this block)
for the other block i get it automatically from      2 * vcop_<....>_count().

4)In VisionSdk level i have changed pAlgHandle parameters to support a second buffer (for my use case's structure).

i get an assert error in the  function AlgIvision_create which returns NULL.

if i revert the input blocks to 1 and internal blocks to 1  i don't get this error. But my usecase stucks
with the last 2 messages being :

[EVE1  ]     18.266516 s:  SYSTEM: Heap = LOCAL_L2             @ 0x40020000, Total size = 24576 B (24 KB), Free size = 22244 B (21 KB)
[EVE1  ]     18.267065 s:  SYSTEM: Heap = LOCAL_DDR            @ 0x00000000, Total size = 262144 B (256 KB), Free size = 235080 B (229 KB)

if i revert the numBufs for ivision to 1 then i get no error at all and the algorithm works (but i need to have 2 buffers so it doesn't do what i want)

Can you explain me how to add a second input buffer to my compute node and avoid this errors?

BR,
Theodore

  • Hi Theodore,
    We already have a BAM based integral image calculation applet already available as part of EVE SW release. You can either refer it or can directly use it. The app is located at.
    <evesw>/apps/integralImage.

    Regards,
    Anshu
  • Hello,

    I am aware of that algorithm but i am implementing a different version that is not compatible with the already implemented app. However to validate my algorithm i needed to add a second input buffer, that gave me these errors.

    BR,

    Theodore

  • Theodore,
    As I understand you want to add another input buffer to your compute node. First of all this will involve changing the node property of the compute node. If I take current integral image kernel as an example( located at kernels\imgsiglib\Integral_image) then changes would be something like :
    #define BAM_INTEGRAL_IMAGE_TI_U8_INPUT_PORT_IN (0)
    #define BAM_INTEGRAL_IMAGE_TI_U8_INPUT_PORT_ACC_H (1)
    #define BAM_INTEGRAL_IMAGE_TI_U8_INPUT_PORT_NEW_BUFFER (2) /* This is the new buffer */

    #define NUM_IN_BLOCKS (3) ( This kernel node already was using 2 input so adding another one)

    Now as this is an input buffer to compute node so I am assuming that it will actually come from the source DMA node. So you will have to add an output buffer in the source DMA node. Source DMA node should also describe the dimension of the buffer and the location of it ( this is done in _getMemRec function of the source DMA node).

    Once these nodes are described as above then you can create edge list to describe the connections. If bam create is failing after this then you should check the error returned by the function. Then we can further investigate.

    Regards,
    Anshu
  • Hello,

    I have done these steps (at least i think so)  i don't get an error in BAM create, i get an error in which AlgIvision_create  returns NULL, i debugged further and i saw that i am receiving status error -272 from the function fxns->ialg.algInit which is called from AlgIvision_create_useLinkMem function.

    Also i am using the function assignDMAautoIncrementParams to describe the second input buffer. I don't know why i am getting error on the ivision level though and not in BAM.

    BR,

    Theodore

  • Theodore,
    Can you step inside your ialg.init function and figure out the point where this error is originating. As you mentioned that bam create is not returning this error so it should be fairly easy to find out the location at which this error is originating.

    Regards,
    Anshu
  • Hello Anshu,

    It turns out i was wrong, the error happens inside the BAM_initKernelDB function, i incorrectly assumed the error was in ivision functions because my log functions didn't work well inside the BAM framework. I will look tomorrow more into it but if you have some insight on it today it would be appreciated.

    Thanks in advance,

    Theodore

  • Hi Theodore,
    Have you made any changes to the following global variables ( located at *_graph.c file) bamKernelHostDB and bamKernelExecFuncDB? There is some mismatch in the kernel id for host and exec function. You can step inside BAM_initKernelDB to exactly know the location where you are facing the issue. Also if you have not gone through BAM framework, I would highly recommend you to first go through it so that some of the basics of the framework are clear ( documentation is available as part of algframework) . After this it should be easier for you to extend existing node to add an extra buffer.

    Regards,
    Anshu
  • Hi Anshu,

    Just to give an update on what i am doing for future reference possibly. I had some mistake in the enumerations related to the structures you mentioned. However there a few more bugs after that, i had some problems with memory management (the one that needs to happen in run time to obtain the memory requirements) this is now fixed and the BAM_createGraph is successful alongside the AlgIvision_create function.

    Now i seem to be stuck in the *_process it seems there is some loop that tries to calculate multiple frames based on the number of buffers(maybe there was some erroneous code) in one call and when i change the number of buffers to 2 it stucks in the second iteration. I am also looking at the function *_dmaControl because maybe i have to modify it to make it support the second buffer.

    BR,

    Theodore

  • Hi Theodore,
    Good to hear that your original issue got resolved. Can we close this thread? You can start a new thread whenever you have further question.

    Regards,
    Anshu