mace icon indicating copy to clipboard operation
mace copied to clipboard

请问MACE运行在DSP上是否必须root手机?

Open paulwgw88 opened this issue 2 years ago • 5 comments

大佬你好,

在MACE文档中看到下面这句 Well, the good news is that starting in the SM8150 family(some devices with old firmware may still not work), signature-free dynamic module offload is enabled on cDSP. So, steps 2-4 can be skipped. This can be achieved by calling SetHexagonToUnsignedPD() before creating MACE engine.

目前我使用的是下面的步骤:

  1. yaml文件中设定runtime为dsp
  2. 使用文档中Post-training quantization的方法量化模型
  3. 使用bazel编译libmace.a,指定runtime为DSP,mace版本为最新的master分支
  4. APK链接libmace.a和libhexagon_controller.so
  5. 将/third_party/nnlib/v66/libhexagon_nn_skel.so push到手机任意目录
  6. 程序中使用setenv设定ADSP_LIBRARY_PATH=“/path/to/libhexagon_nn_skel.so;/system/lib/rfsa/adsp;/system/vendor/lib/rfsa/adsp;/dsp”
  7. 调用SetHexagonToUnsignedPD() 和 SetRuntimeType(mace::RT_HEXAGON)设定DSP runtime
  8. 载入模型创建engine并执行推理

在三星S10(SM8150)上面可以正常运行在DSP上,但是小米9(SM8150)和一加8T(SM8250)上都无法运行,三台手机都没有root。因为高通Hexagon SDK中的testsig.py执行也需要root手机,所以这步也没有做。

小米9在 MACE_CHECK(hexagon_nn_config() == 0, "hexagon config error"); 这里会出发SIGABRT 一加8T在 MACE_CHECK(hexagon_nn_version(&version) == 0, "get version error"); 这里触发SIGABRT

paulwgw88 avatar Dec 24 '21 03:12 paulwgw88

如果是testsig.py的签名方式,需要root

lu229 avatar Mar 29 '22 06:03 lu229

如果是testsig.py的签名方式,需要root

@lu229 你好,感谢您的答复。 请问对于在DSP上运行MACE推理,使用testsig.py给手机签名这一步是必须的吗?我之前测试使用的三台手机:三星S10、小米9和一加8T,都没有签名过。结果是三星S10可以正常推理,小米9和一加8T不行。

paulwgw88 avatar Apr 01 '22 06:04 paulwgw88

@paulwgw88 how to call SetHexagonToUnsignedPD() before creating mace engine? I need to test dsp functionality on Poco f3(SM8250). Would please elaborate more on that?

aseok avatar Aug 23 '23 08:08 aseok

@paulwgw88 how to call SetHexagonToUnsignedPD() before creating mace engine? I need to test dsp functionality on Poco f3(SM8250). Would please elaborate more on that?

Here is my code:

std::shared_ptrmace::MaceEngine mEngine = nullptr; mace::MaceEngineConfig mEngineConfig; mEngineConfig.SetHexagonToUnsignedPD(); mEngineConfig.SetRuntimeType(mace::RT_HEXAGON); mace::MaceStatus status = mace::CreateMaceEngineFromProto( modelBuffer[0], modelSize[0], modelBuffer[1], modelSize[1], mInputNames, mOutputNames, mEngineConfig, &mEngine);

paulwgw88 avatar Aug 23 '23 09:08 paulwgw88

Thanks, is it sufficient to use this code along with basic usage tutorial for basic demonstration? https://mace.readthedocs.io/en/latest/user_guide/basic_usage_cmake.html On Wed, Aug 23, 2023, 12:34 PM paulwgw88 @.***> wrote:

@paulwgw88 https://github.com/paulwgw88 how to call SetHexagonToUnsignedPD() before creating mace engine? I need to test dsp functionality on Poco f3(SM8250). Would please elaborate more on that?

Here is my code:

std::shared_ptrmace::MaceEngine mEngine = nullptr; mace::MaceEngineConfig mEngineConfig; mEngineConfig.SetHexagonToUnsignedPD(); mEngineConfig.SetRuntimeType(mace::RT_HEXAGON); mace::MaceStatus status = mace::CreateMaceEngineFromProto( modelBuffer[0], modelSize[0], modelBuffer[1], modelSize[1], mInputNames, mOutputNames, mEngineConfig, &mEngine);

— Reply to this email directly, view it on GitHub https://github.com/XiaoMi/mace/issues/757#issuecomment-1689571473, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5KKLE5XAUYEYGC4QMQEADXWXBRBANCNFSM5KV6H4FA . You are receiving this because you commented.Message ID: @.***>

aseok avatar Aug 23 '23 10:08 aseok