File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -136,15 +136,18 @@ int main(int argc, char **argv) {
136136 Halide::Internal::JITSharedRuntime::reuse_device_allocations (false );
137137 };
138138
139- // First run them serially (compilation of a Func isn't thread-safe).
140- // test1(true);
141- // test2(true);
142- // test3(true);
143- // return 0;
144-
145- // Now run all at the same time to check for concurrency issues.
146-
147- Halide::Tools::ThreadPool<void > pool (1 );
139+ // We want to launch multiple instances of each test, but compilation of a
140+ // single Func is not thread-safe, so we'd better jit-compile them ahead of
141+ // time.
142+ f1[N - 1 ].compile_jit ();
143+ f2[N - 1 ].compile_jit ();
144+ f3[N - 1 ].compile_jit ();
145+
146+ // Run all at the same time to check for concurrency issues. They'll
147+ // intentionally race on making allocations, and on setting the
148+ // allocation-cache-enabled flag. This shouldn't cause any incorrect output
149+ // or crashes.
150+ Halide::Tools::ThreadPool<void > pool;
148151 std::vector<std::future<void >> futures;
149152 futures.emplace_back (pool.async (test1, true ));
150153 futures.emplace_back (pool.async (test1, true ));
You can’t perform that action at this time.
0 commit comments