title: OpenCL histogram with many bins
body: <p>I am using the code presented in Chapter 14 of the OpenCL Progamming Guide to calculate a histogram. It works fine for 256 bins, but unfortunately I need 65536 bins for my application. This leads to the problem that if I use this approach, the local array gets too big.</p>
  
  <pre><code>local uint tmp_histogram[256 * 256];
  </code></pre>
  
  <p>As a result, the program is not built (CL_BUILD_PROGRAM_FAILURE).</p>
  
  <p>Do you have any ideas how this issue can be solved? I thought of using multiple kernels to compute the values for the different bins (i.e. to split the histogram, so that I first compute the values for the bins 0-255, then for 256-511, etc.). However, in this case I will have to check if a value is within that range before incrementing, which means that I will need conditionals...</p>