halide/Halide — pull request #194 by dsharlet-intel (2013-11-27 00:25:23+00:00)
Title: Fixing duplicate kernel and kernel argument names

This pull request is progress towards getting the convolution test working for the OpenCL/SPIR backends. When I tried to enable this test for OpenCL targets, I got errors for both duplicate kernel argument names, and duplicate kernel names. These compiler errors should be fixed by this pull request, however, the blur2 function in the convolution test still does not produce correct results in OpenCL (blur1 does produce correct results).

Here's a detailed review of the changes:

- Buffer references from Closure are stored in a single map 'buffers' instead of separate 'read' and 'write' maps. This makes it easier to avoid duplicate buffers for the same parameter (read/write) **This is a pretty significant change**, previously there would be two separate buffers, one for reading, one for writing. Now there is only one buffer. As I'm sure you are aware, **this may violate some assumptions made regarding aliasing (or the lack thereof) for some of the schedule operations**.
- CodeGen_GPU_Host uniques the kernel names. When multiple reductions from the same function are scheduled with cuda_tile, each kernel will get the same name as the function, which is not legal OpenCL C/SPIR code.
- Added OpenCL schedule to the convolution test.
- Reformatted the OpenCL C kernel arguments to make them a bit easier to read for debugging purposes (new lines for each kernel argument).

I ran make run_tests on the default (x86), opencl, and cuda targets on an Ubuntu machine and I did not notice any regressions other than the convolution test is still not fully working for OpenCL yet.