Skip to content

Commit b30f62a

Browse files
[Backend] Refactoring RKNPU2 Backend code (#1772)
* update rknpu2 runtime * update rknpu2 runtime * update rknpu2 runtime * update for rknpu2 backend * update for rknpu2 backend --------- Co-authored-by: DefTruth <[email protected]>
1 parent 60a44f5 commit b30f62a

File tree

4 files changed

+422
-231
lines changed

4 files changed

+422
-231
lines changed

docs/cn/build_and_install/rknpu2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ cd FastDeploy
8888
git checkout develop
8989

9090
mkdir build && cd build
91-
cmake .. -DENABLE_ORT_BACKEND=ON \
91+
cmake .. -DENABLE_ORT_BACKEND=OFF \
9292
-DENABLE_RKNPU2_BACKEND=ON \
9393
-DENABLE_VISION=ON \
9494
-DRKNN2_TARGET_SOC=RK3588 \

fastdeploy/runtime/backends/rknpu2/option.h

+15-19
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,28 @@ typedef enum _rknpu2_cpu_name {
2121
UNDEFINED,
2222
} CpuName;
2323

24-
/*! RKNPU2 core mask for mobile device. */
24+
/* The specification of NPU core setting.It has the following choices :
25+
* RKNN_NPU_CORE_AUTO : Referring to automatic mode, meaning that it will
26+
* select the idle core inside the NPU.
27+
* RKNN_NPU_CORE_0 : Running on the NPU0 core.
28+
* RKNN_NPU_CORE_1: Runing on the NPU1 core.
29+
* RKNN_NPU_CORE_2: Runing on the NPU2 core.
30+
* RKNN_NPU_CORE_0_1: Running on both NPU0 and NPU1 core simultaneously.
31+
* RKNN_NPU_CORE_0_1_2: Running on both NPU0, NPU1 and NPU2 simultaneously.
32+
*/
2533
typedef enum _rknpu2_core_mask {
26-
RKNN_NPU_CORE_AUTO = 0, //< default, run on NPU core randomly.
27-
RKNN_NPU_CORE_0 = 1, //< run on NPU core 0.
28-
RKNN_NPU_CORE_1 = 2, //< run on NPU core 1.
29-
RKNN_NPU_CORE_2 = 4, //< run on NPU core 2.
30-
RKNN_NPU_CORE_0_1 =
31-
RKNN_NPU_CORE_0 | RKNN_NPU_CORE_1, //< run on NPU core 1 and core 2.
32-
RKNN_NPU_CORE_0_1_2 =
33-
RKNN_NPU_CORE_0_1 | RKNN_NPU_CORE_2, //< run on NPU core 1 and core 2.
34+
RKNN_NPU_CORE_AUTO = 0,
35+
RKNN_NPU_CORE_0 = 1,
36+
RKNN_NPU_CORE_1 = 2,
37+
RKNN_NPU_CORE_2 = 4,
38+
RKNN_NPU_CORE_0_1 = RKNN_NPU_CORE_0 | RKNN_NPU_CORE_1,
39+
RKNN_NPU_CORE_0_1_2 = RKNN_NPU_CORE_0_1 | RKNN_NPU_CORE_2,
3440
RKNN_NPU_CORE_UNDEFINED,
3541
} CoreMask;
3642
} // namespace rknpu2
3743

3844
struct RKNPU2BackendOption {
3945
rknpu2::CpuName cpu_name = rknpu2::CpuName::RK3588;
40-
41-
// The specification of NPU core setting.It has the following choices :
42-
// RKNN_NPU_CORE_AUTO : Referring to automatic mode, meaning that it will
43-
// select the idle core inside the NPU.
44-
// RKNN_NPU_CORE_0 : Running on the NPU0 core
45-
// RKNN_NPU_CORE_1: Runing on the NPU1 core
46-
// RKNN_NPU_CORE_2: Runing on the NPU2 core
47-
// RKNN_NPU_CORE_0_1: Running on both NPU0 and NPU1 core simultaneously.
48-
// RKNN_NPU_CORE_0_1_2: Running on both NPU0, NPU1 and NPU2 simultaneously.
4946
rknpu2::CoreMask core_mask = rknpu2::CoreMask::RKNN_NPU_CORE_AUTO;
5047
};
51-
5248
} // namespace fastdeploy

0 commit comments

Comments
 (0)