MCPcopy Create free account
hub / github.com/apache/tvm / test_continue_loop

Function test_continue_loop

tests/python/tirx-base/test_tir_base.py:144–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142
143
144def test_continue_loop():
145 @T.prim_func(s_tir=True)
146 def func(Out: T.Buffer((2,), "int32")):
147 T.func_attr({"global_symbol": "main"})
148 Out[0] = 0
149 Out[1] = 0
150 for i in range(10):
151 for j in range(10):
152 if (i * 10 + j) % 3 != 0:
153 continue
154 Out[0] = Out[0] + 1
155 k = T.decl_buffer([], "int32")
156 k[()] = 0
157 while k[()] < Out[0]:
158 k[()] = k[()] + 1
159 if k[()] % 6 == 0:
160 Out[1] = Out[1] + 1
161 continue
162
163 func = build_tir_func(func)
164 b = np.zeros([2], "int32")
165 if not hasattr(b, "__dlpack__"):
166 return
167 func(b)
168 assert b[0] == 34
169 assert b[1] == 5
170
171
172def test_exception():

Callers

nothing calls this directly

Calls 3

build_tir_funcFunction · 0.85
funcFunction · 0.70
zerosMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…