Use std::async to speed multitarget builds
Use std::async to speed multitarget builds

compile_to_target() now executes all calls to Module::compile() via
std::async. Speedup depends on machine, OS, number of targets, etc.,
but the compile_to_multitarget (with two targets) test goes from ~600ms
-> ~400ms on my four-core Mac. If I bump that test from 2->5 targets,
test goes from ~900ms -> ~425ms.

I tried to keep the async usage as conservative as possible, but the
possibility for thread-related bugs exists, of course. I’m going to
patch this CL into some code at Google for torture testing, as
multitarget outputs are much more heavily covered there than in the
Halide repo.


Former-commit-id: b48100345cee3e0e5f84c156de75f45f8acea1a0
Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide