8.3.3 Do not create buffers with CL_MEM_USE_HOST_PTR if possible

When a memory buffer is created using clCreateBuffer(CL_MEM_USE_HOST_PTR), the driver might be required to copy the data to a separate buffer. This copy enables a kernel running on the GPU to access it. If the kernel modifies the buffer and the application maps the buffer so that it can be read, the driver copies the updated data back to the original location. The driver uses the application processor to perform these copy operations, that are computationally expensive.

This method of allocating buffers is shown in the following figure.

Figure 8-2 Memory buffer created by clCreateBuffer(CL_MEM_USE_HOST_PTR)
To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

If your application can use an alternative allocation type, it can avoid these computationally expensive copy operations. For example, CL_MEM_ALLOC_HOST_PTR.

Non-ConfidentialPDF file icon PDF version101574_0302_00_en
Copyright © 2019 Arm Limited or its affiliates. All rights reserved.