Skip to content

Commit 9b44a1d

Browse files
committed
This should presumably fix gcc 7.5 build
1 parent 34f3dfc commit 9b44a1d

File tree

5 files changed

+181
-150
lines changed

5 files changed

+181
-150
lines changed

sycl/include/sycl/accessor_image.hpp

Lines changed: 1 addition & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <sycl/accessor.hpp>
4+
#include <sycl/accessor_image_base.hpp>
45
#include <sycl/detail/image_accessor_util.hpp>
56
#include <sycl/device.hpp>
67
#include <sycl/image.hpp>
@@ -61,156 +62,11 @@ void __SYCL_EXPORT sampledImageConstructorNotification(
6162
const std::optional<image_target> &Target, const void *Type,
6263
uint32_t ElemSize, const code_location &CodeLoc);
6364

64-
class UnsampledImageAccessorImplHost;
65-
class SampledImageAccessorImplHost;
66-
using UnsampledImageAccessorImplPtr =
67-
std::shared_ptr<UnsampledImageAccessorImplHost>;
68-
using SampledImageAccessorImplPtr =
69-
std::shared_ptr<SampledImageAccessorImplHost>;
70-
7165
void __SYCL_EXPORT
7266
addHostUnsampledImageAccessorAndWait(UnsampledImageAccessorImplHost *Req);
7367
void __SYCL_EXPORT
7468
addHostSampledImageAccessorAndWait(SampledImageAccessorImplHost *Req);
7569

