Skip to content

Commit 44cb643

Browse files
committed
Address more comments
Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 8a85b9c commit 44cb643

File tree

2 files changed

+66
-72
lines changed

2 files changed

+66
-72
lines changed

adoc/chapters/programming_interface.adoc

Lines changed: 66 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5164,19 +5164,6 @@ still undefined behavior.
51645164
The SYCL [code]#buffer# class template provides the common reference semantics
51655165
(see <<sec:reference-semantics>>).
51665166

5167-
5168-
==== Buffer interface
5169-
5170-
The constructors and member functions of the SYCL [code]#buffer# class template
5171-
are listed in <<sec:buffer-ctors>> and <<sec:buffer-member-funcs>>,
5172-
respectively.
5173-
The additional common special member functions and common member functions are
5174-
listed in <<table.specialmembers.common.reference>> and
5175-
<<table.hiddenfriends.common.reference>>, respectively.
5176-
5177-
Each constructor takes as the last parameter an optional SYCL
5178-
[code]#property_list# to provide properties to the SYCL [code]#buffer#.
5179-
51805167
The SYCL [code]#buffer# class template takes a template parameter
51815168
[code]#AllocatorT# for specifying an allocator which is used by the
51825169
<<sycl-runtime>> when allocating temporary memory on the host.
@@ -5186,7 +5173,7 @@ If no template argument is provided, then the default allocator for the SYCL
51865173

51875174
// Interface for class: buffer
51885175

5189-
[source,,linenums]
5176+
[source,role=synopsis]
51905177
----
51915178
include::{header_dir}/buffer.h[lines=4..-1]
51925179
----
@@ -5195,14 +5182,21 @@ include::{header_dir}/buffer.h[lines=4..-1]
51955182
[[sec:buffer-ctors]]
51965183
==== Constructors
51975184

5185+
All [code]#buffer# constructors take a parameter named [code]#propList# which
5186+
allows the application to pass zero or more properties.
5187+
These properties may specify additional effects of the constructor and
5188+
resulting [code]#buffer# object.
5189+
See <<sec:buffer-properties>> for the buffer properties that are defined by the
5190+
<<core-spec>>.
5191+
51985192
.[apititle]#Construct with uninitialized memory#
51995193
[source,role=synopsis,id=api:buffer-ctor-uninit]
52005194
----
5201-
buffer(const range<Dimensions>& bufferRange,
5202-
const property_list& propList = {}); (1)
5195+
buffer(const range<Dimensions>& bufferRange, (1)
5196+
const property_list& propList = {});
52035197

5204-
buffer(const range<Dimensions>& bufferRange, AllocatorT allocator,
5205-
const property_list& propList = {}); (2)
5198+
buffer(const range<Dimensions>& bufferRange, AllocatorT allocator, (2)
5199+
const property_list& propList = {});
52065200
----
52075201
_Effects (1):_ Equivalent to `buffer(bufferRange, AllocatorT{}, propList)`.
52085202

@@ -5217,22 +5211,23 @@ the [code]#buffer# has a valid non-null pointer specified via the member
52175211
function [code]#set_final_data()#.
52185212
Zero or more properties can be provided to the constructed SYCL [code]#buffer#
52195213
via an instance of [code]#property_list#.
5214+
52205215
'''
52215216

52225217
.[apititle]#Construct with host memory#
52235218
[source,role=synopsis,id=api:buffer-ctor-host-mem]
52245219
----
5225-
buffer(T* hostData, const range<Dimensions>& bufferRange,
5226-
const property_list& propList = {}); (1)
5220+
buffer(T* hostData, const range<Dimensions>& bufferRange, (1)
5221+
const property_list& propList = {});
52275222

52285223
buffer(T* hostData, const range<Dimensions>& bufferRange,
5229-
AllocatorT allocator, const property_list& propList = {}); (2)
5224+
AllocatorT allocator, const property_list& propList = {}); (2)
52305225

5231-
buffer(const T* hostData, const range<Dimensions>& bufferRange,
5232-
const property_list& propList = {}); (3)
5226+
buffer(const T* hostData, const range<Dimensions>& bufferRange, (3)
5227+
const property_list& propList = {});
52335228

5234-
buffer(const T* hostData, const range<Dimensions>& bufferRange,
5235-
AllocatorT allocator, const property_list& propList = {}); (4)
5229+
buffer(const T* hostData, const range<Dimensions>& bufferRange, (4)
5230+
AllocatorT allocator, const property_list& propList = {});
52365231
----
52375232
_Effects (1):_ Equivalent to `buffer(hostData, bufferRange, AllocatorT{},
52385233
propList)`.
@@ -5273,17 +5268,18 @@ The range of the constructed SYCL [code]#buffer# is specified by the
52735268

52745269
Zero or more properties can be provided to the constructed SYCL [code]#buffer#
52755270
via an instance of [code]#property_list#.
5271+
52765272
'''
52775273

