User Guide

  • 2022.0
  • 05/15/2022
  • Public Content

Asynchronous Buffer

Occurs when operations between a program executed on host and a kernel are not synchronized.
Problem type: Uninitialized memory access
Code Location
Allocation site
Represents a source location of passing data from a host program to a buffer without synchronization.
Represents a source location of copying data from a buffer to host program, when kernel execution is not yet complete.
If the operations of passing data to a buffer and copying the calculated data from this buffer back to the host are not synchronized, the program copies data from the buffer before the kernel completes execution. This results in getting initially passed data from the device kernel.
DPC++ Example
queue.submit([&](cl::sycl::handler &cgh) { cgh.parallel_for<class my_task>(cl::sycl::range<1> { N }, [=](cl::sycl::id<1> idx) { // We compute squares deviceData[idx] *= deviceData[idx]; }); }); // queue.wait(); for(int i=0; i<n; i++) std::cout << deviceData[i] << “ “;

Possible Correction Strategies

To copy the correct data to the buffer after a kernel execution, do the following:
  • In the OpenCL™ kernel, use the following events to set kernel ordering:
    • clGetEventInfo()
      enables you to get information about the current state of the kernel.
    • clFinish()
      waits until the kernel execution ends and its state is completed.
  • In the Data Parallel C++ (DPC++) program, use the
    command to wait until the end of kernel execution before copying the calculated data to the host.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at