Name Strings

cl_pocl_content_size

Contact

Pekka Jääskeläinen, TUNI (pekka /dot/ jaaskelainen /at/ tuni /dot/ fi)

Contributors

Michal Babej, Tampere University
Pekka Jääskeläinen, Tampere University
Jan Solanti, Tampere University

Notice

Copyright (c) 2020-2021 Tampere University

Status

Final Draft

Version

Version:

1.0.0

Built On:

2021-08-27

Dependencies

This extension is written against the OpenCL Specification Version 1.0, Revision 48.

This extension requires OpenCL 1.0 or later.

Overview

This extension provides a way to to indicate a buffer which will hold the number of meaningful bytes in another buffer, after kernel execution.

The implementation can use this as an optimization hint, to internally optimize buffer transfers in scenarios with kernels producing dynamic data sizes, by not transferring the bytes that were not written to.

New API Functions

cl_int CL_API_CALL  clSetContentSizeBufferPoCL (
    cl_mem  buffer,
    cl_mem  content_size_buffer);

Modifications to the OpenCL API Specification

(Modify Section 5.2.1, Creating Buffer Objects)
(Add a new SubSection 5.2.1.1, Indicating Buffer Has Special Purpose)

The function

cl_int CL_API_CALL  clSetContentSizeBufferPoCL (
    cl_mem  buffer,
    cl_mem  content_size_buffer);

is used to indicate that the buffer content_size_buffer will hold the meaningful byte count of the content of buffer buffer.

The user is responsible for maintaining the correct meaningful byte count (the implementation does not update the content_size_buffer).

buffer is a valid cl_mem object of CL_MEM_OBJECT_BUFFER type.

content_size_buffer is a valid cl_mem object of CL_MEM_OBJECT_BUFFER type. content_size_buffer must be at least 64bits large. The meaningful byte count is stored as 64bit unsigned integer, little endian.

clSetContentSizeBufferPoCL returns CL_SUCCESS if the function is executed successfully, otherwise it returns one of the following errors:

  • CL_INVALID_MEM_OBJECT if buffer or content_size_buffer are not a valid mem objects.

  • CL_INVALID_VALUE if buffer or content_size_buffer are not of CL_MEM_OBJECT_BUFFER type, or content_size_buffer is too small.

  • CL_INVALID_CONTEXT if buffer and content_size_buffer are not in the same context.

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

Version History

Version Date Author Changes

1.0.0

2021-08-27

Michal Babej

Initial revision