| 426 | self._adb(["push", file_name, self.workspace]) |
| 427 | |
| 428 | def execute( |
| 429 | self, |
| 430 | custom_runner_cmd=None, |
| 431 | method_index=0, |
| 432 | output_callback: Optional[Callable[[str], None]] = None, |
| 433 | iteration=1, |
| 434 | ): |
| 435 | self._adb(["shell", f"mkdir -p {self.output_folder}"]) |
| 436 | # run the delegation |
| 437 | if custom_runner_cmd is None: |
| 438 | qnn_executor_runner_args = ( |
| 439 | " ".join( |
| 440 | [ |
| 441 | f"--model_path {os.path.basename(self.pte_path[0])}", |
| 442 | f"--output_folder_path {self.output_folder}", |
| 443 | f"--input_list_path {self.input_list_filename}", |
| 444 | f"--etdump_path {self.etdump_path}", |
| 445 | "--shared_buffer" if self.shared_buffer else "", |
| 446 | f"--debug_output_path {self.debug_output_path}", |
| 447 | ( |
| 448 | "--dump_intermediate_outputs" |
| 449 | if self.dump_intermediate_outputs |
| 450 | else "" |
| 451 | ), |
| 452 | f"--method_index {method_index}", |
| 453 | "" if self.direct_build_folder else f"--iteration {iteration}", |
| 454 | ] |
| 455 | ) |
| 456 | + self.extra_cmds |
| 457 | ) |
| 458 | if self.qnn_config.direct_build_folder: |
| 459 | qnn_executor_runner_args = " ".join( |
| 460 | [ |
| 461 | qnn_executor_runner_args, |
| 462 | f"--domain_id {get_dsp_id(self.qnn_config.backend)}", |
| 463 | ] |
| 464 | ) |
| 465 | qnn_executor_runner_cmds = " ".join( |
| 466 | [ |
| 467 | f"cd {self.workspace} &&", |
| 468 | f"chmod +x {os.path.basename(self.runner)} &&", |
| 469 | f"export LD_LIBRARY_PATH=. && export ADSP_LIBRARY_PATH=. && echo 0x0C > {os.path.basename(self.runner)}.farf && ./{os.path.basename(self.runner)} {qnn_executor_runner_args}", |
| 470 | ] |
| 471 | ) |
| 472 | else: |
| 473 | qnn_executor_runner_cmds = custom_runner_cmd |
| 474 | self._adb( |
| 475 | ["shell", f"{qnn_executor_runner_cmds}"], output_callback=output_callback |
| 476 | ) |
| 477 | |
| 478 | def pull(self, host_output_path, device_output_path=None, callback=None): |
| 479 | if device_output_path is None: |