(
self,
qnn_config: QnnConfig,
pte_path: Union[str, list],
workspace,
error_only=False,
runner=None,
expected_input_shape=None,
expected_output_shape=None,
)
| 217 | """ |
| 218 | |
| 219 | def __init__( |
| 220 | self, |
| 221 | qnn_config: QnnConfig, |
| 222 | pte_path: Union[str, list], |
| 223 | workspace, |
| 224 | error_only=False, |
| 225 | runner=None, |
| 226 | expected_input_shape=None, |
| 227 | expected_output_shape=None, |
| 228 | ): |
| 229 | if runner is None: |
| 230 | runner = ( |
| 231 | "examples/qualcomm/executor_runner/qnn_executor_runner" |
| 232 | if qnn_config.direct_build_folder is None |
| 233 | else "examples/qualcomm/direct_executor_runner/qnn_executor_direct_runner" |
| 234 | ) |
| 235 | self.runner = runner |
| 236 | if qnn_config.direct_build_folder: |
| 237 | required_env = [HEXAGON_SDK_ROOT, HEXAGON_TOOLS_ROOT] |
| 238 | assert all( |
| 239 | var in os.environ for var in required_env |
| 240 | ), f"Please ensure the following environment variables are set: {required_env}" |
| 241 | self.hexagon_sdk_root = os.getenv(HEXAGON_SDK_ROOT) |
| 242 | self.hexagon_tools_root = os.getenv(HEXAGON_TOOLS_ROOT) |
| 243 | logging.info(f"{HEXAGON_SDK_ROOT}={self.hexagon_sdk_root}") |
| 244 | logging.info(f"{HEXAGON_TOOLS_ROOT}={self.hexagon_tools_root}") |
| 245 | self.qnn_config = qnn_config |
| 246 | self.qnn_sdk = os.getenv("QNN_SDK_ROOT") |
| 247 | self.build_path = qnn_config.build_folder |
| 248 | self.direct_build_folder = qnn_config.direct_build_folder |
| 249 | self.pte_path = pte_path if isinstance(pte_path, list) else [pte_path] |
| 250 | if qnn_config.pre_gen_pte: |
| 251 | self.pte_path = [ |
| 252 | os.path.join(qnn_config.pre_gen_pte, os.path.basename(p)) |
| 253 | for p in self.pte_path |
| 254 | ] |
| 255 | assert all( |
| 256 | os.path.exists(p) for p in self.pte_path |
| 257 | ), f"{self.pte_path} not found. Please ensure there are pregenerated pte files under pre_gen_pte path." |
| 258 | logging.info( |
| 259 | f"Pregenerated pte path given. Using pre_gen_pte path: {self.pte_path}" |
| 260 | ) |
| 261 | self.workspace = workspace |
| 262 | self.device_id = qnn_config.device |
| 263 | self.host_id = qnn_config.host |
| 264 | if len(self.pte_path) > 0: |
| 265 | self.working_dir = Path(self.pte_path[0]).parent.absolute() |
| 266 | else: |
| 267 | self.working_dir = Path.cwd() |
| 268 | self.input_list_filename = "input_list.txt" |
| 269 | self.etdump_path = f"{self.workspace}/etdump.etdp" |
| 270 | self.dump_intermediate_outputs = qnn_config.dump_intermediate_outputs |
| 271 | self.debug_output_path = f"{self.workspace}/debug_output.bin" |
| 272 | self.output_folder = f"{self.workspace}/outputs" |
| 273 | self.htp_arch = get_soc_to_htp_arch_map()[qnn_config.soc_model] |
| 274 | self.lpai_hw_ver = get_soc_to_lpai_hw_ver_map().get(qnn_config.soc_model, None) |
| 275 | self.error_only = error_only |
| 276 | self.shared_buffer = qnn_config.shared_buffer |
nothing calls this directly
no test coverage detected