title: How to store a result of an OpenCL kernel without taking it to a host to reuse it in another kernel?
body: <p>I have two kernels in my app:</p>
  <pre class="lang-c-like prettyprint-override"><code>__kernel void
  set_decomposition_key(
      __global const double* values_ref,
      __global const double* decomposition_results_ref,
      __global double* decomposition_keys)
  { /* Some code, results are put into decomposition_keys */ }
  
  __kernel void
  decompose(
      __global const double* values,
      __global const double* decomposition_keys,
      __global double* decomposition_results)
  { /* Some code, results are put into decomposition_results */ }
  </code></pre>
  <p><code>set_decomposition_key()</code> executes once when the app's starting, it puts its calculation results into the <code>decomposition_keys</code> value. Then <code>decompose()</code>, the main function, comes into play: it executes in a loop performing some operations in real time. It uses results of the first function stored in <code>decomposition_keys</code> as its second parameter. So the thing's that I want to keep this variable in an OpenCL device's memory without taking it to a host and then setting again for the second kernel every loop.</p>
  <p>But I don't know how to do this, my attempts to find a working solution by myself failed. So I'll appreciate any help here. Thank you in advance.</p>
  <p>Note: I know about <a href="https://stackoverflow.com/a/13363603/17939216">this answer</a>, suddenly it doesn't work for me.</p>