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