Skip to content

Commit d271825

Browse files
Gasoonjiafacebook-github-bot
authored andcommitted
update profiling import issue, and latest output (#6079)
Summary: Pull Request resolved: #6079 as title Reviewed By: Olivia-liu Differential Revision: D64145609 fbshipit-source-id: fefeb254f6a0dba7404cb72aa3e6e5d1644f302b
1 parent 27330f2 commit d271825

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

docs/source/llm/getting-started.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ structure the model in a way that is compatible with the target backend.
688688
The `get_delegation_info()` method provides a summary of what happened to the model after the `to_backend()` call:
689689

690690
```python
691-
from executorch.exir.backend.utils import get_delegation_info
691+
from executorch.devtools.backend_debug import get_delegation_info
692692
from tabulate import tabulate
693693

694694
# ... After call to to_backend(), but before to_executorch()
@@ -699,11 +699,11 @@ df = delegation_info.get_operator_delegation_dataframe()
699699
print(tabulate(df, headers="keys", tablefmt="fancy_grid"))
700700
```
701701

702-
For nanoGPT targeting the XNNPACK backend, you might see the following:
702+
For nanoGPT targeting the XNNPACK backend, you might see the following (note that the numbers below are for illustration purposes only and actual values may vary):
703703
```
704-
Total delegated subgraphs: 86
705-
Number of delegated nodes: 473
706-
Number of non-delegated nodes: 430
704+
Total delegated subgraphs: 145
705+
Number of delegated nodes: 350
706+
Number of non-delegated nodes: 760
707707
```
708708

709709

@@ -712,13 +712,13 @@ Number of non-delegated nodes: 430
712712
| 0 | aten__softmax_default | 12 | 0 |
713713
| 1 | aten_add_tensor | 37 | 0 |
714714
| 2 | aten_addmm_default | 48 | 0 |
715-
| 3 | aten_arange_start_step | 0 | 25 |
715+
| 3 | aten_any_dim | 0 | 12 |
716716
| | ... | | |
717-
| 23 | aten_view_copy_default | 170 | 48 |
717+
| 25 | aten_view_copy_default | 96 | 122 |
718718
| | ... | | |
719-
| 26 | Total | 473 | 430 |
719+
| 30 | Total | 350 | 760 |
720720

721-
From the table, the operator `aten_view_copy_default` appears 170 times in delegate graphs and 48 times in non-delegated graphs.
721+
From the table, the operator `aten_view_copy_default` appears 96 times in delegate graphs and 122 times in non-delegated graphs.
722722
To see a more detailed view, use the `format_delegated_graph()` method to get a formatted str of printout of the whole graph or use `print_delegated_graph()` to print directly:
723723

724724
```python
@@ -729,20 +729,22 @@ print(format_delegated_graph(graph_module))
729729
This may generate a large amount of output for large models. Consider using "Control+F" or "Command+F" to locate the operator you’re interested in
730730
(e.g. “aten_view_copy_default”). Observe which instances are not under lowered graphs.
731731

732-
In the fragment of the output for nanoGPT below, observe that embedding and add operators are delegated to XNNPACK while the sub operator is not.
733-
734-
```
735-
%aten_unsqueeze_copy_default_22 : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.unsqueeze_copy.default](args = (%aten_arange_start_step_23, -2), kwargs = {})
736-
%aten_unsqueeze_copy_default_23 : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.unsqueeze_copy.default](args = (%aten_arange_start_step_24, -1), kwargs = {})
737-
%lowered_module_0 : [num_users=1] = get_attr[target=lowered_module_0]
738-
backend_id: XnnpackBackend
739-
lowered graph():
740-
%aten_embedding_default : [num_users=1] = placeholder[target=aten_embedding_default]
741-
%aten_embedding_default_1 : [num_users=1] = placeholder[target=aten_embedding_default_1]
742-
%aten_add_tensor : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.add.Tensor](args = (%aten_embedding_default, %aten_embedding_default_1), kwargs = {})
743-
return (aten_add_tensor,)
744-
%executorch_call_delegate : [num_users=1] = call_function[target=torch.ops.higher_order.executorch_call_delegate](args = (%lowered_module_0, %aten_embedding_default, %aten_embedding_default_1), kwargs = {})
745-
%aten_sub_tensor : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.sub.Tensor](args = (%aten_unsqueeze_copy_default, %aten_unsqueeze_copy_default_1), kwargs = {})
732+
In the fragment of the output for nanoGPT below, observe that a transformer module has been delegated to XNNPACK while the where operator is not.
733+
734+
```
735+
%aten_where_self_22 : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.where.self](args = (%aten_logical_not_default_33, %scalar_tensor_23, %scalar_tensor_22), kwargs = {})
736+
%lowered_module_144 : [num_users=1] = get_attr[target=lowered_module_144]
737+
backend_id: XnnpackBackend
738+
lowered graph():
739+
%p_transformer_h_0_attn_c_attn_weight : [num_users=1] = placeholder[target=p_transformer_h_0_attn_c_attn_weight]
740+
%p_transformer_h_0_attn_c_attn_bias : [num_users=1] = placeholder[target=p_transformer_h_0_attn_c_attn_bias]
741+
%getitem : [num_users=1] = placeholder[target=getitem]
742+
%sym_size : [num_users=2] = placeholder[target=sym_size]
743+
%aten_view_copy_default : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.view_copy.default](args = (%getitem, [%sym_size, 768]), kwargs = {})
744+
%aten_permute_copy_default : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.permute_copy.default](args = (%p_transformer_h_0_attn_c_attn_weight, [1, 0]), kwargs = {})
745+
%aten_addmm_default : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.addmm.default](args = (%p_transformer_h_0_attn_c_attn_bias, %aten_view_copy_default, %aten_permute_copy_default), kwargs = {})
746+
%aten_view_copy_default_1 : [num_users=1] = call_function[target=executorch.exir.dialects.edge._ops.aten.view_copy.default](args = (%aten_addmm_default, [1, %sym_size, 2304]), kwargs = {})
747+
return [aten_view_copy_default_1]
746748
```
747749

748750
### Performance Analysis

0 commit comments

Comments
 (0)