MCPcopy Index your code
hub / github.com/apache/tvm / test_random_fill_mt

Function test_random_fill_mt

tests/python/contrib/test_random.py:166–189  ·  view source on GitHub ↗

Check random filler applicability in case of nontrivial thread pool configuration. Particularly when MaxConcurrency != num_workers_used_ which is actual for big-little systems.

()

Source from the content-addressed store, hash-verified

164
165
166def test_random_fill_mt():
167 """Check random filler applicability in case of nontrivial thread pool configuration.
168 Particularly when MaxConcurrency != num_workers_used_ which is actual for big-little systems.
169 """
170 no_exception_happened = True
171
172 def test_body():
173 try:
174 num_thread_used = 1
175 configure_threads = tvm.get_global_func("runtime.config_threadpool")
176 configure_threads(1, num_thread_used)
177
178 test_input = tvm.runtime.empty((10, 10))
179 random_fill = tvm.get_global_func("tvm.contrib.random.random_fill_for_measure")
180 random_fill(test_input)
181 except: # pylint: disable=bare-except
182 nonlocal no_exception_happened
183 no_exception_happened = False
184
185 # ThreadPool object is thread local. To eliminate effect on other test cases put it into thread
186 x = threading.Thread(target=test_body)
187 x.start()
188 x.join()
189 assert no_exception_happened
190
191
192if __name__ == "__main__":

Callers 1

test_random.pyFile · 0.85

Calls 2

startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…