Commit 5488056
authored
Note that although the volume of changes in this diff are very high, the changes themselves are extremely mechanical. This diff was written almost entirely with a LLM, but I have looked through each file and validated the changes.
## Changes
This diff updates callsites using `graph->get_tensor(value_ref)` in favor of just using the `ValueRef` directly.
A simple example (and the vast majority of changes in this diff) is a change such as:
```
vTensorPtr tensor = graph->get_tensor(tensor_ref);
some_fn(tensor->sizes());
```
To instead be
```
std::vector<int64_t> tensor_sizes = graph->sizes_of(tensor_ref);
some_fn(tensor_sizes);
```
or
```
some_fn(graph->sizes_of(tensor_ref));
```
## Motivation
Overall, the goal is to make the `get_tensor()` API protected so that it can only be used in specific situations.
In addition to the primary motivation of improving the consistency of API usage throughout the codebase, there is a practical benefit as well. `get_tensor` has a limitation that no values can be added to the graph while the `vTensorPtr` is in scope. Also, forcing tensor modifications via functions like `virtual_resize()` to go through the `ComputeGraph` will allow the graph to track changes for the purposes of determining when a command buffer re-encode or resize propagation is necessary, which will result in performance benefits.
Differential Revision: [D79564594](https://our.internmc.facebook.com/intern/diff/D79564594/)
1 parent 72ef7b1 commit 5488056
File tree
55 files changed
+740
-809
lines changed- backends/vulkan
- runtime
- graph
- ops
- impl
- utils
- utils
- test
- op_tests
- utils
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
55 files changed
+740
-809
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
394 | 396 | | |
395 | 397 | | |
396 | | - | |
| 398 | + | |
397 | 399 | | |
398 | | - | |
| 400 | + | |
399 | 401 | | |
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
403 | 405 | | |
404 | | - | |
| 406 | + | |
405 | 407 | | |
406 | 408 | | |
407 | 409 | | |
| |||
411 | 413 | | |
412 | 414 | | |
413 | 415 | | |
| 416 | + | |
414 | 417 | | |
415 | | - | |
| 418 | + | |
416 | 419 | | |
417 | | - | |
| 420 | + | |
418 | 421 | | |
419 | 422 | | |
420 | 423 | | |
| |||
445 | 448 | | |
446 | 449 | | |
447 | 450 | | |
448 | | - | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
449 | 454 | | |
450 | 455 | | |
451 | | - | |
| 456 | + | |
452 | 457 | | |
453 | | - | |
| 458 | + | |
454 | 459 | | |
455 | 460 | | |
456 | 461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
707 | 739 | | |
708 | 740 | | |
709 | 741 | | |
| |||
891 | 923 | | |
892 | 924 | | |
893 | 925 | | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
894 | 937 | | |
895 | 938 | | |
896 | 939 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
322 | 326 | | |
323 | 327 | | |
324 | 328 | | |
| |||
832 | 836 | | |
833 | 837 | | |
834 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
835 | 853 | | |
836 | 854 | | |
837 | 855 | | |
| |||
890 | 908 | | |
891 | 909 | | |
892 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
893 | 922 | | |
894 | 923 | | |
895 | 924 | | |
896 | 925 | | |
897 | 926 | | |
| 927 | + | |
898 | 928 | | |
899 | 929 | | |
900 | 930 | | |
| 931 | + | |
901 | 932 | | |
902 | 933 | | |
903 | 934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | 29 | | |
32 | | - | |
33 | | - | |
| 30 | + | |
| 31 | + | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
| |||
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | | - | |
| 42 | + | |
45 | 43 | | |
46 | | - | |
| 44 | + | |
47 | 45 | | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
53 | | - | |
| 51 | + | |
54 | 52 | | |
55 | | - | |
| 53 | + | |
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 50 | + | |
| 51 | + | |
55 | 52 | | |
56 | | - | |
57 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
| |||
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | | - | |
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
| |||
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
104 | | - | |
105 | | - | |
| 102 | + | |
| 103 | + | |
106 | 104 | | |
107 | 105 | | |
108 | 106 | | |
| |||
128 | 126 | | |
129 | 127 | | |
130 | 128 | | |
131 | | - | |
132 | | - | |
| 129 | + | |
| 130 | + | |
133 | 131 | | |
134 | 132 | | |
135 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | 85 | | |
88 | 86 | | |
89 | | - | |
| 87 | + | |
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
| |||
96 | 94 | | |
97 | 95 | | |
98 | 96 | | |
99 | | - | |
| 97 | + | |
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 71 | + | |
74 | 72 | | |
75 | 73 | | |
76 | | - | |
77 | 74 | | |
| 75 | + | |
78 | 76 | | |
79 | | - | |
| 77 | + | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
83 | | - | |
| 81 | + | |
84 | 82 | | |
85 | | - | |
86 | | - | |
| 83 | + | |
| 84 | + | |
87 | 85 | | |
88 | 86 | | |
89 | 87 | | |
| |||
92 | 90 | | |
93 | 91 | | |
94 | 92 | | |
95 | | - | |
| 93 | + | |
96 | 94 | | |
97 | 95 | | |
98 | 96 | | |
| |||
0 commit comments