mllm icon indicating copy to clipboard operation
mllm copied to clipboard

App通过QNN访问NPU是否需要手机root权限

Open zhiyuanGH opened this issue 5 months ago • 6 comments

您好,请问在Xiaomi K80使用本项目的QNN-NTP推理是否需要获取手机root权限?

谢谢!

zhiyuanGH avatar Jul 25 '25 10:07 zhiyuanGH

我在运行qnn提供的examples里面的那个SampleApp,需要root,这个项目我就没跑通过(可能是因为我的手机用的是Snapdragon 8elite,但是这个项目makefile最高只支持了V75,但是这个sdk居然不向前兼容也是太逆天了)

dongchen12 avatar Sep 24 '25 06:09 dongchen12

你跑通了吗,xd

dongchen12 avatar Sep 24 '25 06:09 dongchen12

同问,我也跑不起来,请问是因为没有root吗?

hb-jw avatar Oct 03 '25 02:10 hb-jw

运行此项目不需要root权限,qnn相关的库文件需要使用adb上传到执行目录。Op Package的makefile目前只适配了8gen3的版本,运行在8elite上需要进行一些修改,这个会在后续的重构中再进行完善

oreomaker avatar Oct 03 '25 06:10 oreomaker

您好,请问不需要设置SELinux权限吗?我跑run_qwen_qnn.sh的时候qnn后端无法创建设备,无法与DSP硬件通信,上网查说可能是SELinux权限的问题,请问您有类似的经验吗?求指教,万分感谢!

hb-jw avatar Oct 03 '25 13:10 hb-jw

我查了hexagon cDSP的一些文档,下面是一些可供参考的内容:

  1. Most Hexagon DSPs in the system require code running on the DSP to be cryptographically signed. This includes libraries built with the Hexagon SDK and installed to the device at runtime, such as most examples shipped in the SDK. To avoid having to separately sign software for the Hexagon DSP, the Compute DSP (cDSP) supports dedicated sandboxed Unsigned PDs that can load and execute unsigned code. (from ${HEXAGON_SDK_ROOT}/docs/software/system_integration.html#unsigned-pds)
  2. Activate Unsigned PD

All DSP processes are started as signed PDs by default. To request an unsigned PD instead, clients must use the remote_session_control API as follows before starting to use the DSP:

#pragma weak remote_session_control int unsigned_pd = 0; if ( remote_session_control ) { struct remote_rpc_control_unsigned_module data; data.enable = 1; data.domain = CDSP_DOMAIN_ID; err = remote_session_control(DSPRPC_CONTROL_UNSIGNED_MODULE, (void*)&data, sizeof(data)); } The calculator example illustrates how to run code in an unsigned PD using this approach.

The client's DSP process is instantiated as a signed or unsigned PD when it is first launched and cannot be changed. Because of this the call to remote_session_control must be made before using the DSP - before making any FastRPC calls, mapping memory to the DSP, etc. (from ${HEXAGON_SDK_ROOT}/docs/software/system_integration.html#unsigned-pds) 3. 要是unsigned PD实在没办法用,也有办法:(参考 ${HEXAGON_SDK_ROOT}/docs/tools/sign.html#sign-a-device)其中提到了三种方法:[Use a signature-free dynamic module offload] [Sign a device to enable all DSP libraries to run without requiring to be signed] [Sign an individual DSP library] 细节可以自行参考,其中有不需要root就能做到的方法

dongchen12 avatar Oct 14 '25 06:10 dongchen12