Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is this function "hexagon_nn_remove_clocks " implemented? Thanks #8

Open
mccoychang opened this issue Dec 3, 2019 · 17 comments

Comments

@mccoychang
Copy link

Where is this function "hexagon_nn_remove_clocks " implemented? Thanks

@lee-bin
Copy link
Member

lee-bin commented Dec 3, 2019

I just synced this repo, you can find it from here.

@mccoychang
Copy link
Author

Hi BIN,

Thank you very much .
But the following command still has some problems.

Then I copy the file "hexagon_nn.h" to "mace / third_party / nnlib / hexagon_nn.h",
and run the command "bash tools / bazel-build-standalone-lib.sh"
(only build shared lib for arm64-v8a + cpu_gpu_dsp),
and get the following error message:

In file included from mace/core/runtime/hexagon/hexagon_dsp_wrapper.cc:31:
./third_party/nnlib/hexagon_nn.h:3:10: fatal error: 'AEEStdDef.h' file not found
#include <AEEStdDef.h>
^~~~~~~~~~~~~
1 error generated.
Target //mace/libmace:libmace_dynamic failed to build
INFO: Elapsed time: 140.187s, Critical Path: 18.87s
INFO: 63 processes: 63 local.
FAILED: Build did NOT complete successfully

Regards.

@lee-bin
Copy link
Member

lee-bin commented Dec 5, 2019

Don't replace the file hexagon_nn.h.

@mccoychang
Copy link
Author

Hi BIN,

Run the example "mobilenet-v1-quantize-retrain-dsp" on target_socs: [sdm845],
get the following error message:

2020-02-17 23:16:25.583 12455-12505/? I/MACE: mace.cc:500 Creating MaceEngine, MACE version: v0.12.0-20-gd7533c4
2020-02-17 23:16:25.583 12455-12505/? I/MACE: mace.cc:539 Initializing MaceEngine
2020-02-17 23:16:25.585 12455-12505/? W/MACE: hexagon_dsp_wrapper.cc:147 Hexagon set power failed: -1
2020-02-17 23:16:25.585 12455-12505/? A/MACE: hexagon_dsp_wrapper.cc:127 Check failed: hexagon_nn_version(&version) == 0 get version error
2020-02-17 23:16:25.588 12455-12505/? A/MACE: hexagon_dsp_wrapper.cc:127 backtrace:
2020-02-17 23:16:25.588 12455-12505/? A/MACE: hexagon_dsp_wrapper.cc:127 pc 0x78ed021938 _ZN4mace4port10AndroidEnv18GetBackTraceUnsafeEi

Thanks, regards.

@lee-bin
Copy link
Member

lee-bin commented Dec 5, 2019

You can check if your device supports running models on DSP, please refer to Supported devices.

@mccoychang
Copy link
Author

But use nnlib/android_Release/ship/controller_test to test :

adb shell "LD_LIBRARY_PATH=/data/local/tmp/hexagon_nn64 /data/local/tmp/hexagon_nn64/controller_test"
HexagonNN version: 0x20600
Success!

@lee-bin
Copy link
Member

lee-bin commented Dec 5, 2019

The current version is 0x20f00, so it's not supposed to be 0x20600. Did you push the libhexagon_nn_skel.so?

@mccoychang
Copy link
Author

OK, re-push libhexagon_nn_skel.so,
adb shell "LD_LIBRARY_PATH=/data/local/tmp/hexagon_nn64 /data/local/tmp/hexagon_nn64/controller_test"
HexagonNN version: 0x20f00
Success!

But still get the same error message:

02-17 17:53:58.825 344 577 I MACE : mace.cc:500 Creating MaceEngine, MACE version: v0.12.0-20-gd7533c4
02-17 17:53:58.826 344 577 I MACE : mace.cc:539 Initializing MaceEngine
02-17 17:53:58.826 344 577 W MACE : hexagon_dsp_wrapper.cc:147 Hexagon set power failed: -1
02-17 17:53:58.827 344 577 F MACE : hexagon_dsp_wrapper.cc:127 Check failed: hexagon_nn_version(&version) == 0 get version error

@lee-bin
Copy link
Member

lee-bin commented Dec 5, 2019

Please paste the log of:
adb logcat

@mccoychang
Copy link
Author

about model :

library_name: mobilenet-v1-quantize-retrain-dsp
target_abis: [arm64-v8a]
target_socs: [sdm845]
model_graph_format: code
model_data_format: code
models:
mobilenet_v1_quantize_retrain:
platform: tensorflow
model_file_path: http://cnbj1.fds.api.xiaomi.com/mace/miai-models/mobilenet-v1/mobilenet_v1_1.0_224_quant_retrain.pb
model_sha256_checksum: c3faa9bd790310eb3dec411d2f2e2dd8802394e31ccb47daaa5e3b6369fadfa3
subgraphs:
- input_tensors:
- input
input_shapes:
- 1,224,224,3
input_ranges:
- -1.0,1.0
output_tensors:
- MobilenetV1/Predictions/Softmax:0
output_shapes:
- 1,1001
check_tensors:
- MobilenetV1/Logits/Conv2d_1c_1x1/BiasAdd:0
check_shapes:
- 1,1,1,1001
validation_inputs_data:
- http://cnbj1.fds.api.xiaomi.com/mace/miai-models/mobilenet-v1/input_n01440764_15071.JPEG_input
runtime: dsp
limit_opencl_kernel_time: 0
nnlib_graph_mode: 0
obfuscate: 0
winograd: 0
quantize: 1

