faq.md 3.8 KB
Newer Older
L
Liangliang He 已提交
1
Frequently asked questions
L
Liangliang He 已提交
2 3
==========================

L
Liangliang He 已提交
4 5
Does the tensor data consume extra memory when compiled into C++ code?
----------------------------------------------------------------------
L
Liangliang He 已提交
6 7 8
When compiled into C++ code, the tensor data will be mmaped by the system
loader. For the CPU runtime, the tensor data are used without memory copy.
For the GPU and DSP runtime, the tensor data are used once during model
L
Liangliang He 已提交
9
initialization. The operating system is free to swap the pages out, however,
L
Liangliang He 已提交
10
it still consumes virtual memory addresses. So generally speaking, it takes
L
Liangliang He 已提交
11
no extra physical memory. If you are short of virtual memory space (this
L
Liangliang He 已提交
12 13 14
should be very rare), you can use the option to load the tensor data from
data file (can be manually unmapped after initialization) instead of compiled
code.
L
Liangliang He 已提交
15

L
Liangliang He 已提交
16 17 18
Why is the generated static library file size so huge?
-------------------------------------------------------
The static library is simply an archive of a set of object files which are
Z
Zero King 已提交
19
intermediate and contain much extra information, please check whether the
L
Liangliang He 已提交
20 21 22 23 24
final binary file size is as expected.

Why is the generated binary file (including shared library) size so huge?
-------------------------------------------------------------------------
When compiling the model into C++ code, the final binary may contains extra
Z
Zero King 已提交
25
debug symbols, they usually take a lot of space. Try to strip the shared
L
Liangliang He 已提交
26 27 28 29 30
library or binary and make sure you are following best practices to reduce
the size of an ELF binary, including disabling C++ exception, disabling RTTI,
avoiding C++ iostream, hidden internal functions etc.
In most cases, the expected overhead should be less than
{model weights size in float32}/2 + 3MB.
L
Liangliang He 已提交
31

32 33 34 35
How to set the input shape in your model deployment file(.yml) when your model support multiple input shape?
------------------------------------------------------------------------------------------------------------
Set the largest input shape of your model. The input shape is used for memory optimization.

L
Liangliang He 已提交
36 37 38 39 40 41 42 43
OpenCL allocator failed with CL_OUT_OF_RESOURCES
------------------------------------------------
OpenCL runtime usually requires continuous virtual memory for its image buffer,
the error will occur when the OpenCL driver can't find the continuous space
due to high memory usage or fragmentation. Several solutions can be tried:

* Change the model by reducing its memory usage
* Split the Op with the biggest single memory buffer
L
Liangliang He 已提交
44
* Change from armeabi-v7a to arm64-v8a to expand the virtual address space
L
Liangliang He 已提交
45 46
* Reduce the memory consumption of other modules of the same process

L
Liangliang He 已提交
47
Why is the performance worse than the official result for the same model?
L
Liangliang He 已提交
48
-------------------------------------------------------------------------
49
The power options may not set properly, see `mace/public/mace.h` for
L
Liangliang He 已提交
50 51
details.

L
Liangliang He 已提交
52
Why is the UI getting poor responsiveness when running model with GPU runtime?
L
Liangliang He 已提交
53 54 55 56
------------------------------------------------------------------------------
Try to set `limit_opencl_kernel_time` to `1`. If still not resolved, try to
modify the source code to use even smaller time intervals or changed to CPU
or DSP runtime.
李寅 已提交
57 58 59 60 61

Why is MACE not working on DSP?
------------------------------------------------------------------------------
Running models on Hexagon DSP need a few prerequisites for DSP developers:

B
Bin Li 已提交
62
* You need to make sure SOCs of your phone is manufactured by Qualcomm and has HVX supported.
李寅 已提交
63
* You need a phone that disables secure boot (once enabled, cannot be reversed, so you probably can only get that type phones from manufacturers)
B
Bin Li 已提交
64
* You need to root your phone.
B
Bin Li 已提交
65 66
* You need to sign your phone by using testsig provided by Qualcomm. (Download Qualcomm Hexagon SDK first, plugin your phone to PC, run scripts/testsig.py)
* You need to push `third_party/nnlib/v6x/libhexagon_nn_skel.so` to `/system/vendor/lib/rfsa/adsp/`.
李寅 已提交
67

68
Then, there you go. You can run Mace on Hexagon DSP.