Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.

Commit 843d6ea

Browse files
committed
set tflite with no bind by default
1 parent 036a697 commit 843d6ea

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

Diff for: core/engine.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
get_soc_code,
2323
get_soc_info_from_soc_code,
2424
get_product,
25+
cpu_idx_str_to_mask,
2526
) # noqa
2627
from utils.cmd import run_cmds, run_cmd # noqa
2728
from utils.misc import pattern_match, get_file_name # noqa
@@ -654,7 +655,13 @@ def run_bench_for_single_thread_func(
654655
]( # noqa
655656
backend
656657
),
657-
# power_mode(TODO): no bind deafault? need explore deeply # noqa
658+
# power_mode
659+
"power_mode_cpu_mask": cpu_idx_str_to_mask( # noqa
660+
device_dict[device_serial][
661+
"bind_cpu_idx"
662+
], # noqa
663+
self.config["power_mode"],
664+
), # noqa
658665
}
659666
)
660667
print(bench_cmd)

Diff for: utils/device.py

+29
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,35 @@
1010
from utils.misc import pattern_match # noqa
1111

1212

13+
def cpu_idx_str_to_mask(cpu_idx_str_raw, power_mode):
14+
if power_mode == "no_bind":
15+
return " "
16+
# TODO(ysh329):
17+
str_cpu_idx_list = cpu_idx_str_raw.split(",")
18+
str_cpu_idx_list = filter(lambda s: s != "", str_cpu_idx_list)
19+
int_cpu_idx_list = map(int, str_cpu_idx_list)
20+
21+
cpu_mask_10 = 0
22+
for cpu_idx in int_cpu_idx_list:
23+
cpu_mask_10 += 2 ** cpu_idx
24+
25+
cpu_mask_hex_raw = hex(cpu_mask_10)
26+
cpu_mask_hex_std_list = cpu_mask_hex_raw.split("x")
27+
28+
assert len(cpu_mask_hex_std_list) == 2
29+
zero_num = 8 - len(cpu_mask_hex_std_list[1])
30+
cpu_mask_hex_std = "0x" + zero_num * "0" + cpu_mask_hex_std_list[1]
31+
logger.debug(
32+
"cpu_idx_str_raw:{}, cpu_mask_10:{}, cpu_mask_hex_raw:{}," # noqa
33+
" cpu_mask_hex_std:{}".format(
34+
cpu_idx_str_raw, cpu_mask_10, cpu_mask_hex_raw, cpu_mask_hex_std # noqa
35+
)
36+
) # noqa
37+
# TODO(ysh329): can improve
38+
cpu_mask_hex_std = " taskset " + cpu_mask_hex_std
39+
return cpu_mask_hex_std
40+
41+
1342
def get_soc_info_from_soc_code(soc_code):
1443
###############################
1544
# summ.: http://www.mydrivers.com/zhuanti/tianti/01/index.html

0 commit comments

Comments
 (0)