I am using SNPE 1.27.1.382 and I am following the UDL tutorial https://developer.qualcomm.com/docs/snpe/udl_tutorial.html.
I am experiencing a problem with packing and unpacking the blob data. On the Python converter side, I am packing 4-byte integers, which could result in packing "0x00" bytes (for example, 5 is packed as \x05\x00\x00\x00).
self._blob # 112\x00\x18\x00\x02\x00\x02\x00\x00\x00\x04\x00\x00\x00\x00\x01\x00\x00\x80...
This seems to be a problem on the runtime side, because the UDLContext class (include/zdl/DlSystem/UDLContext.hpp) seems to store the blob as a std::string, which truncates on `0x00` bytes. So the data received on the UDL factory callback is already truncated.
const void *blob = c->getBlob(); # c.m_Buffer = "112"const int blobSize = c->getSize(); # c.m_Size = 3
UDLContext(const std::string& name,const std::string& type,int32_t id,const std::string& blob) :m_Name(name), m_Type(type), m_Size(blob.size()), m_Id(id) {std::cout << blob << std::endl;// FIXME not dealing with alloc errorm_Buffer = new uint8_t[m_Size];std::memcpy(m_Buffer, blob.data(), m_Size);}
The issue is reproducible with the sample UDL codes from the tutorial.
The blob size returned by snpe-dlc-info and by the UDLContext is 1 (which is because the layer type is \x01\x00\x00\x00).
This is different from what is displayed on the tutorial where the blob size is 2017.
This problem exists since 1.25. The last working UDL version is 1.24. Interestingly, 'include/zdl/DlSystem/UDLContext.hpp' has not changed from 1.24 and 1.25. Hope, SNPE team come up and fix it. Your offical UDL example is NOT working.
The problem is indeed fixed by using an older SNPE, specifically 1.24.0.256.
The blob size and contents are now correct.
You can download the older version from here: https://developer.qualcomm.com/downloads/neural-processing-sdk-ai-v1240?...
Do not use 1.25, 1.26, and 1.27 if you want to use UDLs.