halide/Halide — pull request #233 by jrprice (2014-02-17 15:52:39+00:00)
Title: Fixes for OpenCL type casts

This pull request fixes two types of invalid type casts being generated by the OpenCL C generator.

1. Reinterpret casts were trying to use the templated reinterpret() function defined in the CodeGen_C preamble. Since templates aren't currently valid in OpenCL C, I've modified this to use the OpenCL as_type() builtin functions instead.

2. I've added buffers being passed as arguments to OpenCL kernels to the CodeGen_C::allocations scope, so that load and store operations don't result in unnecessary pointer casts. As well as being superfluous, these pointer casts were also invalid, since they casting between different OpenCL address spaces.