()
| 115 | |
| 116 | |
| 117 | def test_break_loop(): |
| 118 | @T.prim_func(s_tir=True) |
| 119 | def func(In: T.Buffer((2,), "int32"), Out: T.Buffer((2,), "int32")): |
| 120 | Out[0] = 0 |
| 121 | Out[1] = 1 |
| 122 | for i in range(10): |
| 123 | for j in range(10): |
| 124 | if i * 10 + j == In[0]: |
| 125 | Out[0] = i + j |
| 126 | break |
| 127 | if Out[0] > 0: |
| 128 | break |
| 129 | while Out[1] > 0: |
| 130 | Out[1] = Out[1] + 1 |
| 131 | if Out[1] > In[1]: |
| 132 | break |
| 133 | |
| 134 | func = build_tir_func(func) |
| 135 | a = np.asarray([49, 8], "int32") |
| 136 | b = np.zeros([2], "int32") |
| 137 | if not hasattr(b, "__dlpack__"): |
| 138 | return |
| 139 | func(a, b) |
| 140 | assert b[0] == 13 |
| 141 | assert b[1] == 9 |
| 142 | |
| 143 | |
| 144 | def test_continue_loop(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…