KhronosGroup / KhronosGroup/SYCL-Docs

Can the container used to create a buffer be `const`?

Open Beginner friendly
#1,009 2 comments 0 reactions 0 assignees View on GitHub
clarification
Dominant language
JavaScript
Stars
158
Forks
80
Avg merge
7d 6h
Merged PRs (30d)
5

Description

### Specification Version

SYCL 2020 (Revision 11)

### Section Number(s)

Section 4.7.2.1. Constructors, https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#api:buffer-ctor-container.

### Issue Description

This section includes the following two sentences:

1. The return type of `std::data(container)` is convertible to `T*`.
2. Data is written back to container before the completion of buffer destruction if the return type of `std::data(container)` is not `const`.

The "is not `const`" at the end of the second sentence is confusing. If the return type is `const`, this would violate constraint (1) since it wouldn't be convertible to `T*`. It seems the constraint should instead be that `std::data(container)` is convertible to `const T *`.

### Code Example (Optional)

Relevant example is in https://github.com/0x12CC/ProtoSYCL/pull/3.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read SYCL 2020 Section 4.7.2.1 and compare its two sentences about std::data(container), const, and conversion to T*. Review the relevant example in the ProtoSYCL pull request linked in the issue. Done means the specification wording unambiguously resolves the apparent conflict between the two constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.