Repository navigation
Commit 72d6348
committed
[BugFix] Reject a constant rebound inside a nested region
`Builder.bind` has a fast path for a constant right-hand side (an int, float,
str or int32 IntImm) that returns the value directly and drops the name's
binding record. Assigning a constant to a name that already has a live binding
in an enclosing region therefore went through unremarked: the constant replaced
the value at trace time, the enclosing `if` was dropped, and every later read
saw the constant unconditionally.
for i in T.serial(4):
val = A[i]
if val < 10:
val = 10
if val > 100:
val = 100
Out[i] = val
With A = [5, 50, 150, 10] this returned [10, 10, 10, 10] instead of
[10, 50, 100, 10]. The expression form of the same rebind is already rejected
with "Immutable variable `val` is used outside its defining region!", so the
same illegal program was accepted or rejected depending only on the form of the
right-hand side.
The fast path now rejects that rebind with the same message. A constant whose
region has already closed stays reusable, so nothing that a closed scope
introduced starts expiring.1 parent 994b44e commit 72d6348
2 files changed
Lines changed: 77 additions & 0 deletions
File tree
- testing/python/language
- tilelang/language/eager
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
170 | 218 | | |
171 | 219 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
| 687 | + | |
687 | 688 | | |
688 | 689 | | |
689 | 690 | | |
| 691 | + | |
690 | 692 | | |
691 | 693 | | |
692 | 694 | | |
| |||
713 | 715 | | |
714 | 716 | | |
715 | 717 | | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
716 | 745 | | |
717 | 746 | | |
718 | 747 | | |
| |||
0 commit comments