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

Function generate_optrace

backends/qualcomm/debugger/utils.py:394–435  ·  view source on GitHub ↗

Generate optrace and QHAS (QNN HTP Analysis Summary) JSON files. Args: artifact (str): Path to the artifact folder. adb (SimpleADB): An object for communicating with Android device pte_path (str): The path to the generated PTE file, including the file extension (e.g

(
    artifact,
    soc_id: QcomChipset,
    adb,
    pte_path: str,
    inputs: Sequence[Tuple[torch.Tensor]],
)

Source from the content-addressed store, hash-verified

392
393
394def generate_optrace(
395 artifact,
396 soc_id: QcomChipset,
397 adb,
398 pte_path: str,
399 inputs: Sequence[Tuple[torch.Tensor]],
400):
401 """
402 Generate optrace and QHAS (QNN HTP Analysis Summary) JSON files.
403
404 Args:
405 artifact (str): Path to the artifact folder.
406 adb (SimpleADB): An object for communicating with Android device
407 pte_path (str): The path to the generated PTE file, including the file extension (e.g., model.pte).
408 inputs Sequence((Tuple[torch.Tensor])): The input tensors for the model.
409
410
411 Returns:
412 dict: A dictionary where keys are the dumped file paths and values are tuples containing the paths
413 to the generated optrace and QHAS JSON files.
414 """
415 filename, _ = os.path.splitext(pte_path.split(os.sep)[-1])
416
417 # Dump compiled binaries
418 dumpfiles = dump_context_from_pte(pte_path)
419
420 # Generate optrace and QHAS
421 qnn_tool = QnnTool(
422 artifact,
423 inputs,
424 soc_id,
425 adb,
426 build_folder=adb.build_path,
427 workspace=adb.workspace,
428 )
429
430 binaries_trace = {}
431 for file in dumpfiles:
432 filename = file.split(os.sep)[-1]
433 optrace, qhas = qnn_tool.generate_optrace(filename)
434 binaries_trace[file] = (optrace, qhas)
435 return binaries_trace

Calls 4

generate_optraceMethod · 0.95
dump_context_from_pteFunction · 0.90
QnnToolClass · 0.85
splitMethod · 0.80