halide/Halide — pull request #197 by dsharlet-intel (2013-12-06 02:31:49+00:00)
Title: Using a single global context for OpenCL

This pull request changes the OpenCL target to use a single context for all modules. This resolves the problem with the convolution test when realizing the second function. The OpenCL tests now run until Halide attempts to use sqrt_f32 and floor_f32 in test_gpu_multi_kernel, which I believe is a new problem with that target, I will work on fixing that next.

I believe my fix for the OpenCL context issue is not a long term solution. However, I'm not sure how it can be done better without some significant refactoring. I think Target needs a mechanism to run some kind of target wide initialization/cleanup. This way, the OpenCL context init/free could be done there, once, for the lifetime of the target. Currently, the OpenCL context is created/destroyed frequently.