|
51 | 51 | get_soc_to_chipset_map, |
52 | 52 | update_spill_fill_size, |
53 | 53 | ) |
| 54 | + |
| 55 | +from executorch.devtools.backend_debug import print_delegation_info |
54 | 56 | from executorch.examples.models.llama.source_transformation.quantize import ( |
55 | 57 | get_quant_embedding_transform, |
56 | 58 | ) |
@@ -389,6 +391,7 @@ def lowering_modules( |
389 | 391 | num_sharding=1, |
390 | 392 | passes_job=OrderedDict(), |
391 | 393 | shared_buffer=False, |
| 394 | + verbose=False, |
392 | 395 | ): |
393 | 396 | executorch_config = ExecutorchBackendConfig( |
394 | 397 | # For shared buffer, user must pass the memory address |
@@ -440,6 +443,10 @@ def lowering_modules( |
440 | 443 | edge_prog_mgr = edge_prog_mgr.to_backend(partitioner) |
441 | 444 | if num_sharding > 1: |
442 | 445 | update_spill_fill_size(edge_prog_mgr.exported_program()) |
| 446 | + |
| 447 | + if verbose: |
| 448 | + print_delegation_info(edge_prog_mgr.exported_program().graph_module) |
| 449 | + |
443 | 450 | exec_prog_mgr = edge_prog_mgr.to_executorch(config=executorch_config) |
444 | 451 | with open(f"{work_space}/{self.pte_filename}.pte", "wb") as file: |
445 | 452 | exec_prog_mgr.write_to_file(file) |
@@ -667,6 +674,10 @@ def compile(args, pte_filename, tokenizer): |
667 | 674 | ) |
668 | 675 | compiler_specs[0][0].value = option_to_flatbuffer(qnn_executorch_options) |
669 | 676 |
|
| 677 | + if args.verbose: |
| 678 | + for exported_program in exported_programs: |
| 679 | + print_delegation_info(exported_program.graph_module) |
| 680 | + |
670 | 681 | executorch_config = ExecutorchBackendConfig( |
671 | 682 | # For shared buffer, user must pass the memory address |
672 | 683 | # which is allocated by RPC memory to executor runner. |
@@ -980,6 +991,8 @@ def _build_parser(): |
980 | 991 | help="Fallback to cpu embedding operator and type of embedding quantization, '<bitwidth>,<groupsize>', e.g., '4,32'.", |
981 | 992 | ) |
982 | 993 |
|
| 994 | + parser.add_argument("-v", "--verbose", action="store_true") |
| 995 | + |
983 | 996 | return parser |
984 | 997 |
|
985 | 998 |
|
|
0 commit comments