Commit 7016066
[Cherry-Pick][Fix][TIR] UnifyThreadBinding creating unit loop with annotation (apache/tvm#14588) (#187)
This PR fixes a behavior of the UnifyThreadBinding pass which (at one
place) assumes a return value is always a ForNode, which is not right.
To be more specific, when a thread-binding loop has an annotation, the
current behavior is assuming that the post-recursive-mutation value is
also a ForNode, and apply the previous annotation directly to the new
loop. However, the post-recursive-mutation value is also possibly not a
ForNode. In this case, the current behavior is incorrect.
This PR creates a new unit-length loop in this case to preserve the
annotation.
Thanks Bohan for catching this issue.
Co-authored-by: Bohan Hou <spectrometerh@gmail.com>1 parent 65efae0 commit 7016066
2 files changed
Lines changed: 39 additions & 3 deletions
File tree
- src/tir/transforms
- tests/python/unittest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
70 | 81 | | |
71 | 82 | | |
72 | 83 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
289 | 314 | | |
290 | 315 | | |
291 | 316 | | |
| |||
0 commit comments