Commit 2bea318
authored
[aoti-et] Store symbols from dlopen into AOTIDelegateHandle (#15172)
This pull request refactors how function pointers for AOTI model
container operations are managed and loaded in the CUDA backend. Instead
of relying on global/static function pointers, function pointers are now
stored per-instance in the `AOTIDelegateHandle` structure. This change
enables safe handling of multiple shared libraries within the same
process and improves encapsulation and maintainability.
**Refactoring function pointer management:**
* Removed global function pointers for AOTI model container operations
from `aoti_model_container.cpp` and `aoti_model_container.h`, and moved
them into the `AOTIDelegateHandle` struct as per-instance members.
[[1]](diffhunk://#diff-32ff58ae0581446607da6874fa62b366ba18bcff4d621b16987fda78312244a6L1-L39)
[[2]](diffhunk://#diff-84caca41e72ad693665c930ab7d0c31e05f64b268f4d7ac37c17869149fad0c7L63-L92)
[[3]](diffhunk://#diff-84caca41e72ad693665c930ab7d0c31e05f64b268f4d7ac37c17869149fad0c7R83-R89)
**CUDA backend updates:**
* Updated the CUDA backend (`cuda_backend.cpp`) to load function
pointers into each `AOTIDelegateHandle` instance using a new
`load_function_pointers_into_handle` method, replacing the previous
global symbol registration logic. All calls to model container functions
now use the handle's member function pointers.
[[1]](diffhunk://#diff-a4b17eccf1aa933837671c5184e02bc815d934a362344bb2b17b789cdfaa5375L31-R35)
[[2]](diffhunk://#diff-a4b17eccf1aa933837671c5184e02bc815d934a362344bb2b17b789cdfaa5375L60-R84)
[[3]](diffhunk://#diff-a4b17eccf1aa933837671c5184e02bc815d934a362344bb2b17b789cdfaa5375L138-L150)
[[4]](diffhunk://#diff-a4b17eccf1aa933837671c5184e02bc815d934a362344bb2b17b789cdfaa5375L168-R194)
[[5]](diffhunk://#diff-a4b17eccf1aa933837671c5184e02bc815d934a362344bb2b17b789cdfaa5375L264-R277)
**Build system adjustments:**
* Removed `aoti_model_container.cpp` from the build targets and library
sources, as global function pointer definitions are no longer needed.
[[1]](diffhunk://#diff-c95a0b47f516c30f4b2e384b88c94c088d1031e6df7af66678a6fc9d3fb1a1a5L29-L31)
[[2]](diffhunk://#diff-c3d5933d211acc568c9bdf8e08d0ca99b01e50bca113307fbab4cbc4018fdf55L29-R29)1 parent 11c0b4f commit 2bea318
File tree
5 files changed
+56
-97
lines changed- backends
- aoti
- cuda/runtime
5 files changed
+56
-97
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
Lines changed: 7 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 63 | | |
74 | | - | |
75 | 64 | | |
76 | 65 | | |
77 | 66 | | |
78 | 67 | | |
79 | 68 | | |
80 | 69 | | |
81 | | - | |
82 | 70 | | |
83 | 71 | | |
84 | 72 | | |
85 | 73 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 74 | | |
94 | 75 | | |
95 | 76 | | |
| |||
99 | 80 | | |
100 | 81 | | |
101 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
102 | 90 | | |
103 | 91 | | |
104 | 92 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 28 | + | |
32 | 29 | | |
33 | | - | |
| 30 | + | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
| |||
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
47 | | - | |
| 44 | + | |
48 | 45 | | |
49 | 46 | | |
50 | 47 | | |
| |||
53 | 50 | | |
54 | 51 | | |
55 | 52 | | |
56 | | - | |
| 53 | + | |
57 | 54 | | |
58 | 55 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
66 | 85 | | |
67 | 86 | | |
68 | 87 | | |
| |||
135 | 154 | | |
136 | 155 | | |
137 | 156 | | |
138 | | - | |
139 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
140 | 165 | | |
141 | 166 | | |
142 | 167 | | |
143 | | - | |
144 | | - | |
| 168 | + | |
| 169 | + | |
145 | 170 | | |
146 | 171 | | |
147 | 172 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | 173 | | |
152 | 174 | | |
153 | 175 | | |
| |||
165 | 187 | | |
166 | 188 | | |
167 | 189 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | 190 | | |
177 | | - | |
| 191 | + | |
178 | 192 | | |
179 | 193 | | |
180 | | - | |
181 | | - | |
| 194 | + | |
182 | 195 | | |
183 | 196 | | |
184 | 197 | | |
| |||
261 | 274 | | |
262 | 275 | | |
263 | 276 | | |
264 | | - | |
| 277 | + | |
265 | 278 | | |
266 | 279 | | |
267 | 280 | | |
| |||
0 commit comments