Commit ec4ade0
[TVMScript][Relax] Use tir.SizeVar for shape variables
As reported in apache#16877, shape inference performed during a Relax
transformation may produce different results than shape inference
performed during TVMScript parsing. While Relax transformations
call `Analyzer::MarkGlobalNonNegValue` for each shape expression, this
is not provided during TVMScript parsing. As a result, output shapes
that are conditional on the sign of a variable may produce different
results when simplifying.
This commit provides a partial resolution for this issue. Where prior
to this commit, the TVMScript parser generated a `tir.Var` for each
symbolic variable, the TVMScript parser now provides a `tir.SizeVar`
for symbolic variables that are defined in contexts that require a
non-negative size.1 parent 046c1ba commit ec4ade0
File tree
3 files changed
+2688
-388
lines changed- python/tvm/script/parser/relax
- tests/python/relax
3 files changed
+2688
-388
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
| |||
176 | 179 | | |
177 | 180 | | |
178 | 181 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
344 | 350 | | |
345 | 351 | | |
346 | 352 | | |
| |||
394 | 400 | | |
395 | 401 | | |
396 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
397 | 406 | | |
398 | 407 | | |
399 | 408 | | |
| |||
480 | 489 | | |
481 | 490 | | |
482 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
483 | 499 | | |
484 | 500 | | |
485 | 501 | | |
| |||
0 commit comments