@@ -7,7 +7,7 @@ Date of Creation | 2019-08-20
77Target | SYCL 1.2.1
88Status | _ Draft_
99Author | Duncan McBain [ Duncan McBain] ( mailto:duncan@codeplay.com )
10- Contributors | Duncan McBain, [ Gordon Brown] ( mailto:gordon@codeplay.com )
10+ Contributors | Duncan McBain, [ Gordon Brown] ( mailto:gordon@codeplay.com ) , [ Ruyman Reyes ] ( mailto:ruyman@codeplay.com )
1111
1212## Description
1313
@@ -34,7 +34,8 @@ aid their use in this style of generic interface.
3434## Proposal
3535
3636The `cl::sycl::buffer` class should be augmented with an additional constructor
37- that takes no arguments, which initialises the buffer with a zero-size range.
37+ that takes no arguments, which default-constructs the buffer in an
38+ implementation-defined manner.
3839```c++
3940namespace cl {
4041namespace sycl {
@@ -43,7 +44,7 @@ typename AllocatorT = cl::sycl::buffer_allocator>
4344class buffer {
4445 buffer();
4546
46- bool is_valid () const noexcept;
47+ bool has_storage () const noexcept;
4748
4849 explicit operator bool() const noexcept;
4950};
@@ -53,18 +54,21 @@ class buffer {
5354The template arguments should remain the same, so that the argument can be
5455rebound to a new ` buffer ` instance later using the copy constructor.
5556
56- The ` is_valid ()` call would allow the programmer to query whether or not
57- the buffer can be used, i.e. whether or not it was constructed with a range of
58- size zero. The explicit conversion operator would call this same function but
59- allow its use in ` if ` statements.
57+ The ` has_storage ()` call would allow the programmer to query whether or not
58+ the buffer can be used, i.e. whether or not it was default- constructed. The
59+ explicit conversion operator would call this same function but allow its use
60+ in ` if ` statements.
6061
6162Requesting access from a default-constructed buffer should throw an exception.
62- It is not meaningful to use a zero-sized allocation on-device. Since there is
63- no allocation associated with the ` buffer ` , ` cl::sycl::buffer::set_final_data `
64- and ` cl::sycl::buffer::set_write_back ` should behave as if the ` buffer ` had a
65- final pointer of ` nullptr ` at all times. The other functions in the ` buffer `
66- API should behave as though the buffer were constructed with a ` range ` of size
67- zero and otherwise behave normally.
63+ It is not meaningful to use a default-constructed buffer. Since there
64+ is no allocation associated with a default-constructed ` buffer ` ,
65+ ` cl::sycl::buffer::set_final_data ` and ` cl::sycl::buffer::set_write_back `
66+ should behave as if the ` buffer ` had a final pointer of ` nullptr ` at all times.
67+ The other functions in the ` buffer ` API should behave as though the buffer were
68+ constructed with a ` range ` of size zero and otherwise behave normally.
69+
70+ Explicitly constructing a buffer with a range of zero is not allowed. This does
71+ not correspond to a valid allocation.
6872
6973## Sample code
7074
0 commit comments