Commit e7fb2bd
authored
[ET-VK][ez] Improve insert_prepack_node pass to handle multiple uses of constant tensors (#10488)
## Context
Refer to #6352 for why the `insert_prepack_nodes` pass is needed.
The current logic of the pass assumes that each constant tensor node has only one use. However, in reality, a constant tensor node may have multiple uses; some of which may require the insertion of a prepacking node and some which may not (since they may choose to apply some special packing in the operator implementation).
Currently, if any uses of a constant tensor node handles its own prepacking, then prepacking nodes will not be inserted. This makes it so that a model will produce a type error during runtime when an operator receives a `TensorRef` but expects a `Tensor`.
## Changes
Improve the logic of the pass to handle constant tensor nodes which have multiple uses. If any use does not handle its own prepacking, then a prepacking node will be inserted for those usages.
Differential Revision: [D73592619](https://our.internmc.facebook.com/intern/diff/D73592619/)1 parent b669184 commit e7fb2bd
1 file changed
+21
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 11 | | |
16 | 12 | | |
17 | 13 | | |
| |||
31 | 27 | | |
32 | 28 | | |
33 | 29 | | |
34 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
35 | 33 | | |
36 | | - | |
| 34 | + | |
37 | 35 | | |
38 | | - | |
39 | | - | |
| 36 | + | |
| 37 | + | |
40 | 38 | | |
41 | 39 | | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 43 | + | |
| 44 | + | |
48 | 45 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 46 | + | |
53 | 47 | | |
54 | 48 | | |
| 49 | + | |
| 50 | + | |
55 | 51 | | |
56 | 52 | | |
57 | 53 | | |
| |||
74 | 70 | | |
75 | 71 | | |
76 | 72 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
0 commit comments