52785274
.[apititle]#Construct from a container#
52795275
[source,role=synopsis,id=api:buffer-ctor-container]
52805276
----
52815277
template <typename Container>
5282-
buffer(Container& container, AllocatorT allocator,
5283-
const property_list& propList = {}); (1)
5278+
buffer(Container& container, AllocatorT allocator, (1)
5279+
const property_list& propList = {});
52845280

52855281
template <typename Container>
5286-
buffer(Container& container, const property_list& propList = {}); (2)
5282+
buffer(Container& container, const property_list& propList = {}); (2)
52875283
----
52885284
_Constraints:_ Available only if [code]#Container# is a contiguous container,
52895285
that is the following requirements must be met:
@@ -5312,24 +5308,25 @@ provided when allocating memory on the host.
53125308

53135309
Zero or more properties can be provided to the constructed SYCL [code]#buffer#
53145310
via an instance of [code]#property_list#.
5311+
53155312
'''
53165313

53175314
.[apititle]#Construct from memory owned by a shared pointer#
53185315
[source,role=synopsis,id=api:buffer-ctor-shared-ptr]
53195316
----
53205317
buffer(const std::shared_ptr<T>& hostData,
5321-
const range<Dimensions>& bufferRange, AllocatorT allocator,
5318+
const range<Dimensions>& bufferRange, AllocatorT allocator, (1)
53225319
const property_list& propList = {});
53235320

5324-
buffer(const std::shared_ptr<T>& hostData,
5321+
buffer(const std::shared_ptr<T>& hostData, (2)
53255322
const range<Dimensions>& bufferRange,
53265323
const property_list& propList = {});
53275324

5328-
buffer(const std::shared_ptr<T[]>& hostData,
5325+
buffer(const std::shared_ptr<T[]>& hostData, (3)
53295326
const range<Dimensions>& bufferRange, AllocatorT allocator,
53305327
const property_list& propList = {});
53315328

5332-
buffer(const std::shared_ptr<T[]>& hostData,
5329+
buffer(const std::shared_ptr<T[]>& hostData, (4)
53335330
const range<Dimensions>& bufferRange,
53345331
const property_list& propList = {});
53355332
----
@@ -5376,17 +5373,18 @@ The range of the constructed SYCL [code]#buffer# is specified by the
53765373
[code]#bufferRange# parameter provided.
53775374
Zero or more properties can be provided to the constructed SYCL [code]#buffer#
53785375
via an instance of [code]#property_list#.
5376+
53795377
'''
53805378

