Definition of 'exclusive access' of a buffer to its hostData


I have a question about the meaning of the term ‘exclusive access’ in the descriptions of the buffer constructors. In the 2020 specification, in Table 39, page 114, for the constructor:

buffer(T* hostData, const range<Dimensions>& bufferRange,
    const property_list& propList = {})

it states the following:

The buffer is initialized with the memory specified by hostData, and the buffer assumes exclusive access to this memory for the duration of its lifetime.

Does this mean that the entirety of the hostData pointer is not allowed to be read or written to, or only the part that is within the bufferRange parameter’s reach?

To give an example, would the following be allowed, or is this considered a violation of the assumed exclusivity of the arr_buffer?

void test(int* arr) {
    // Assume the pointer is an array that contains at least 5 items

    // Create a buffer containing the first 4 items
    sycl::buffer<int, 1> arr_buffer = sycl::buffer<int, 1>(arr, sycl::range<1>(4));
    // Write to the 5th item
    arr[4] = 5;

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.