hzfan edited a comment on pull request #6771:
URL: https://github.com/apache/incubator-tvm/pull/6771#issuecomment-717639785
@tqchen The ir (before narrowing) is like
```
for (ax0.ax1.fused.ax2.outer.fused: int64, 0i64, 42i64) "parallel" {
for (n.oc_chunk.fused.oh.outer.fused: int64, 0i64,
a_very_long_upper_bound) {
...
...
for (oh.inner: int32, 0, 2) {
for (ow.inner: int32, 0, 14) {
for (oc_block: int32, 0, 16) "vectorized" {
...floormod(n.oc_chunk.fused.oh.outer.fused, cast(int64,
floordiv(((cast(int32, ((floormod(ax0.ax1.fused.ax2.outer.fused, 7i64)*2i64) +
1i64)) + 1) - cast(int32, (floormod(ax0.ax1.fused.ax2.outer.fused,
7i64)*2i64))), 2)))...
}
}
}
}
}
```
Let `a = n.oc_chunk.fused.oh.outer.fused` (the first operand of floormod),
`b = cast(int64, floordiv(((cast(int32,
((floormod(ax0.ax1.fused.ax2.outer.fused, 7i64)*2i64) + 1i64)) + 1) -
cast(int32, (floormod(ax0.ax1.fused.ax2.outer.fused, 7i64)*2i64))), 2))`
(second operand of floormod)
`const_int_bound` gives `0 <= a <= 6` and `-5 <= b <= 7`.
In a simplified form,
```
b = floordiv( cast(i32, c * 2 + 1) + 1 - cast(i32, c * 2), 2)
c = floormod(ax0.ax1.fused.ax2.outer.fused, 7)
```
I guess `cast(i32, c * 2 + 1) + 1 - cast(i32, c * 2)` is not simplified as
`2`, instead, its bound is analyzed directly, so the min becomes negative due
to the minus operation.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]