Commit 0eb0585
ssjia
[ET-VK] Fix exponential blowup in tag_memory_meta_pass repset tracing
Pull Request resolved: #18207
The trace_node_users_to_constrain_repset DFS previously tracked search depth
as a per-branch int counter, allowing each branch of a fan-out to independently
explore up to max_trace_search_depth nodes. In transformer-style graphs with
heavy fan-out this caused exponential blowup in the number of nodes visited.
Replace the int counter with a mutable list containing a single int that is
shared by reference across all recursive branches. This limits the TOTAL number
of nodes explored per top-level trace call to max_trace_search_depth (16),
regardless of fan-out structure.
Authored with Claude.
ghstack-source-id: 353546691
@exported-using-ghexport
Differential Revision: [D96790445](https://our.internmc.facebook.com/intern/diff/D96790445/)1 parent 22174fa commit 0eb0585
1 file changed
Lines changed: 15 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| |||
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
264 | | - | |
| 265 | + | |
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
| |||
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
304 | | - | |
| 305 | + | |
305 | 306 | | |
306 | 307 | | |
307 | 308 | | |
308 | | - | |
| 309 | + | |
309 | 310 | | |
310 | 311 | | |
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
315 | 316 | | |
316 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
317 | 320 | | |
318 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
319 | 325 | | |
320 | 326 | | |
321 | 327 | | |
| |||
339 | 345 | | |
340 | 346 | | |
341 | 347 | | |
342 | | - | |
| 348 | + | |
343 | 349 | | |
344 | 350 | | |
345 | 351 | | |
| |||
0 commit comments