53815379
.[apititle]#Construct from iterators#
53825380
[source,role=synopsis,id=api:buffer-ctor-iterator]
53835381
----
53845382
template <class InputIterator>
5385-
buffer<T, 1>(InputIterator first, InputIterator last, AllocatorT allocator,
5383+
buffer<T, 1>(InputIterator first, InputIterator last, AllocatorT allocator, (1)
53865384
const property_list& propList = {});
53875385

53885386
template <class InputIterator>
5389-
buffer<T, 1>(InputIterator first, InputIterator last,
5387+
buffer<T, 1>(InputIterator first, InputIterator last, (2)
53905388
const property_list& propList = {});
53915389
----
53925390
_Effects (1):_ Create a new allocated 1D buffer initialized from the given
@@ -5402,6 +5400,7 @@ Zero or more properties can be provided to the constructed SYCL [code]#buffer#
54025400
via an instance of [code]#property_list#.
54035401

54045402
_Effects (2):_ Equivalent to `buffer(first, last, AllocatorT{}, propList)`.
5403+
54055404
'''
54065405

54075406
.[apititle]#Construct sub-buffer#
@@ -5441,6 +5440,7 @@ a sub-buffer.
54415440
* An [code]#exception# with the [code]#errc::invalid# error code if the sum of
54425441
[code]#baseIndex# and [code]#subRange# in any dimension exceeds the parent
54435442
buffer [code]#b# size [code]#bufferRange# in that dimension.
5443+
54445444
'''
54455445

54465446

@@ -5454,6 +5454,7 @@ range<Dimensions> get_range() const;
54545454
----
54555455
_Returns:_ A range object representing the size of the buffer in terms of number
54565456
of elements in each dimension as passed to the constructor.
5457+
54575458
'''
54585459

54595460
.[apititle]#buffer::byte_size#
@@ -5463,6 +5464,7 @@ size_t byte_size() const noexcept;
54635464
----
54645465
_Returns:_ The size of the buffer storage in bytes.
54655466
Equal to [code]#size()*sizeof(T)#.
5467+
54665468
'''
54675469

54685470
.[apititle]#buffer::size#
@@ -5473,6 +5475,7 @@ size_t size() const noexcept;
54735475
mode and target in the command group buffer.
54745476
The value of target can be [code]#target::device#,
54755477
[code]#target::constant_buffer# or [code]#target::host_task#.
5478+
54765479
'''
54775480

54785481
.[apititle]#buffer::get_count#
@@ -5483,6 +5486,7 @@ size_t get_count() const;
54835486
Deprecated by SYCL 2020.
54845487

54855488
_Effects:_ Equivalent to [code]#return size()#.
5489+
54865490
'''
54875491

54885492
.[apititle]#buffer::get_size#
@@ -5493,6 +5497,7 @@ size_t get_size() const;
54935497
Deprecated by SYCL 2020.
54945498

54955499
_Effects:_ Equivalent to [code]#return byte_size()#.
5500+
54965501
'''
54975502

54985503
.[apititle]#buffer::get_allocator#
@@ -5501,24 +5506,25 @@ _Effects:_ Equivalent to [code]#return byte_size()#.
55015506
AllocatorT get_allocator() const;
55025507
----
55035508
_Returns:_ The allocator provided to the buffer.
5509+
55045510
'''
55055511

55065512
.[apititle]#buffer::get_access#
55075513
[source,role=synopsis,id=api:buffer-get-access]
55085514
----
55095515
template <access_mode Mode = access_mode::read_write,
55105516
target Targ = target::device>
5511-
accessor<T, Dimensions, Mode, Targ> get_access(handler& commandGroupHandler); (1)
5517+
accessor<T, Dimensions, Mode, Targ> get_access(handler& commandGroupHandler); (1)
55125518

55135519
template <access_mode Mode = access_mode::read_write,
55145520
target Targ = target::device>
55155521
accessor<T, Dimensions, Mode, Targ>
5516-
get_access(handler& commandGroupHandler, range<Dimensions> accessRange,
5517-
id<Dimensions> accessOffset = {}); (2)
5522+
get_access(handler& commandGroupHandler, range<Dimensions> accessRange, (2)
5523+
id<Dimensions> accessOffset = {});
55185524

5519-
template <typename... Ts> auto get_access(Ts...); (3)
5525+
template <typename... Ts> auto get_access(Ts...); (3)
55205526

5521-
template <typename... Ts> auto get_host_access(Ts...); (4)
5527+
template <typename... Ts> auto get_host_access(Ts...); (4)
55225528
----
55235529
_Returns (1):_ A valid [code]#accessor# to the buffer with the specified access
55245530
mode and target in the command group buffer.
@@ -5549,17 +5555,18 @@ Possible implementation:
55495555
_Throws (2):_ An [code]#exception# with the [code]#errc::invalid# error code if
55505556
the sum of [code]#accessRange# and [code]#accessOffset# exceeds the range of the
55515557
buffer in any dimension.
5558+
55525559
'''
55535560

55545561
.[apititle]#Deprecated buffer::get_access#
55555562
[source,role=synopsis,id=api:buffer-get-access-deprecated]
55565563
----
55575564
template <access_mode Mode>
5558-
accessor<T, Dimensions, Mode, target::host_buffer> get_access(); (1)
5565+
accessor<T, Dimensions, Mode, target::host_buffer> get_access(); (1)
55595566

55605567
template <access_mode Mode>
55615568
accessor<T, Dimensions, Mode, target::host_buffer>
5562-
get_access(range<Dimensions> accessRange, id<Dimensions> accessOffset = {}); (2)
5569+
get_access(range<Dimensions> accessRange, id<Dimensions> accessOffset = {}); (2)
55635570
----
55645571
Deprecated in SYCL 2020.
55655572
Use [code]#get_host_access()# instead.
@@ -5576,6 +5583,7 @@ The value of target can only be [code]#target::host_buffer#.
55765583
_Throws (2):_ An [code]#exception# with the [code]#errc::invalid# error code if
55775584
the sum of [code]#accessRange# and [code]#accessOffset# exceeds the range of the
55785585
buffer in any dimension.
5586+
55795587
'''
55805588

55815589
.[apititle]#buffer::set_final_data#
@@ -5598,6 +5606,7 @@ expired.
55985606

55995607
If [code]#Destination# is [code]#std::nullptr_t#, then the copy back will not
56005608
happen.
5609+
56015610
'''
56025611

56035612
.[apititle]#buffer::set_write_back#
@@ -5612,6 +5621,7 @@ Forcing the write-back is similar to what happens during a normal write-back as
56125621
described in <<sec:buf-sync-rules>> and <<sec:sharing-host-memory-with-dm>>.
56135622

56145623
If there is nowhere to write-back, using this function does not have any effect.
5624+
56155625
'''
56165626

56175627
.[apititle]#buffer::is_sub_buffer#
@@ -5621,16 +5631,23 @@ bool is_sub_buffer() const;
56215631
----
56225632
_Returns:_ [code]#true# if this SYCL [code]#buffer# is a sub-buffer and
56235633
[code]#false# otherwise.
5634+
56245635
'''
56255636

56265637
.[apititle]#buffer::reinterpret#
56275638
[source,role=synopsis,id=api:buffer-reinterpret]
56285639
----
5629-
template <typename ReinterpretT, int ReinterpretDim>
5630-
buffer<ReinterpretT, ReinterpretDim,
5631-
typename std::allocator_traits<AllocatorT>::template rebind_alloc<
5632-
ReinterpretT>>
5633-
reinterpret(range<ReinterpretDim> reinterpretRange) const;
5640+
template <typename ReinterpretT, int ReinterpretDim>
5641+
buffer<ReinterpretT, ReinterpretDim,
5642+
typename std::allocator_traits<AllocatorT>::template rebind_alloc<
5643+
ReinterpretT>>
5644+
reinterpret(range<ReinterpretDim> reinterpretRange) const; (1)
5645+
5646+
template <typename ReinterpretT, int ReinterpretDim = Dimensions>
5647+
buffer<ReinterpretT, ReinterpretDim,
5648+
typename std::allocator_traits<AllocatorT>::template rebind_alloc<
5649+
ReinterpretT>>
5650+
reinterpret() const; (2)
56345651
----
56355652
_Preconditions (2):_ Available when [code]#(ReinterpretDim == 1)# or when
56365653
[code]#\((ReinterpretDim == Dimensions) && (sizeof(ReinterpretT) ==
@@ -5658,16 +5675,16 @@ represented by the type and range of this SYCL [code]#buffer# (or sub-buffer).
56585675
_Throws (2):_ An [code]#exception# with the [code]#errc::invalid# error code if
56595676
the total size in bytes represented by this SYCL [code]#buffer# (or sub-buffer)
56605677
is not evenly divisible by [code]#sizeof(ReinterpretT)#.
5678+
56615679
'''
56625680

56635681

56645682
[[sec:buffer-properties]]
5665-
==== Buffer properties
5683+
==== Properties
56665684

56675685
This section describes the properties that can be passed in the [code]#propList#
56685686
parameter of the <<sec:buffer-ctors, buffer constructors>>.
56695687

5670-
56715688
'''
56725689

56735690
.[apidef]#property::buffer::use_host_ptr#
@@ -5785,7 +5802,7 @@ _Returns:_ The [code]#context# provided when constructing this property.
57855802

57865803

57875804
[[sec:buf-sync-rules]]
5788-
==== Buffer destruction rules
5805+
==== Destruction rules
57895806

57905807
Buffers are reference-counted.
57915808
When a buffer value is constructed from another buffer, the two values reference

adoc/headers/buffer.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
namespace sycl {
5-
namespace property {
6-
namespace buffer {
7-
class use_host_ptr {
8-
public:
9-
use_host_ptr() = default;
10-
};
11-
12-
class use_mutex {
13-
public:
14-
use_mutex(std::mutex& mutexRef);
15-
16-
std::mutex* get_mutex_ptr() const;
17-
};
18-
19-
class context_bound {
20-
public:
21-
context_bound(context boundContext);
22-
23-
context get_context() const;
24-
};
25-
} // namespace buffer
26-
} // namespace property
27-
285
template <typename T, int Dimensions = 1,
296
typename AllocatorT = buffer_allocator<std::remove_const_t<T>>>
307
class buffer {

0 commit comments

Comments
 (0)