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.

TDA4VM: PSDKRA/TIOVX - User kernel registration fails with multiple user kernels

Part Number: TDA4VM

Hello,

We are working with PSDK 6.1.

We register and un-register our target kernels in the tivxInit() and tivxDeInit() functions, as shown below:

    /* Initialize Host */
#if defined (C66)
    tivxRegisterOpenVXCoreTargetKernels();
    #ifdef BUILD_TUTORIAL
    tivxRegisterTutorialTargetKernels();
    tivxRegisterUserKernel001TargetC66Kernels();
    tivxRegisterUserKernel002TargetC66Kernels();
    tivxRegisterUserKernel003TargetC66Kernels();
    tivxRegisterMsiVfsInferTargetC66Kernels();
    #endif
#endif

While testing a new kernel (msi_vfs_infer), we observed the following runtime errors:

root@j7-evm:/opt/vision_apps# ./vx_app_msi_vfs_inter.out

Initializing vision app...
APP: Init ... !!!
APP_LOG: Mapping 0xb8000000 ...
APP_LOG: Mapped 0xb8000000 -> 0xffffb34a0000 of size 262144 bytes 
MEM: Init ION ... !!!
MEM: Initialized ION (fd=4) !!!
MEM: Init ION ... Done !!!
IPC: Init ... !!!
APP_LOG: Mapping 0xb8040000 ...
APP_LOG: Mapped 0xb8040000 -> 0xffffb14e0000 of size 33292288 bytes 
APP_LOG: Mapping 0x30e00000 ...
APP_LOG: Mapped 0x30e00000 -> 0xffffb39b0000 of size 3072 bytes 
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
APP: Init ... Done !!!
     0.004343 s:  VX_ZONE_INIT:Enabled
     0.004359 s:  VX_ZONE_ERROR:Enabled
     0.004362 s:  VX_ZONE_WARNING:Enabled
     0.004572 s:  VX_ZONE_INIT:[tivxInit:75] Initialization Done !!!
     0.004735 s:  VX_ZONE_INIT:[tivxHostInit:35] Initialization Done for HOST !!!
Vision app successfully initialized!
Creating use-case.......
Use-case created successfully !!!
Verifying use-case.......
     0.012750 s:  VX_ZONE_ERROR:[ownContextSendCmd:550] sending object descriptor failed
     0.012760 s:  VX_ZONE_ERROR:[ownNodeKernelInit:456] Target kernel, TIVX_CMD_NODE_CREATE failed
     0.012765 s:  VX_ZONE_ERROR:[ownGraphNodeKernelInit:559] kernel init for node 0, kernel com.ti.msi_vfs.msi_vfs_inter ... failed !!!
     0.012771 s:  VX_ZONE_ERROR:[vxVerifyGraph:1967] Node kernel init failed
     0.012776 s:  VX_ZONE_ERROR:[vxVerifyGraph:2021] Graph verify failed
ERROR verifying use-case !!!
ERROR running use-case !!!
ERROR deleting use-case !!!
Use-case has been successfully executed!
     0.012820 s:  VX_ZONE_INIT:[tivxHostDeInit:40] De-Initialization Done for HOST !!!
     0.012828 s:  VX_ZONE_ERROR:[tivxObjectDeInit:168] tivxObjectDeInit: Is graph use failed
     0.012833 s:  VX_ZONE_ERROR:[tivxObjectDeInit:174] tivxObjectDeInit: Is node use failed
     0.012837 s:  VX_ZONE_ERROR:[tivxObjectDeInit:180] tivxObjectDeInit: Is kernel use failed
     0.012846 s:  VX_ZONE_ERROR:[tivxObjectDeInit:228] tivxObjectDeInit: Is image use failed
     0.012852 s:  VX_ZONE_ERROR:[tivxObjectDeInit:264] tivxObjectDeInit: Is scalar use failed
     0.012856 s:  VX_ZONE_ERROR:[tivxObjectDeInit:276] tivxObjectDeInit: Is error use failed
     0.013936 s:  VX_ZONE_INIT:[tivxDeInit:114] De-Initialization Done !!!
APP: Deinit ... !!!
REMOTE_SERVICE: Deinit ... !!!
REMOTE_SERVICE: Deinit ... Done !!!
IPC: Deinit ... !!!
[C6x_1 ]     51.455208 s:  VX_ZONE_ERROR:[tivxTargetKernelInstanceAlloc:107] tivxTargetKernelInstanceAlloc: kernel com.ti.msi_vfs.msi_vfs_inter has not been registered on this CPU
[C6x_1 ]     51.455239 s:  VX_ZONE_ERROR:[tivxTargetKernelInstanceAlloc:108] tivxTargetKernelInstanceAlloc: Please register this kernel on the appropriate target core
[C6x_1 ]     51.455265 s:  VX_ZONE_ERROR:[tivxTargetNodeDescNodeCreate:753] tivxTargetNodeDescNodeCreate: target_kernel_instance is NULL
IPC: DeInit ... Done !!!
MEM: Deinit ION ... !!!
MEM: Alloc's: 1 alloc's of 2780160 bytes 
MEM: Free's : 1 free's  of 2780160 bytes 
MEM: Open's : 0 allocs  of 0 bytes 
MEM: Deinit ION ... Done !!!
APP: Deinit ... Done !!!
root@j7-evm:/opt/vision_apps# 

The test application and kernel started working fine after making the following changes in tivxInit() and corresponding changes in tivxDeInit():

    /* Initialize Host */
#if defined (C66)
    tivxRegisterOpenVXCoreTargetKernels();
    #ifdef BUILD_TUTORIAL
    tivxRegisterTutorialTargetKernels();
    //tivxRegisterUserKernel001TargetC66Kernels();
    //tivxRegisterUserKernel002TargetC66Kernels();
    //tivxRegisterUserKernel003TargetC66Kernels();
    //tivxRegisterUserKernel004TargetC66Kernels();
    tivxRegisterMsiVfsInferTargetC66Kernels();
    #endif
#endif

This is a great workaround for the unit testing.

But we require to register and use all of our existing user kernels in our DL-based vision app, and possibly add more in the future.

So there is a good chance that the runtime errors for new user kernel registration shown above may occur again.

How can we avoid/resolve these errors? Please advise.

Thank you.

  • Hello Sagar,

    Could you share the user kernel source code so that I can review for possible issues?

    Regards,

    Lucas

  • Hi Lucas,

    Please find the source code attached. 

    20200615_userkernel.zip

  • Hello Anshuman,

    Is this the kernel that you are trying to register but is causing an issue?  I ask because in the code above, the register kernels called used is:

    tivxRegisterMsiVfsInferTargetC66Kernels

    while the one in the code that you send me is called

    tivxRegisterMsiVfsTargetC66Kernels

    Do you mind clarifying if this is the correct kernel to be used?  If so, could you try calling tivxRegisterMsiVfsTargetC66Kernels in addition to tivxRegisterMsiVfsInferTargetC66Kernels?

    Regards,

    Lucas

  • Hello Lucas,

    This (msi_vfs) is the correct kernel. And in the tivx_init.c source file, the actual code is as follows:

        /* Initialize Host */
    #if defined (C66)
        tivxRegisterOpenVXCoreTargetKernels();
        #ifdef BUILD_TUTORIAL
        tivxRegisterTutorialTargetKernels();
        tivxRegisterUserKernel001TargetC66Kernels();
        tivxRegisterUserKernel002TargetC66Kernels();
        tivxRegisterUserKernel003TargetC66Kernels();
        tivxRegisterMsiVfsTargetC66Kernels();
        #endif
    #endif

    It appears I put the wrong kernel registration call while editing the first post. Kindly ignore it.

    Thank you.

  • Hello Sagar,

    Can you confirm that you are calling "tivxMsiVfsLoadKernels" inside your app?

    Also, can you please add print statements in the following locations below and send me the log from boot?

    1. In the file kernels_j7/msi_vfs/c66/vx_msi_vfs_inter_target.c, can you add a print statement inside the function tivxAddTargetKernelMsiVfsInter and inside the if statement "if ( self_cpu == (vx_enum)TIVX_CPU_ID_DSP1 )"? This will tell if it was indeed registered using the tivxRegister call.

    2. In the same file (kernels_j7/msi_vfs/c66/vx_msi_vfs_inter_target.c), can you add a print statement inside the tivxMsiVfsInterCreate to see if this gets hit during the vxVerifyGraph call?  This will tell us if the communication between the cores is working properly.

    Regards,

    Lucas

  • Hello Lucas,

    Lucas Weaver said:

    Can you confirm that you are calling "tivxMsiVfsLoadKernels" inside your app?

    Confirmed. We are calling "tivxMsiVfsLoadKernels" inside our app.

    Lucas Weaver said:

    Also, can you please add print statements in the following locations below and send me the log from boot?

    ...

    I require some time to get back to you on this. I am interested in investigating this issue and find a solution for the problem, but I have some other tasks in progress right now that demand my attention.

    Thank you.

  • Hello Sagar,

    Thanks for the confirmation.  Please update the E2E when you get a chance to add the build logs.

    Regards,

    Lucas