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

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

Open
paulwgw88 opened this issue Dec 24, 2021 · 5 comments
Open

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

paulwgw88 opened this issue Dec 24, 2021 · 5 comments

Comments

@paulwgw88
Copy link

大佬你好,

在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

@lu229
Copy link
Collaborator

lu229 commented Mar 29, 2022

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

@paulwgw88
Copy link
Author

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

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

@aseok
Copy link

aseok commented Aug 23, 2023

@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?

@paulwgw88
Copy link
Author

@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);

@aseok
Copy link

aseok commented Aug 23, 2023 via email

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

3 participants