nnlib icon indicating copy to clipboard operation
nnlib copied to clipboard

Where is this function "hexagon_nn_remove_clocks " implemented? Thanks

Open mccoychang opened this issue 5 years ago • 17 comments

Where is this function "hexagon_nn_remove_clocks " implemented? Thanks

mccoychang avatar Dec 03 '19 11:12 mccoychang

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

lee-bin avatar Dec 03 '19 16:12 lee-bin

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.

mccoychang avatar Dec 05 '19 06:12 mccoychang

Don't replace the file hexagon_nn.h.

lee-bin avatar Dec 05 '19 06:12 lee-bin

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.

mccoychang avatar Dec 05 '19 08:12 mccoychang

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

lee-bin avatar Dec 05 '19 09:12 lee-bin

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!

mccoychang avatar Dec 05 '19 11:12 mccoychang

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

lee-bin avatar Dec 05 '19 11:12 lee-bin

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

mccoychang avatar Dec 05 '19 11:12 mccoychang

Please paste the log of: adb logcat

lee-bin avatar Dec 05 '19 11:12 lee-bin

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 avatar Dec 06 '19 08:12 mccoychang

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

mccoychang avatar Dec 06 '19 08:12 mccoychang

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.

lee-bin avatar Dec 06 '19 08:12 lee-bin

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

mccoychang avatar Dec 06 '19 08:12 mccoychang

Hi BIN,

Remove the library "libcdsprpc.so" and succeed.

log1206_no_cdsprpc.txt

mccoychang avatar Dec 06 '19 10:12 mccoychang

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

lee-bin avatar Dec 06 '19 10:12 lee-bin

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.

mccoychang avatar Dec 06 '19 10:12 mccoychang

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.

lee-bin avatar Dec 09 '19 02:12 lee-bin