76-
class __SYCL_EXPORT UnsampledImageAccessorBaseHost {
77-
protected:
78-
UnsampledImageAccessorBaseHost(const UnsampledImageAccessorImplPtr &Impl)
79-
: impl{Impl} {}
80-
81-
public:
82-
UnsampledImageAccessorBaseHost(sycl::range<3> Size, access_mode AccessMode,
83-
void *SYCLMemObject, int Dims, int ElemSize,
84-
id<3> Pitch, image_channel_type ChannelType,
85-
image_channel_order ChannelOrder,
86-
const property_list &PropertyList = {});
87-
const sycl::range<3> &getSize() const;
88-
void *getMemoryObject() const;
89-
detail::AccHostDataT &getAccData();
90-
void *getPtr();
91-
void *getPtr() const;
92-
int getNumOfDims() const;
93-
int getElementSize() const;
94-
id<3> getPitch() const;
95-
image_channel_type getChannelType() const;
96-
image_channel_order getChannelOrder() const;
97-
const property_list &getPropList() const;
98-
99-
protected:
100-
template <class Obj>
101-
friend const decltype(Obj::impl) &
102-
detail::getSyclObjImpl(const Obj &SyclObject);
103-
104-
template <class T>
105-
friend T detail::createSyclObjFromImpl(
106-
std::add_rvalue_reference_t<decltype(T::impl)> ImplObj);
107-
108-
template <class T>
109-
friend T detail::createSyclObjFromImpl(
110-
std::add_lvalue_reference_t<const decltype(T::impl)> ImplObj);
111-
112-
UnsampledImageAccessorImplPtr impl;
113-
114-
// The function references helper methods required by GDB pretty-printers
115-
void GDBMethodsAnchor() {
116-
#ifndef NDEBUG
117-
const auto *this_const = this;
118-
(void)getSize();
119-
(void)this_const->getSize();
120-
(void)getPtr();
121-
(void)this_const->getPtr();
122-
#endif
123-
}
124-
125-
#ifndef __SYCL_DEVICE_ONLY__
126-
// Reads a pixel of the underlying image at the specified coordinate. It is
127-
// the responsibility of the caller to ensure that the coordinate type is
128-
// valid.
129-
template <typename DataT, typename CoordT>
130-
DataT read(const CoordT &Coords) const noexcept {
131-
image_sampler Smpl{addressing_mode::none,
132-
coordinate_normalization_mode::unnormalized,
133-
filtering_mode::nearest};
134-
return imageReadSamplerHostImpl<CoordT, DataT>(
135-
Coords, Smpl, getSize(), getPitch(), getChannelType(),
136-
getChannelOrder(), getPtr(), getElementSize());
137-
}
138-
139-
// Writes to a pixel of the underlying image at the specified coordinate. It
140-
// is the responsibility of the caller to ensure that the coordinate type is
141-
// valid.
142-
template <typename DataT, typename CoordT>
143-
void write(const CoordT &Coords, const DataT &Color) const {
144-
imageWriteHostImpl(Coords, Color, getPitch(), getElementSize(),
145-
getChannelType(), getChannelOrder(), getPtr());
146-
}
147-
#endif
148-
};
149-
150-
class __SYCL_EXPORT SampledImageAccessorBaseHost {
151-
protected:
152-
SampledImageAccessorBaseHost(const SampledImageAccessorImplPtr &Impl)
153-
: impl{Impl} {}
154-
155-
public:
156-
SampledImageAccessorBaseHost(sycl::range<3> Size, void *SYCLMemObject,
157-
int Dims, int ElemSize, id<3> Pitch,
158-
image_channel_type ChannelType,
159-
image_channel_order ChannelOrder,
160-
image_sampler Sampler,
161-
const property_list &PropertyList = {});
162-
const sycl::range<3> &getSize() const;
163-
void *getMemoryObject() const;
164-
detail::AccHostDataT &getAccData();
165-
void *getPtr();
166-
void *getPtr() const;
167-
int getNumOfDims() const;
168-
int getElementSize() const;
169-
id<3> getPitch() const;
170-
image_channel_type getChannelType() const;
171-
image_channel_order getChannelOrder() const;
172-
image_sampler getSampler() const;
173-
const property_list &getPropList() const;
174-
175-
protected:
176-
template <class Obj>
177-
friend const decltype(Obj::impl) &
178-
detail::getSyclObjImpl(const Obj &SyclObject);
179-
180-
template <class T>
181-
friend T detail::createSyclObjFromImpl(
182-
std::add_rvalue_reference_t<decltype(T::impl)> ImplObj);
183-
184-
template <class T>
185-
friend T detail::createSyclObjFromImpl(
186-
std::add_lvalue_reference_t<const decltype(T::impl)> ImplObj);
187-
188-
SampledImageAccessorImplPtr impl;
189-
190-
// The function references helper methods required by GDB pretty-printers
191-
void GDBMethodsAnchor() {
192-
#ifndef NDEBUG
193-
const auto *this_const = this;
194-
(void)getSize();
195-
(void)this_const->getSize();
196-
(void)getPtr();
197-
(void)this_const->getPtr();
198-
#endif
199-
}
200-
201-
#ifndef __SYCL_DEVICE_ONLY__
202-
// Reads a pixel of the underlying image at the specified coordinate. It is
203-
// the responsibility of the caller to ensure that the coordinate type is
204-
// valid.
205-
template <typename DataT, typename CoordT>
206-
DataT read(const CoordT &Coords) const {
207-
return imageReadSamplerHostImpl<CoordT, DataT>(
208-
Coords, getSampler(), getSize(), getPitch(), getChannelType(),
209-
getChannelOrder(), getPtr(), getElementSize());
210-
}
211-
#endif
212-
};
213-
21470
template <typename DataT, int Dimensions, access::mode AccessMode,
21571
access::placeholder IsPlaceholder>
21672
class __image_array_slice__;
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
//==--------------------- accessor_image_base.hpp --------------------------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#pragma once
10+
11+
#include <sycl/detail/image_accessor_util.hpp>
12+
#include <sycl/id.hpp>
13+
#include <sycl/image.hpp>
14+
#include <sycl/property_list.hpp>
15+
#include <sycl/range.hpp>
16+
17+
#include <type_traits>
18+
19+
namespace sycl {
20+
inline namespace _V1 {
21+
namespace detail {
22+
23+
struct AccHostDataT;
24+
25+
class UnsampledImageAccessorImplHost;
26+
class SampledImageAccessorImplHost;
27+
using UnsampledImageAccessorImplPtr =
28+
std::shared_ptr<UnsampledImageAccessorImplHost>;
29+
using SampledImageAccessorImplPtr =
30+
std::shared_ptr<SampledImageAccessorImplHost>;
31+
32+
class __SYCL_EXPORT UnsampledImageAccessorBaseHost {
33+
protected:
34+
UnsampledImageAccessorBaseHost(const UnsampledImageAccessorImplPtr &Impl)
35+
: impl{Impl} {}
36+
37+
public:
38+
UnsampledImageAccessorBaseHost(sycl::range<3> Size, access_mode AccessMode,
39+
void *SYCLMemObject, int Dims, int ElemSize,
40+
id<3> Pitch, image_channel_type ChannelType,
41+
image_channel_order ChannelOrder,
42+
const property_list &PropertyList = {});
43+
const sycl::range<3> &getSize() const;
44+
void *getMemoryObject() const;
45+
detail::AccHostDataT &getAccData();
46+
void *getPtr();
47+
void *getPtr() const;
48+
int getNumOfDims() const;
49+
int getElementSize() const;
50+
id<3> getPitch() const;
51+
image_channel_type getChannelType() const;
52+
image_channel_order getChannelOrder() const;
53+
const property_list &getPropList() const;
54+
55+
protected:
56+
template <class Obj>
57+
friend const decltype(Obj::impl) &
58+
detail::getSyclObjImpl(const Obj &SyclObject);
59+
60+
template <class T>
61+
friend T detail::createSyclObjFromImpl(
62+
std::add_rvalue_reference_t<decltype(T::impl)> ImplObj);
63+
64+
template <class T>
65+
friend T detail::createSyclObjFromImpl(
66+
std::add_lvalue_reference_t<const decltype(T::impl)> ImplObj);
67+
68+
UnsampledImageAccessorImplPtr impl;
69+
70+
// The function references helper methods required by GDB pretty-printers
71+
void GDBMethodsAnchor() {
72+
#ifndef NDEBUG
73+
const auto *this_const = this;
74+
(void)getSize();
75+
(void)this_const->getSize();
76+
(void)getPtr();
77+
(void)this_const->getPtr();
78+
#endif
79+
}
80+
81+
#ifndef __SYCL_DEVICE_ONLY__
82+
// Reads a pixel of the underlying image at the specified coordinate. It is
83+
// the responsibility of the caller to ensure that the coordinate type is
84+
// valid.
85+
template <typename DataT, typename CoordT>
86+
DataT read(const CoordT &Coords) const noexcept {
87+
image_sampler Smpl{addressing_mode::none,
88+
coordinate_normalization_mode::unnormalized,
89+
filtering_mode::nearest};
90+
return imageReadSamplerHostImpl<CoordT, DataT>(
91+
Coords, Smpl, getSize(), getPitch(), getChannelType(),
92+
getChannelOrder(), getPtr(), getElementSize());
93+
}
94+
95+
// Writes to a pixel of the underlying image at the specified coordinate. It
96+
// is the responsibility of the caller to ensure that the coordinate type is
97+
// valid.
98+
template <typename DataT, typename CoordT>
99+
void write(const CoordT &Coords, const DataT &Color) const {
100+
imageWriteHostImpl(Coords, Color, getPitch(), getElementSize(),
101+
getChannelType(), getChannelOrder(), getPtr());
102+
}
103+
#endif
104+
};
105+
106+
class __SYCL_EXPORT SampledImageAccessorBaseHost {
107+
protected:
108+
SampledImageAccessorBaseHost(const SampledImageAccessorImplPtr &Impl)
109+
: impl{Impl} {}
110+
111+
public:
112+
SampledImageAccessorBaseHost(sycl::range<3> Size, void *SYCLMemObject,
113+
int Dims, int ElemSize, id<3> Pitch,
114+
image_channel_type ChannelType,
115+
image_channel_order ChannelOrder,
116+
image_sampler Sampler,
117+
const property_list &PropertyList = {});
118+
const sycl::range<3> &getSize() const;
119+
void *getMemoryObject() const;
120+
detail::AccHostDataT &getAccData();
121+
void *getPtr();
122+
void *getPtr() const;
123+
int getNumOfDims() const;
124+
int getElementSize() const;
125+
id<3> getPitch() const;
126+
image_channel_type getChannelType() const;
127+
image_channel_order getChannelOrder() const;
128+
image_sampler getSampler() const;
129+
const property_list &getPropList() const;
130+
131+
protected:
132+
template <class Obj>
133+
friend const decltype(Obj::impl) &
134+
detail::getSyclObjImpl(const Obj &SyclObject);
135+
136+
template <class T>
137+
friend T detail::createSyclObjFromImpl(
138+
std::add_rvalue_reference_t<decltype(T::impl)> ImplObj);
139+
140+
template <class T>
141+
friend T detail::createSyclObjFromImpl(
142+
std::add_lvalue_reference_t<const decltype(T::impl)> ImplObj);
143+
144+
SampledImageAccessorImplPtr impl;
145+
146+
// The function references helper methods required by GDB pretty-printers
147+
void GDBMethodsAnchor() {
148+
#ifndef NDEBUG
149+
const auto *this_const = this;
150+
(void)getSize();
151+
(void)this_const->getSize();
152+
(void)getPtr();
153+
(void)this_const->getPtr();
154+
#endif
155+
}
156+
157+
#ifndef __SYCL_DEVICE_ONLY__
158+
// Reads a pixel of the underlying image at the specified coordinate. It is
159+
// the responsibility of the caller to ensure that the coordinate type is
160+
// valid.
161+
template <typename DataT, typename CoordT>
162+
DataT read(const CoordT &Coords) const {
163+
return imageReadSamplerHostImpl<CoordT, DataT>(
164+
Coords, getSampler(), getSize(), getPitch(), getChannelType(),
165+
getChannelOrder(), getPtr(), getElementSize());
166+
}
167+
#endif
168+
};
169+
170+
} // namespace detail
171+
} // namespace _V1
172+
} // namespace sycl

