@@ -5164,19 +5164,6 @@ still undefined behavior.
5164
5164
The SYCL [code]#buffer# class template provides the common reference semantics
5165
5165
(see <<sec:reference-semantics>>).
5166
5166
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
-
5180
5167
The SYCL [code]#buffer# class template takes a template parameter
5181
5168
[code]#AllocatorT# for specifying an allocator which is used by the
5182
5169
<<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
5186
5173
5187
5174
// Interface for class: buffer
5188
5175
5189
- [source,,linenums ]
5176
+ [source,role=synopsis ]
5190
5177
----
5191
5178
include::{header_dir}/buffer.h[lines=4..-1]
5192
5179
----
@@ -5195,14 +5182,21 @@ include::{header_dir}/buffer.h[lines=4..-1]
5195
5182
[[sec:buffer-ctors]]
5196
5183
==== Constructors
5197
5184
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
+
5198
5192
.[apititle]#Construct with uninitialized memory#
5199
5193
[source,role=synopsis,id=api:buffer-ctor-uninit]
5200
5194
----
5201
- buffer(const range<Dimensions>& bufferRange,
5202
- const property_list& propList = {}); (1)
5195
+ buffer(const range<Dimensions>& bufferRange, (1)
5196
+ const property_list& propList = {});
5203
5197
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 = {});
5206
5200
----
5207
5201
_Effects (1):_ Equivalent to `buffer(bufferRange, AllocatorT{}, propList)`.
5208
5202
@@ -5217,22 +5211,23 @@ the [code]#buffer# has a valid non-null pointer specified via the member
5217
5211
function [code]#set_final_data()#.
5218
5212
Zero or more properties can be provided to the constructed SYCL [code]#buffer#
5219
5213
via an instance of [code]#property_list#.
5214
+
5220
5215
'''
5221
5216
5222
5217
.[apititle]#Construct with host memory#
5223
5218
[source,role=synopsis,id=api:buffer-ctor-host-mem]
5224
5219
----
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 = {});
5227
5222
5228
5223
buffer(T* hostData, const range<Dimensions>& bufferRange,
5229
- AllocatorT allocator, const property_list& propList = {}); (2)
5224
+ AllocatorT allocator, const property_list& propList = {}); (2)
5230
5225
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 = {});
5233
5228
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 = {});
5236
5231
----
5237
5232
_Effects (1):_ Equivalent to `buffer(hostData, bufferRange, AllocatorT{},
5238
5233
propList)`.
@@ -5273,17 +5268,18 @@ The range of the constructed SYCL [code]#buffer# is specified by the
5273
5268
5274
5269
Zero or more properties can be provided to the constructed SYCL [code]#buffer#
5275
5270
via an instance of [code]#property_list#.
5271
+
5276
5272
'''
5277
5273
5278
5274
.[apititle]#Construct from a container#
5279
5275
[source,role=synopsis,id=api:buffer-ctor-container]
5280
5276
----
5281
5277
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 = {});
5284
5280
5285
5281
template <typename Container>
5286
- buffer(Container& container, const property_list& propList = {}); (2)
5282
+ buffer(Container& container, const property_list& propList = {}); (2)
5287
5283
----
5288
5284
_Constraints:_ Available only if [code]#Container# is a contiguous container,
5289
5285
that is the following requirements must be met:
@@ -5312,24 +5308,25 @@ provided when allocating memory on the host.
5312
5308
5313
5309
Zero or more properties can be provided to the constructed SYCL [code]#buffer#
5314
5310
via an instance of [code]#property_list#.
5311
+
5315
5312
'''
5316
5313
5317
5314
.[apititle]#Construct from memory owned by a shared pointer#
5318
5315
[source,role=synopsis,id=api:buffer-ctor-shared-ptr]
5319
5316
----
5320
5317
buffer(const std::shared_ptr<T>& hostData,
5321
- const range<Dimensions>& bufferRange, AllocatorT allocator,
5318
+ const range<Dimensions>& bufferRange, AllocatorT allocator, (1)
5322
5319
const property_list& propList = {});
5323
5320
5324
- buffer(const std::shared_ptr<T>& hostData,
5321
+ buffer(const std::shared_ptr<T>& hostData, (2)
5325
5322
const range<Dimensions>& bufferRange,
5326
5323
const property_list& propList = {});
5327
5324
5328
- buffer(const std::shared_ptr<T[]>& hostData,
5325
+ buffer(const std::shared_ptr<T[]>& hostData, (3)
5329
5326
const range<Dimensions>& bufferRange, AllocatorT allocator,
5330
5327
const property_list& propList = {});
5331
5328
5332
- buffer(const std::shared_ptr<T[]>& hostData,
5329
+ buffer(const std::shared_ptr<T[]>& hostData, (4)
5333
5330
const range<Dimensions>& bufferRange,
5334
5331
const property_list& propList = {});
5335
5332
----
@@ -5376,17 +5373,18 @@ The range of the constructed SYCL [code]#buffer# is specified by the
5376
5373
[code]#bufferRange# parameter provided.
5377
5374
Zero or more properties can be provided to the constructed SYCL [code]#buffer#
5378
5375
via an instance of [code]#property_list#.
5376
+
5379
5377
'''
5380
5378
5381
5379
.[apititle]#Construct from iterators#
5382
5380
[source,role=synopsis,id=api:buffer-ctor-iterator]
5383
5381
----
5384
5382
template <class InputIterator>
5385
- buffer<T, 1>(InputIterator first, InputIterator last, AllocatorT allocator,
5383
+ buffer<T, 1>(InputIterator first, InputIterator last, AllocatorT allocator, (1)
5386
5384
const property_list& propList = {});
5387
5385
5388
5386
template <class InputIterator>
5389
- buffer<T, 1>(InputIterator first, InputIterator last,
5387
+ buffer<T, 1>(InputIterator first, InputIterator last, (2)
5390
5388
const property_list& propList = {});
5391
5389
----
5392
5390
_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#
5402
5400
via an instance of [code]#property_list#.
5403
5401
5404
5402
_Effects (2):_ Equivalent to `buffer(first, last, AllocatorT{}, propList)`.
5403
+
5405
5404
'''
5406
5405
5407
5406
.[apititle]#Construct sub-buffer#
@@ -5441,6 +5440,7 @@ a sub-buffer.
5441
5440
* An [code]#exception# with the [code]#errc::invalid# error code if the sum of
5442
5441
[code]#baseIndex# and [code]#subRange# in any dimension exceeds the parent
5443
5442
buffer [code]#b# size [code]#bufferRange# in that dimension.
5443
+
5444
5444
'''
5445
5445
5446
5446
@@ -5454,6 +5454,7 @@ range<Dimensions> get_range() const;
5454
5454
----
5455
5455
_Returns:_ A range object representing the size of the buffer in terms of number
5456
5456
of elements in each dimension as passed to the constructor.
5457
+
5457
5458
'''
5458
5459
5459
5460
.[apititle]#buffer::byte_size#
@@ -5463,6 +5464,7 @@ size_t byte_size() const noexcept;
5463
5464
----
5464
5465
_Returns:_ The size of the buffer storage in bytes.
5465
5466
Equal to [code]#size()*sizeof(T)#.
5467
+
5466
5468
'''
5467
5469
5468
5470
.[apititle]#buffer::size#
@@ -5473,6 +5475,7 @@ size_t size() const noexcept;
5473
5475
mode and target in the command group buffer.
5474
5476
The value of target can be [code]#target::device#,
5475
5477
[code]#target::constant_buffer# or [code]#target::host_task#.
5478
+
5476
5479
'''
5477
5480
5478
5481
.[apititle]#buffer::get_count#
@@ -5483,6 +5486,7 @@ size_t get_count() const;
5483
5486
Deprecated by SYCL 2020.
5484
5487
5485
5488
_Effects:_ Equivalent to [code]#return size()#.
5489
+
5486
5490
'''
5487
5491
5488
5492
.[apititle]#buffer::get_size#
@@ -5493,6 +5497,7 @@ size_t get_size() const;
5493
5497
Deprecated by SYCL 2020.
5494
5498
5495
5499
_Effects:_ Equivalent to [code]#return byte_size()#.
5500
+
5496
5501
'''
5497
5502
5498
5503
.[apititle]#buffer::get_allocator#
@@ -5501,24 +5506,25 @@ _Effects:_ Equivalent to [code]#return byte_size()#.
5501
5506
AllocatorT get_allocator() const;
5502
5507
----
5503
5508
_Returns:_ The allocator provided to the buffer.
5509
+
5504
5510
'''
5505
5511
5506
5512
.[apititle]#buffer::get_access#
5507
5513
[source,role=synopsis,id=api:buffer-get-access]
5508
5514
----
5509
5515
template <access_mode Mode = access_mode::read_write,
5510
5516
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)
5512
5518
5513
5519
template <access_mode Mode = access_mode::read_write,
5514
5520
target Targ = target::device>
5515
5521
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 = {});
5518
5524
5519
- template <typename... Ts> auto get_access(Ts...); (3)
5525
+ template <typename... Ts> auto get_access(Ts...); (3)
5520
5526
5521
- template <typename... Ts> auto get_host_access(Ts...); (4)
5527
+ template <typename... Ts> auto get_host_access(Ts...); (4)
5522
5528
----
5523
5529
_Returns (1):_ A valid [code]#accessor# to the buffer with the specified access
5524
5530
mode and target in the command group buffer.
@@ -5549,17 +5555,18 @@ Possible implementation:
5549
5555
_Throws (2):_ An [code]#exception# with the [code]#errc::invalid# error code if
5550
5556
the sum of [code]#accessRange# and [code]#accessOffset# exceeds the range of the
5551
5557
buffer in any dimension.
5558
+
5552
5559
'''
5553
5560
5554
5561
.[apititle]#Deprecated buffer::get_access#
5555
5562
[source,role=synopsis,id=api:buffer-get-access-deprecated]
5556
5563
----
5557
5564
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)
5559
5566
5560
5567
template <access_mode Mode>
5561
5568
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)
5563
5570
----
5564
5571
Deprecated in SYCL 2020.
5565
5572
Use [code]#get_host_access()# instead.
@@ -5576,6 +5583,7 @@ The value of target can only be [code]#target::host_buffer#.
5576
5583
_Throws (2):_ An [code]#exception# with the [code]#errc::invalid# error code if
5577
5584
the sum of [code]#accessRange# and [code]#accessOffset# exceeds the range of the
5578
5585
buffer in any dimension.
5586
+
5579
5587
'''
5580
5588
5581
5589
.[apititle]#buffer::set_final_data#
@@ -5598,6 +5606,7 @@ expired.
5598
5606
5599
5607
If [code]#Destination# is [code]#std::nullptr_t#, then the copy back will not
5600
5608
happen.
5609
+
5601
5610
'''
5602
5611
5603
5612
.[apititle]#buffer::set_write_back#
@@ -5612,6 +5621,7 @@ Forcing the write-back is similar to what happens during a normal write-back as
5612
5621
described in <<sec:buf-sync-rules>> and <<sec:sharing-host-memory-with-dm>>.
5613
5622
5614
5623
If there is nowhere to write-back, using this function does not have any effect.
5624
+
5615
5625
'''
5616
5626
5617
5627
.[apititle]#buffer::is_sub_buffer#
@@ -5621,16 +5631,23 @@ bool is_sub_buffer() const;
5621
5631
----
5622
5632
_Returns:_ [code]#true# if this SYCL [code]#buffer# is a sub-buffer and
5623
5633
[code]#false# otherwise.
5634
+
5624
5635
'''
5625
5636
5626
5637
.[apititle]#buffer::reinterpret#
5627
5638
[source,role=synopsis,id=api:buffer-reinterpret]
5628
5639
----
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)
5634
5651
----
5635
5652
_Preconditions (2):_ Available when [code]#(ReinterpretDim == 1)# or when
5636
5653
[code]#\((ReinterpretDim == Dimensions) && (sizeof(ReinterpretT) ==
@@ -5658,16 +5675,16 @@ represented by the type and range of this SYCL [code]#buffer# (or sub-buffer).
5658
5675
_Throws (2):_ An [code]#exception# with the [code]#errc::invalid# error code if
5659
5676
the total size in bytes represented by this SYCL [code]#buffer# (or sub-buffer)
5660
5677
is not evenly divisible by [code]#sizeof(ReinterpretT)#.
5678
+
5661
5679
'''
5662
5680
5663
5681
5664
5682
[[sec:buffer-properties]]
5665
- ==== Buffer properties
5683
+ ==== Properties
5666
5684
5667
5685
This section describes the properties that can be passed in the [code]#propList#
5668
5686
parameter of the <<sec:buffer-ctors, buffer constructors>>.
5669
5687
5670
-
5671
5688
'''
5672
5689
5673
5690
.[apidef]#property::buffer::use_host_ptr#
@@ -5785,7 +5802,7 @@ _Returns:_ The [code]#context# provided when constructing this property.
5785
5802
5786
5803
5787
5804
[[sec:buf-sync-rules]]
5788
- ==== Buffer destruction rules
5805
+ ==== Destruction rules
5789
5806
5790
5807
Buffers are reference-counted.
5791
5808
When a buffer value is constructed from another buffer, the two values reference
0 commit comments