Check random filler applicability in case of nontrivial thread pool configuration. Particularly when MaxConcurrency != num_workers_used_ which is actual for big-little systems.
()
| 164 | |
| 165 | |
| 166 | def 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 | |
| 192 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…