MCPcopy Create free account
hub / github.com/pytorch/executorch / build_ethosu_runtime

Function build_ethosu_runtime

backends/arm/test/test_model.py:179–223  ·  view source on GitHub ↗
(
    et_build_root: str,
    script_path: str,
    pte_file: str,
    target: str,
    system_config: str,
    memory_mode: str,
    extra_flags: str,
    elf_build_path: str,
    specify_ethosu_scratch: bool,
)

Source from the content-addressed store, hash-verified

177
178
179def build_ethosu_runtime(
180 et_build_root: str,
181 script_path: str,
182 pte_file: str,
183 target: str,
184 system_config: str,
185 memory_mode: str,
186 extra_flags: str,
187 elf_build_path: str,
188 specify_ethosu_scratch: bool,
189):
190 if specify_ethosu_scratch:
191 from executorch.backends.arm.scripts.get_ethosu_scratch_from_pte import (
192 get_scratch_from_pte,
193 )
194
195 scratch_size = get_scratch_from_pte(pte_file)
196 if scratch_size is not None:
197 extra_flags = (
198 f"{extra_flags} "
199 f"-DET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE={scratch_size}"
200 )
201 else:
202 raise RuntimeError(f"Failed to derive Ethos-U scratch size from {pte_file}")
203
204 elf_build_path = os.path.join(elf_build_path, "cmake-out")
205 run_external_cmd(
206 [
207 "bash",
208 os.path.join(script_path, "build_executor_runner.sh"),
209 f"--et_build_root={et_build_root}",
210 f"--pte={pte_file}",
211 "--bundleio",
212 "--etdump",
213 f"--target={target}",
214 "--build_type=Release",
215 f"--system_config={system_config}",
216 f"--memory_mode={memory_mode}",
217 f"--extra_build_flags=-DET_LOG_DUMP_OUTPUT=OFF {extra_flags}",
218 f"--output={elf_build_path}",
219 ]
220 )
221
222 elf_file = os.path.join(elf_build_path, "arm_executor_runner")
223 return elf_file
224
225
226def run_elf_with_fvp(script_path: str, elf_file: str, target: str, timeout: int):

Callers 1

test_model.pyFile · 0.85

Calls 2

get_scratch_from_pteFunction · 0.90
run_external_cmdFunction · 0.85

Tested by

no test coverage detected