sycl/source/detail/accessor_impl.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ void addHostAccessorAndWait(Requirement *Req) {
3939
Event->wait();
4040
}
4141

42-
void addHostUnsampledImageAccessorAndWait(UnsampledImageAccessorImplHost *Req) {
42+
void __SYCL_EXPORT
43+
addHostUnsampledImageAccessorAndWait(UnsampledImageAccessorImplHost *Req) {
4344
addHostAccessorAndWait(Req);
4445
}
4546

46-
void addHostSampledImageAccessorAndWait(SampledImageAccessorImplHost *Req) {
47+
void __SYCL_EXPORT
48+
addHostSampledImageAccessorAndWait(SampledImageAccessorImplHost *Req) {
4749
addHostAccessorAndWait(Req);
4850
}
4951

@@ -55,7 +57,7 @@ void constructorNotification(void *BufferObj, void *AccessorObj,
5557
BufferObj, AccessorObj, (uint32_t)Target, (uint32_t)Mode, CodeLoc);
5658
}
5759

58-
void unsampledImageConstructorNotification(
60+
void __SYCL_EXPORT unsampledImageConstructorNotification(
5961
void *ImageObj, void *AccessorObj,
6062
const std::optional<image_target> &Target, access::mode Mode,
6163
const void *Type, uint32_t ElemSize, const code_location &CodeLoc) {
@@ -68,7 +70,7 @@ void unsampledImageConstructorNotification(
6870
ImageObj, AccessorObj, (uint32_t)Mode, Type, ElemSize, CodeLoc);
6971
}
7072

71-
void sampledImageConstructorNotification(
73+
void __SYCL_EXPORT sampledImageConstructorNotification(
7274
void *ImageObj, void *AccessorObj,
7375
const std::optional<image_target> &Target, const void *Type,
7476
uint32_t ElemSize, const code_location &CodeLoc) {

sycl/source/detail/accessor_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
#include <sycl/access/access.hpp>
1212
#include <sycl/accessor.hpp>
13-
#include <sycl/accessor_image.hpp>
1413
#include <sycl/detail/export.hpp>
1514
#include <sycl/id.hpp>
15+
#include <sycl/image.hpp>
1616
#include <sycl/property_list.hpp>
1717
#include <sycl/range.hpp>
1818

sycl/source/handler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <detail/scheduler/scheduler.hpp>
2828
#include <detail/ur_info_code.hpp>
2929
#include <detail/usm/usm_impl.hpp>
30+
#include <sycl/accessor_image_base.hpp>
3031
#include <sycl/detail/common.hpp>
3132
#include <sycl/detail/helpers.hpp>
3233
#include <sycl/detail/kernel_desc.hpp>

0 commit comments

Comments
 (0)