Dear SNPE SDK developers,
Thank you for release new version SDK, but I have met issues about network execution.
The model I use works perfect on SDK 1.8.0.
Once switching to SDK 1.10.1 (I mean use the lastest header files, and libSNPE.so, and also re-convert model with tools in new SDK), the network execution would fail.
I have measure the execution time on SDK 1.10.1, it is about 2 or 3 ms, and snpe->execute returns false, and output buffer contains all zeros.
When running on SDK 1.8.0, the execution time is about 45ms, ans snpe->execute returns true, and output buffer contains useful values.
Did I miss something important?
Any comments are appreciated! :D
please contact me, my QQ :3247506. lets disccuss this issue, thank you.
Which runtime (CPU, GPU, DSP) are you using?
Hi jesliger,
Thank you for quick response! I have fixed the issue.
the reason is that the parameter passed to zdl::DlSystem::IUserBufferFactory::createUserBuffer is changed, in SDK 1.8.0, we pass tensorshape to it, but in SDK 1.10.1 we pass strides vector to it according to example codes. But the change is not listed in documentation, and there is so little error information, so it is hard to debug the issue.
And I found another issue, when call C++ API isRuntimeAvailable on DSP runtime, it would always reture false.
Is C++ DSP runtime disabled?
C++ DSP runtime should not be unavailable, as long as you are running on a target that supports DSP. I assume snpe-net-run examples from the docs work on DSP on this target?
We will look into the documentation for userbuffer that you mentioned.
You can find the code in examples/NativeCpp/SampleCode/jni/CreateUserBuffer.cpp:
void createUserBuffer(zdl::DlSystem::UserBufferMap& userBufferMap,
std::unordered_map<std::string, std::vector<uint8_t>>& applicationBuffers,
std::vector<std::unique_ptr<zdl::DlSystem::IUserBuffer>>& snpeUserBackedBuffers,
std::unique_ptr<zdl::SNPE::SNPE>& snpe,
const char * name)
{
........
const zdl::DlSystem::TensorShape& bufferShape = (*bufferAttributesOpt)->getDims();
// calculate stride based on buffer strides
// Note: Strides = Number of bytes to advance to the next element in each dimension.
// For example, if a float tensor of dimension 2x4x3 is tightly packed in a buffer of 96 bytes, then the strides would be (48,12,4)
std::vector<size_t> strides(bufferShape.rank());
strides[strides.size() - 1] = sizeof(float);
size_t stride = strides[strides.size() - 1];
for (size_t i = bufferShape.rank() - 1; i > 0; i--)
{
stride *= bufferShape[i];
strides[i-1] = stride;
}
..........
zdl::DlSystem::IUserBufferFactory& ubFactory = zdl::SNPE::SNPEFactory::getUserBufferFactory();
snpeUserBackedBuffers.push_back(ubFactory.createUserBuffer(applicationBuffers.at(name).data(),
bufSize,
strides,
&userBufferEncodingFloat));
........
}
The strides vector is newly added, in SDK 1.8.0 bufferShape is passed directly to ubFactory.createUserBuffer.
So it mean that the third parameter type of ubFactory.createUserBuffer is changed to vector, the document is not updated.