Skip to content

Commit 88fab25

Browse files
authored
[SYCL] Allow for local/image accessor to accept property_list (#3129)
Signed-off-by: mdimakov <maxim.dimakov@intel.com>
1 parent 43f711e commit 88fab25

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

sycl/include/CL/sycl/accessor.hpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,18 @@ class accessor<DataT, Dimensions, AccessMode, access::target::local,
18561856
}
18571857
#endif
18581858

1859+
template <int Dims = Dimensions, typename = detail::enable_if_t<Dims == 0>>
1860+
accessor(handler &, const property_list &propList)
1861+
#ifdef __SYCL_DEVICE_ONLY__
1862+
: impl(range<AdjustedDim>{1}) {
1863+
(void)propList;
1864+
}
1865+
#else
1866+
: LocalAccessorBaseHost(range<3>{1, 1, 1}, AdjustedDim, sizeof(DataT)) {
1867+
(void)propList;
1868+
}
1869+
#endif
1870+
18591871
template <int Dims = Dimensions, typename = detail::enable_if_t<(Dims > 0)>>
18601872
accessor(range<Dimensions> AllocationSize, handler &)
18611873
#ifdef __SYCL_DEVICE_ONLY__
@@ -1867,6 +1879,20 @@ class accessor<DataT, Dimensions, AccessMode, access::target::local,
18671879
}
18681880
#endif
18691881

1882+
template <int Dims = Dimensions, typename = detail::enable_if_t<(Dims > 0)>>
1883+
accessor(range<Dimensions> AllocationSize, handler &,
1884+
const property_list &propList)
1885+
#ifdef __SYCL_DEVICE_ONLY__
1886+
: impl(AllocationSize) {
1887+
(void)propList;
1888+
}
1889+
#else
1890+
: LocalAccessorBaseHost(detail::convertToArrayOfN<3, 1>(AllocationSize),
1891+
AdjustedDim, sizeof(DataT)) {
1892+
(void)propList;
1893+
}
1894+
#endif
1895+
18701896
size_t get_size() const { return getSize().size() * sizeof(DataT); }
18711897

18721898
size_t get_count() const { return getSize().size(); }
@@ -1954,6 +1980,20 @@ class accessor<DataT, Dimensions, AccessMode, access::target::image,
19541980
#ifndef __SYCL_DEVICE_ONLY__
19551981
detail::associateWithHandler(CommandGroupHandler, this,
19561982
access::target::image);
1983+
#endif
1984+
}
1985+
1986+
template <typename AllocatorT>
1987+
accessor(cl::sycl::image<Dimensions, AllocatorT> &Image,
1988+
handler &CommandGroupHandler, const property_list &propList)
1989+
: detail::image_accessor<DataT, Dimensions, AccessMode,
1990+
access::target::image, IsPlaceholder>(
1991+
Image, CommandGroupHandler,
1992+
(detail::getSyclObjImpl(Image))->getElementSize()) {
1993+
(void)propList;
1994+
#ifndef __SYCL_DEVICE_ONLY__
1995+
detail::associateWithHandler(CommandGroupHandler, this,
1996+
access::target::image);
19571997
#endif
19581998
}
19591999
#ifdef __SYCL_DEVICE_ONLY__
@@ -1994,6 +2034,15 @@ class accessor<DataT, Dimensions, AccessMode, access::target::host_image,
19942034
: detail::image_accessor<DataT, Dimensions, AccessMode,
19952035
access::target::host_image, IsPlaceholder>(
19962036
Image, (detail::getSyclObjImpl(Image))->getElementSize()) {}
2037+
2038+
template <typename AllocatorT>
2039+
accessor(cl::sycl::image<Dimensions, AllocatorT> &Image,
2040+
const property_list &propList)
2041+
: detail::image_accessor<DataT, Dimensions, AccessMode,
2042+
access::target::host_image, IsPlaceholder>(
2043+
Image, (detail::getSyclObjImpl(Image))->getElementSize()) {
2044+
(void)propList;
2045+
}
19972046
};
19982047

19992048
/// Image array accessor.
@@ -2041,6 +2090,20 @@ class accessor<DataT, Dimensions, AccessMode, access::target::image_array,
20412090
#endif
20422091
}
20432092

2093+
template <typename AllocatorT>
2094+
accessor(cl::sycl::image<Dimensions + 1, AllocatorT> &Image,
2095+
handler &CommandGroupHandler, const property_list &propList)
2096+
: detail::image_accessor<DataT, Dimensions + 1, AccessMode,
2097+
access::target::image, IsPlaceholder>(
2098+
Image, CommandGroupHandler,
2099+
(detail::getSyclObjImpl(Image))->getElementSize()) {
2100+
(void)propList;
2101+
#ifndef __SYCL_DEVICE_ONLY__
2102+
detail::associateWithHandler(CommandGroupHandler, this,
2103+
access::target::image_array);
2104+
#endif
2105+
}
2106+
20442107
detail::__image_array_slice__<DataT, Dimensions, AccessMode, IsPlaceholder>
20452108
operator[](size_t Index) const {
20462109
return detail::__image_array_slice__<DataT, Dimensions, AccessMode,

0 commit comments

Comments
 (0)