in the code "image_classify.cc"
std::map<std::string, ModelInfo> model_infos = {
{"mobilenet_v1_quantize_retrain", {"input", "MobilenetV1/Predictions/Softmax:0",
{1, 224, 224, 3}, {1,1001}}},

and got the error message :

02-18 12:37:30.456 28155 28181 I MACE : mace.cc:500 Creating MaceEngine, MACE version: v0.12.0-20-gd7533c4
02-18 12:37:30.457 28155 28181 I MACE : mace.cc:539 Initializing MaceEngine
02-18 12:37:30.457 28155 28181 F MACE : mace.cc:577 'MobilenetV1/Predictions/Softmax:0' does not belong to model's outputs [MobilenetV1/Logits/Conv2d_1c_1x1/BiasAdd:0]
02-18 12:37:30.458 28155 28181 F MACE : mace.cc:577 backtrace:
02-18 12:37:30.458 28155 28181 F MACE : mace.cc:577 pc 0x7ae8bd0b58 _ZN4mace4port10AndroidEnv18GetBackTraceUnsafeEi
02-18 12:37:30.458 28155 28181 F MACE : mace.cc:577 pc 0x7ae8bd4018 _ZN4mace4port6Logger13DealWithFatalEv

If modify the code "image_classify.cc" :
std::map<std::string, ModelInfo> model_infos = {
{"mobilenet_v1_quantize_retrain", {"input", "MobilenetV1/Logits/Conv2d_1c_1x1/BiasAdd:0",
{1, 224, 224, 3}, {1,1,1, 1001}}},

error message:

02-18 14:48:30.501 13316 13341 I MACE : mace.cc:539 Initializing MaceEngine
02-18 14:48:30.502 13316 13341 E adsprpc : remote.c:25:Invoking stubbed routine - Return failure
02-18 14:48:30.502 13316 13341 E adsprpc : remote.c:30:Invoking stubbed routine - Return failure
02-18 14:48:30.502 13316 13341 W MACE : hexagon_dsp_wrapper.cc:147 Hexagon set power failed: -1
02-18 14:48:30.502 13316 13341 E adsprpc : remote.c:25:Invoking stubbed routine - Return failure
02-18 14:48:30.502 13316 13341 E adsprpc : remote.c:30:Invoking stubbed routine - Return failure
02-18 14:48:30.502 13316 13341 F MACE : hexagon_dsp_wrapper.cc:127 Check failed: hexagon_nn_version(&version) == 0 get version error
02-18 14:48:30.503 13316 13341 F MACE : hexagon_dsp_wrapper.cc:127 backtrace:
02-18 14:48:30.503 13316 13341 F MACE : hexagon_dsp_wrapper.cc:127 pc 0x7ae929ab58 _ZN4mace4port10AndroidEnv18GetBackTraceUnsafeEi
02-18 14:48:30.503 13316 13341 F MACE : hexagon_dsp_wrapper.cc:127 pc 0x7ae929e018 _ZN4mace4port6Logger13DealWithFatalEv
02-18 14:48:30.503 13316 13341 F MACE : hexagon_dsp_wrapper.cc:127 pc 0x7ae929dfa8 _ZN4mace4port6Logger18GenerateLogMessageEv
02-18 14:48:30.503 13316 13341 F MACE : hexagon_dsp_wrapper.cc:127 pc 0x7ae929e37c _ZN4mace4port6LoggerD2Ev
02-18 14:48:30.503 13316 13341 F MACE : hexagon_dsp_wrapper.cc:127 pc 0x7ae929e508 _ZN4mace4port6LoggerD1Ev

@mccoychang
Copy link
Author

My doubt is that model's outputs should be "MobilenetV1/Predictions/Softmax:0",
but got error.

@lee-bin
Copy link
Member

lee-bin commented Dec 6, 2019

The outputs used in "image_classify.cc" should be "MobilenetV1/Logits/Conv2d_1c_1x1/BiasAdd:0" as Hexagon NN does not support Op Squeeze which is just front of Softmax.

As for the adb log, please provide the full log from MACE start instead of just a piece.

@mccoychang
Copy link
Author

OK, the attach file is the mace log.
log1206.txt

@mccoychang
Copy link
Author

Hi BIN,

Remove the library "libcdsprpc.so" and succeed.

log1206_no_cdsprpc.txt

@lee-bin
Copy link
Member

lee-bin commented Dec 6, 2019

Did you push "libcdsprpc.so" to your phone before? Where did you remove it from?

@mccoychang
Copy link
Author

In the folder "macelibrary / src / main / jniLibs / arm64-v8a",
Refer to https://github.com/XiaoMi/mace/tree/master/third_party/nnlib/arm64-v8a.
Originally put libcdsprpc.so and then deleted.

@lee-bin
Copy link
Member

lee-bin commented Dec 9, 2019

OK, libcdsprpc.so is only used to build libmace and should not be used later, as every device which supports Hexagon DSP is shipped with a libcdsprpc.so. I'll try to clarify that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants