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.
Abstract: Using tidl model importer tools in ti sdk 8.4, the onnx model can be imported to tidl bin files successfully in situation of numBatches > 1(multi-batch). However, when we use these two bin files to execute inference in PC emulation mode, a bus error occurred. We try to replace appMemAlloc/appMemFree by malloc/free, then this problem could be solved.
Description: Using tidl model importer tools in ti sdk 8.4, the onnx model can be imported to tidl bin files successfully in situation of numBatches > 1(multi-batch). However, when we use these two bin files to execute inference in PC emulation mode, a bus error occurred. However it can be executed normally in release 8.1.
1. Model Importer Opration
Onnx: resnet18v2.onnx (https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet18v2/resnet18v2.onnx)
Shell command: ./tidl_model_import.out resnet18v2_importer.txt
Please refer to the attachment resnet18v2.zip for details about the model and configuration. resnet18v2.zip
2. Model Inference Operation
Environment:ubuntu20 x86
First, we create params with tidl model bin files, according to the example in vision_apps. Second, we create tivxTIDLNode and vxGraph. Then we called vxVerifyGraph and vxProcessGraph.
In our program, the tiovx-related symbols is accessed by linking libvx_tidl_rt.so.
These steps were verified without problems by single-batch model which imported with “numBatches = 1”(We have verified that the obtained vx_tensors results are correct).
3. Error Information
We executed this tidl model in two machines(x86) and both encountered bus error. The following pictures show the stack information.
4. Analysis and Solution
It executed normally with sdk 8.1 but encountered bus error problem with 8.4, in the same pc environment.
We guess that the cause of this problem may be related to memory allocation, so we compare the memory related code between release 8.1 and 8.4, and we found that the implementation of “tivxMemAlloc” is different. It called “malloc” function directly in 8.1, while called “shm_open” function by “appMemAlloc” in 8.4.
Solution: To verify if this is the cause of the problem, we changed the code in appMemAlloc to malloc, and the code in appMemFree to free, accordingly. It shows that the bus error problem disappears and the inference result is basically correct.
5. Questions and Requirements
a. What’s the specific reason of this bus error problem? Is it caused by incorrect usage?
b. What is the purpose of modifying the memory allocation method of the PC mode in 8.4? Is there any problem with our current solution(using malloc) ?