Exemplo n.º 1
0
void issue_command::prepare_kernel(shared_ptr_class<kernel> kern) {
  DSELF() << kern->src.kernel_name;
  auto k = kern->get();
  ::cl_int error_code;
  int i = 0;
  for (auto& acc : kern->src.resources) {
    if (acc.second.acc.target == access::target::local) {
      error_code = clSetKernelArg(k, i, acc.second.size, nullptr);
    } else {
      auto mem = acc.second.acc.data->device_data.get();
      error_code = clSetKernelArg(k, i, acc.second.size, &mem);
    }
    detail::error::report(error_code);
    ++i;
  }
}
Exemplo n.º 2
0
  /** Create a new buffer with associated memory, using the data in
      host_data

      The ownership of the host_data is shared between the runtime and the
      user. In order to enable both the user application and the SYCL
      runtime to use the same pointer, a cl::sycl::mutex_class is
      used.
  */
  buffer(shared_ptr_class<T> &host_data,
         const range<Dimensions> &r)
    : buffer_base { false },
    access { host_data.get(), r },
    shared_data { }
    {}