Forums - execute network failed on SDK 1.10.1

6 posts / 0 new
Last post
execute network failed on SDK 1.10.1
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Thu, 2018-01-11 01:27

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

  • Up0
  • Down0
32437506
Join Date: 5 Dec 17
Posts: 6
Posted: Thu, 2018-01-11 04:29

please contact me,  my QQ :3247506.   lets disccuss this issue, thank you.

  • Up0
  • Down0
jesliger
Join Date: 6 Aug 13
Posts: 75
Posted: Thu, 2018-01-11 05:55

Which runtime (CPU, GPU, DSP) are you using?

  • Up0
  • Down0
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Thu, 2018-01-11 06:52

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?

  • Up0
  • Down0
jesliger
Join Date: 6 Aug 13
Posts: 75
Posted: Thu, 2018-01-11 07:16

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.

 

  • Up0
  • Down0
zf.africa
Join Date: 15 Jun 17
Posts: 51
Posted: Thu, 2018-01-11 08:02

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.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.