()
| 89 | |
| 90 | |
| 91 | def test_mod(): |
| 92 | ck = IntSetChecker() |
| 93 | x, y = tvm.tirx.Var("x", "int32"), tvm.tirx.Var("y", "int32") |
| 94 | tmod = tvm.tirx.truncmod |
| 95 | ck.analyzer.update(y, tvm.arith.ConstIntBound(1, 100), override=True) |
| 96 | ck.verify(tmod(x, y), {x: tvm.arith.IntervalSet(0, 10)}, (0, y - 1)) |
| 97 | ck.verify(tmod(x, 10), {x: tvm.arith.IntervalSet(1, 10)}, (0, 9)) |
| 98 | |
| 99 | flm = tvm.tirx.floormod |
| 100 | ck.verify(flm(x, 10), {x: tvm.arith.IntervalSet(-10, 10)}, (0, 9)) |
| 101 | ck.verify(flm(x, 10), {x: tvm.arith.IntervalSet(3, 5)}, (3, 5)) |
| 102 | ck.verify(flm(x, 10), {x: tvm.arith.IntervalSet(13, 15)}, (3, 5)) |
| 103 | ck.verify(flm(x, 10), {x: tvm.arith.IntervalSet(3, 15)}, (0, 9)) |
| 104 | ck.verify(flm(x, 10), {x: tvm.arith.IntervalSet(3, 11)}, (0, 9)) |
| 105 | ck.verify(flm(x, 10), {x: tvm.arith.IntervalSet(1, 21)}, (0, 9)) |
| 106 | |
| 107 | fld = tvm.tirx.floordiv |
| 108 | z = tvm.tirx.Var("z", "int32") |
| 109 | ck.analyzer.bind(x, tvm.ir.Range.from_min_extent(0, 3)) |
| 110 | ck.verify( |
| 111 | flm(y, 8), |
| 112 | {y: tvm.arith.IntervalSet(z * 8 + x * 4, z * 8 + x * 4 + 3)}, |
| 113 | ( |
| 114 | z * 8 + x * 4 - 8 * fld(z * 8 + x * 4, 8), |
| 115 | z * 8 + x * 4 + 3 - 8 * fld(z * 8 + x * 4, 8), |
| 116 | ), |
| 117 | ) |
| 118 | ck1 = IntSetChecker() |
| 119 | ck1.analyzer.bind(x, tvm.ir.Range.from_min_extent(0, 2)) |
| 120 | ck1.verify( |
| 121 | flm(y, 8), {y: tvm.arith.IntervalSet(z * 8 + x * 4, z * 8 + x * 4 + 3)}, (x * 4, x * 4 + 3) |
| 122 | ) |
| 123 | |
| 124 | |
| 125 | def test_max_min(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…