Skip to content

Commit 39bad80

Browse files
authored
Merge pull request #722 from Pennycook/sampled-image-allocator
Add allocator functions to `sampled_image`
2 parents 2b1ebf3 + 7d8745e commit 39bad80

2 files changed

Lines changed: 171 additions & 0 deletions

File tree

adoc/chapters/programming_interface.adoc

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6619,6 +6619,36 @@ sampled_image(const void* hostPointer, image_format format,
66196619
[code]#sampled_image# via an instance of
66206620
[code]#property_list#.
66216621

6622+
a@
6623+
[source]
6624+
----
6625+
sampled_image(const void* hostPointer, image_format format,
6626+
image_sampler sampler,
6627+
const range<Dimensions>& rangeRef,
6628+
AllocatorT allocator,
6629+
const property_list& propList = {})
6630+
----
6631+
a@ Construct a SYCL [code]#sampled_image# instance with the
6632+
[code]#hostPointer# parameter provided. The [code]#sampled_image#
6633+
assumes exclusive access to this memory for the duration of its lifetime.
6634+
The host address is [code]#const#, so the host accesses must be
6635+
read-only. Since, the [code]#hostPointer# is [code]#const#, this image is only
6636+
initialized with this memory and there is no write after its
6637+
destruction.
6638+
The constructed SYCL [code]#sampled_image# will use the allocator
6639+
parameter provided when allocating memory on the host.
6640+
The element size of the constructed SYCL [code]#sampled_image#
6641+
will be derived from the [code]#format# parameter.
6642+
Accessors that read the constructed SYCL [code]#sampled_image# will
6643+
use the [code]#sampler# parameter to sample the image.
6644+
The range of the constructed SYCL [code]#sampled_image# is
6645+
specified by the [code]#rangeRef# parameter provided.
6646+
The pitch of the constructed SYCL [code]#sampled_image# will be
6647+
the default size determined by the <<sycl-runtime>>.
6648+
Zero or more properties can be provided to the constructed SYCL
6649+
[code]#sampled_image# via an instance of
6650+
[code]#property_list#.
6651+
66226652
a@
66236653
[source]
66246654
----
@@ -6649,6 +6679,39 @@ Zero or more properties can be provided to the constructed SYCL
66496679
[code]#sampled_image# via an instance of
66506680
[code]#property_list#.
66516681

6682+
a@
6683+
[source]
6684+
----
6685+
sampled_image(const void* hostPointer, image_format format,
6686+
image_sampler sampler,
6687+
const range<Dimensions>& rangeRef,
6688+
const range<Dimensions - 1>& pitch,
6689+
AllocatorT allocator,
6690+
const property_list& propList = {})
6691+
----
6692+
a@ Available only when: [code]#Dimensions > 1#.
6693+
6694+
Construct a SYCL [code]#sampled_image# instance with the [code]#hostPointer#
6695+
parameter provided. The [code]#sampled_image# assumes exclusive access to this
6696+
memory for the duration of its lifetime.
6697+
The host address is [code]#const#, so the host accesses must be
6698+
read-only. Since, the [code]#hostPointer# is [code]#const#, this
6699+
image is only initialized with this memory and there is no write after
6700+
destruction.
6701+
The constructed SYCL [code]#sampled_image# will use the allocator
6702+
parameter provided when allocating memory on the host.
6703+
The element size of the constructed SYCL [code]#sampled_image#
6704+
will be derived from the [code]#format# parameter.
6705+
Accessors that read the constructed SYCL [code]#sampled_image# will
6706+
use the [code]#sampler# parameter to sample the image.
6707+
The range of the constructed SYCL [code]#sampled_image# is
6708+
specified by the [code]#rangeRef# parameter provided.
6709+
The pitch of the constructed SYCL [code]#sampled_image# will be
6710+
the [code]#pitch# parameter provided.
6711+
Zero or more properties can be provided to the constructed SYCL
6712+
[code]#sampled_image# via an instance of
6713+
[code]#property_list#.
6714+
66526715
a@
66536716
[source]
66546717
----
@@ -6685,6 +6748,82 @@ Zero or more properties can be provided to the constructed SYCL
66856748
[code]#sampled_image# via an instance of
66866749
[code]#property_list#.
66876750

6751+
a@
6752+
[source]
6753+
----
6754+
sampled_image(std::shared_ptr<const void>& hostPointer,
6755+
image_format format,
6756+
image_sampler sampler,
6757+
const range<Dimensions>& rangeRef,
6758+
AllocatorT allocator,
6759+
const property_list& propList = {})
6760+
----
6761+
a@ When [code]#hostPointer# is not empty, construct a SYCL
6762+
[code]#sampled_image# with the contents of its stored pointer. The
6763+
[code]#sampled_image# assumes exclusive access to this memory for the
6764+
duration of its lifetime. The [code]#sampled_image# also creates its
6765+
own internal copy of the [code]#shared_ptr# that shares ownership of the
6766+
[code]#hostData# memory, which means the application can safely release
6767+
ownership of this [code]#shared_ptr# when the constructor returns.
6768+
6769+
When [code]#hostPointer# is empty, construct a SYCL [code]#sampled_image#
6770+
with uninitialized memory.
6771+
6772+
The host address is [code]#const#, so the host accesses must be
6773+
read-only. Since, the [code]#hostPointer# is [code]#const#, this image is only
6774+
initialized with this memory and there is no write after its
6775+
destruction.
6776+
The constructed SYCL [code]#sampled_image# will use the allocator
6777+
parameter provided when allocating memory on the host.
6778+
The element size of the constructed SYCL [code]#sampled_image#
6779+
will be derived from the [code]#format# parameter.
6780+
Accessors that read the constructed SYCL [code]#sampled_image# will
6781+
use the [code]#sampler# parameter to sample the image.
6782+
The range of the constructed SYCL [code]#sampled_image# is
6783+
specified by the [code]#rangeRef# parameter provided.
6784+
The pitch of the constructed SYCL [code]#sampled_image# will be
6785+
the default size determined by the <<sycl-runtime>>.
6786+
Zero or more properties can be provided to the constructed SYCL
6787+
[code]#sampled_image# via an instance of
6788+
[code]#property_list#.
6789+
6790+
a@
6791+
[source]
6792+
----
6793+
sampled_image(std::shared_ptr<const void>& hostPointer,
6794+
image_format format,
6795+
image_sampler sampler,
6796+
const range<Dimensions>& rangeRef,
6797+
const range<Dimensions - 1>& pitch,
6798+
const property_list& propList = {})
6799+
----
6800+
a@ When [code]#hostPointer# is not empty, construct a SYCL
6801+
[code]#sampled_image# with the contents of its stored pointer. The
6802+
[code]#sampled_image# assumes exclusive access to this memory for the
6803+
duration of its lifetime. The [code]#sampled_image# also creates its
6804+
own internal copy of the [code]#shared_ptr# that shares ownership of the
6805+
[code]#hostData# memory, which means the application can safely release
6806+
ownership of this [code]#shared_ptr# when the constructor returns.
6807+
6808+
When [code]#hostPointer# is empty, construct a SYCL [code]#sampled_image#
6809+
with uninitialized memory.
6810+
6811+
The host address is [code]#const#, so the host accesses can be
6812+
read-only. Since, the [code]#hostPointer# is [code]#const#, this image is only
6813+
initialized with this memory and there is no write after its
6814+
destruction.
6815+
The element size of the constructed SYCL [code]#sampled_image#
6816+
will be derived from the [code]#format# parameter.
6817+
Accessors that read the constructed SYCL [code]#sampled_image# will
6818+
use the [code]#sampler# parameter to sample the image.
6819+
The range of the constructed SYCL [code]#sampled_image# is
6820+
specified by the [code]#rangeRef# parameter provided.
6821+
The pitch of the constructed SYCL [code]#sampled_image# will be
6822+
the [code]#pitch# parameter provided.
6823+
Zero or more properties can be provided to the constructed SYCL
6824+
[code]#sampled_image# via an instance of
6825+
[code]#property_list#.
6826+
66886827
a@
66896828
[source]
66906829
----
@@ -6693,6 +6832,7 @@ sampled_image(std::shared_ptr<const void>& hostPointer,
66936832
image_sampler sampler,
66946833
const range<Dimensions>& rangeRef,
66956834
const range<Dimensions - 1>& pitch,
6835+
AllocatorT allocator,
66966836
const property_list& propList = {})
66976837
----
66986838
a@ When [code]#hostPointer# is not empty, construct a SYCL
@@ -6710,6 +6850,8 @@ The host address is [code]#const#, so the host accesses can be
67106850
read-only. Since, the [code]#hostPointer# is [code]#const#, this image is only
67116851
initialized with this memory and there is no write after its
67126852
destruction.
6853+
The constructed SYCL [code]#sampled_image# will use the allocator
6854+
parameter provided when allocating memory on the host.
67136855
The element size of the constructed SYCL [code]#sampled_image#
67146856
will be derived from the [code]#format# parameter.
67156857
Accessors that read the constructed SYCL [code]#sampled_image# will
@@ -6769,6 +6911,13 @@ std::size_t byte_size() const noexcept
67696911
due to padding of elements, rows and slices of the image for
67706912
efficient access.
67716913

6914+
a@
6915+
[source]
6916+
----
6917+
AllocatorT get_allocator() const
6918+
----
6919+
a@ Returns the allocator provided to the image.
6920+
67726921
a@
67736922
[source]
67746923
----

adoc/headers/sampledImage.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,42 @@ class sampled_image {
2424
image_sampler sampler, const range<Dimensions>& rangeRef,
2525
const property_list& propList = {});
2626

27+
sampled_image(const void* hostPointer, image_format format,
28+
image_sampler sampler, const range<Dimensions>& rangeRef,
29+
AllocatorT allocator, const property_list& propList = {});
30+
2731
/* Available only when: Dimensions > 1 */
2832
sampled_image(const void* hostPointer, image_format format,
2933
image_sampler sampler, const range<Dimensions>& rangeRef,
3034
const range<Dimensions - 1>& pitch,
3135
const property_list& propList = {});
3236

37+
/* Available only when: Dimensions > 1 */
38+
sampled_image(const void* hostPointer, image_format format,
39+
image_sampler sampler, const range<Dimensions>& rangeRef,
40+
const range<Dimensions - 1>& pitch, AllocatorT allocator,
41+
const property_list& propList = {});
42+
3343
sampled_image(std::shared_ptr<const void>& hostPointer, image_format format,
3444
image_sampler sampler, const range<Dimensions>& rangeRef,
3545
const property_list& propList = {});
3646

47+
sampled_image(std::shared_ptr<const void>& hostPointer, image_format format,
48+
image_sampler sampler, const range<Dimensions>& rangeRef,
49+
AllocatorT allocator, const property_list& propList = {});
50+
3751
/* Available only when: Dimensions > 1 */
3852
sampled_image(std::shared_ptr<const void>& hostPointer, image_format format,
3953
image_sampler sampler, const range<Dimensions>& rangeRef,
4054
const range<Dimensions - 1>& pitch,
4155
const property_list& propList = {});
4256

57+
/* Available only when: Dimensions > 1 */
58+
sampled_image(std::shared_ptr<const void>& hostPointer, image_format format,
59+
image_sampler sampler, const range<Dimensions>& rangeRef,
60+
const range<Dimensions - 1>& pitch,
61+
AllocatorT allocator, const property_list& propList = {});
62+
4363
/* -- common interface members -- */
4464

4565
/* -- property interface members -- */
@@ -53,6 +73,8 @@ class sampled_image {
5373

5474
std::size_t size() const noexcept;
5575

76+
AllocatorT get_allocator() const;
77+
5678
template <typename DataT, image_target Targ = image_target::device>
5779
sampled_image_accessor<DataT, Dimensions, Targ>
5880
get_access(handler& commandGroupHandler, const property_list& propList = {});

0 commit comments

Comments
 (0)