1919#include < sycl/detail/handler_proxy.hpp>
2020#include < sycl/detail/image_accessor_util.hpp>
2121#include < sycl/detail/image_ocl_types.hpp>
22+ #include < sycl/device.hpp>
2223#include < sycl/exception.hpp>
2324#include < sycl/ext/oneapi/accessor_property_list.hpp>
2425#include < sycl/id.hpp>
2526#include < sycl/image.hpp>
2627#include < sycl/pointers.hpp>
2728#include < sycl/properties/accessor_properties.hpp>
29+ #include < sycl/properties/buffer_properties.hpp>
2830#include < sycl/property_list.hpp>
2931#include < sycl/property_list_conversion.hpp>
3032#include < sycl/sampler.hpp>
@@ -264,20 +266,6 @@ template <> struct IsCxPropertyList<ext::oneapi::accessor_property_list<>> {
264266 constexpr static bool value = false ;
265267};
266268
267- // The function extends or truncates number of dimensions of objects of id
268- // or ranges classes. When extending the new values are filled with
269- // DefaultValue, truncation just removes extra values.
270- template <int NewDim, int DefaultValue, template <int > class T , int OldDim>
271- static T<NewDim> convertToArrayOfN (T<OldDim> OldObj) {
272- T<NewDim> NewObj = InitializedVal<NewDim, T>::template get<0 >();
273- const int CopyDims = NewDim > OldDim ? OldDim : NewDim;
274- for (int I = 0 ; I < CopyDims; ++I)
275- NewObj[I] = OldObj[I];
276- for (int I = CopyDims; I < NewDim; ++I)
277- NewObj[I] = DefaultValue;
278- return NewObj;
279- }
280-
281269__SYCL_EXPORT device getDeviceFromHandler (handler &CommandGroupHandlerRef);
282270
283271template <typename DataT, int Dimensions, access::mode AccessMode,
@@ -526,15 +514,14 @@ class image_accessor
526514 // host.
527515 }
528516#else
529- : AccessorBaseHost ({detail::getSyclObjImpl (ImageRef)->getRowPitch (),
530- detail::getSyclObjImpl (ImageRef)->getSlicePitch (), 0 },
517+ : AccessorBaseHost ({ImageRef.getRowPitch (), ImageRef.getSlicePitch (), 0 },
531518 detail::convertToArrayOfN<3 , 1 >(ImageRef.get_range ()),
532519 detail::convertToArrayOfN<3 , 1 >(ImageRef.get_range ()),
533520 AccessMode, detail::getSyclObjImpl (ImageRef).get (),
534521 Dimensions, ImageElementSize),
535522 MImageCount (ImageRef.size ()),
536- MImgChannelOrder (detail::getSyclObjImpl ( ImageRef)-> getChannelOrder ()),
537- MImgChannelType (detail::getSyclObjImpl ( ImageRef)-> getChannelType ()) {
523+ MImgChannelOrder (ImageRef. getChannelOrder ()),
524+ MImgChannelType (ImageRef. getChannelType ()) {
538525 addHostAccessorAndWait (AccessorBaseHost::impl.get ());
539526 }
540527#endif
@@ -557,15 +544,14 @@ class image_accessor
557544 // host.
558545 }
559546#else
560- : AccessorBaseHost ({detail::getSyclObjImpl (ImageRef)->getRowPitch (),
561- detail::getSyclObjImpl (ImageRef)->getSlicePitch (), 0 },
547+ : AccessorBaseHost ({ImageRef.getRowPitch (), ImageRef.getSlicePitch (), 0 },
562548 detail::convertToArrayOfN<3 , 1 >(ImageRef.get_range ()),
563549 detail::convertToArrayOfN<3 , 1 >(ImageRef.get_range ()),
564550 AccessMode, detail::getSyclObjImpl (ImageRef).get (),
565551 Dimensions, ImageElementSize),
566552 MImageCount (ImageRef.size ()),
567- MImgChannelOrder (detail::getSyclObjImpl ( ImageRef)-> getChannelOrder ()),
568- MImgChannelType (detail::getSyclObjImpl ( ImageRef)-> getChannelType ()) {
553+ MImgChannelOrder (ImageRef. getChannelOrder ()),
554+ MImgChannelType (ImageRef. getChannelType ()) {
569555 checkDeviceFeatureSupported<info::device::image_support>(
570556 getDeviceFromHandler (CommandGroupHandlerRef));
571557 }
@@ -1203,7 +1189,7 @@ class __SYCL_SPECIAL_CLASS accessor :
12031189 const property_list &PropertyList = {},
12041190 const detail::code_location CodeLoc = detail::code_location::current ())
12051191 : accessor (BufferRef, PropertyList, CodeLoc) {
1206- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1192+ adjustAccPropsInBuf (BufferRef);
12071193 }
12081194
12091195 template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1218,7 +1204,7 @@ class __SYCL_SPECIAL_CLASS accessor :
12181204 {},
12191205 const detail::code_location CodeLoc = detail::code_location::current ())
12201206 : accessor (BufferRef, PropertyList, CodeLoc) {
1221- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1207+ adjustAccPropsInBuf (BufferRef);
12221208 }
12231209#endif
12241210
@@ -1297,7 +1283,7 @@ class __SYCL_SPECIAL_CLASS accessor :
12971283 TagT, const property_list &PropertyList = {},
12981284 const detail::code_location CodeLoc = detail::code_location::current ())
12991285 : accessor (BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {
1300- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1286+ adjustAccPropsInBuf (BufferRef);
13011287 }
13021288
13031289 template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1313,7 +1299,7 @@ class __SYCL_SPECIAL_CLASS accessor :
13131299 {},
13141300 const detail::code_location CodeLoc = detail::code_location::current ())
13151301 : accessor (BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {
1316- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1302+ adjustAccPropsInBuf (BufferRef);
13171303 }
13181304
13191305#endif
@@ -1357,7 +1343,7 @@ class __SYCL_SPECIAL_CLASS accessor :
13571343 TagT, const property_list &PropertyList = {},
13581344 const detail::code_location CodeLoc = detail::code_location::current ())
13591345 : accessor (BufferRef, AccessRange, {}, PropertyList, CodeLoc) {
1360- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1346+ adjustAccPropsInBuf (BufferRef);
13611347 }
13621348
13631349 template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1373,7 +1359,7 @@ class __SYCL_SPECIAL_CLASS accessor :
13731359 {},
13741360 const detail::code_location CodeLoc = detail::code_location::current ())
13751361 : accessor (BufferRef, AccessRange, {}, PropertyList, CodeLoc) {
1376- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1362+ adjustAccPropsInBuf (BufferRef);
13771363 }
13781364#endif
13791365
@@ -1419,7 +1405,7 @@ class __SYCL_SPECIAL_CLASS accessor :
14191405 const detail::code_location CodeLoc = detail::code_location::current ())
14201406 : accessor (BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
14211407 CodeLoc) {
1422- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1408+ adjustAccPropsInBuf (BufferRef);
14231409 }
14241410
14251411 template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1436,7 +1422,7 @@ class __SYCL_SPECIAL_CLASS accessor :
14361422 const detail::code_location CodeLoc = detail::code_location::current ())
14371423 : accessor (BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
14381424 CodeLoc) {
1439- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1425+ adjustAccPropsInBuf (BufferRef);
14401426 }
14411427#endif
14421428
@@ -1532,7 +1518,7 @@ class __SYCL_SPECIAL_CLASS accessor :
15321518 id<Dimensions> AccessOffset, TagT, const property_list &PropertyList = {},
15331519 const detail::code_location CodeLoc = detail::code_location::current ())
15341520 : accessor (BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
1535- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1521+ adjustAccPropsInBuf (BufferRef);
15361522 }
15371523
15381524 template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1548,7 +1534,7 @@ class __SYCL_SPECIAL_CLASS accessor :
15481534 {},
15491535 const detail::code_location CodeLoc = detail::code_location::current ())
15501536 : accessor (BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
1551- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1537+ adjustAccPropsInBuf (BufferRef);
15521538 }
15531539#endif
15541540
@@ -1645,7 +1631,7 @@ class __SYCL_SPECIAL_CLASS accessor :
16451631 const detail::code_location CodeLoc = detail::code_location::current ())
16461632 : accessor (BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
16471633 PropertyList, CodeLoc) {
1648- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1634+ adjustAccPropsInBuf (BufferRef);
16491635 }
16501636
16511637 template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1662,7 +1648,7 @@ class __SYCL_SPECIAL_CLASS accessor :
16621648 const detail::code_location CodeLoc = detail::code_location::current ())
16631649 : accessor (BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
16641650 PropertyList, CodeLoc) {
1665- adjustAccPropsInBuf (detail::getSyclObjImpl ( BufferRef). get () );
1651+ adjustAccPropsInBuf (BufferRef);
16661652 }
16671653#endif
16681654
@@ -1854,27 +1840,23 @@ class __SYCL_SPECIAL_CLASS accessor :
18541840 }
18551841
18561842#if __cplusplus >= 201703L
1857- template <typename ... PropTypes>
1858- void adjustAccPropsInBuf (detail::SYCLMemObjI *SYCLMemObject ) {
1843+ template <typename BufT, typename ... PropTypes>
1844+ void adjustAccPropsInBuf (BufT &Buffer ) {
18591845 if constexpr (PropertyListT::template has_property<
18601846 sycl::ext::intel::property::buffer_location>()) {
18611847 auto location = (PropertyListT::template get_property<
18621848 sycl::ext::intel::property::buffer_location>())
18631849 .get_location ();
18641850 property_list PropList{
18651851 sycl::property::buffer::detail::buffer_location (location)};
1866- detail::SYCLMemObjT *SYCLMemObjectT =
1867- dynamic_cast <detail::SYCLMemObjT *>(SYCLMemObject);
1868- SYCLMemObjectT->addOrReplaceAccessorProperties (PropList);
1852+ Buffer.addOrReplaceAccessorProperties (PropList);
18691853 } else {
1870- deleteAccPropsFromBuf (SYCLMemObject );
1854+ deleteAccPropsFromBuf (Buffer );
18711855 }
18721856 }
18731857
1874- void deleteAccPropsFromBuf (detail::SYCLMemObjI *SYCLMemObject) {
1875- detail::SYCLMemObjT *SYCLMemObjectT =
1876- dynamic_cast <detail::SYCLMemObjT *>(SYCLMemObject);
1877- SYCLMemObjectT->deleteAccessorProperty (
1858+ template <typename BufT> void deleteAccPropsFromBuf (BufT &Buffer) {
1859+ Buffer.deleteAccProps (
18781860 sycl::detail::PropWithDataKind::AccPropBufferLocation);
18791861 }
18801862#endif
@@ -2261,8 +2243,7 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
22612243 handler &CommandGroupHandler)
22622244 : detail::image_accessor<DataT, Dimensions, AccessMode,
22632245 access::target::image, IsPlaceholder>(
2264- Image, CommandGroupHandler,
2265- (detail::getSyclObjImpl(Image))->getElementSize ()) {
2246+ Image, CommandGroupHandler, Image.getElementSize()) {
22662247#ifndef __SYCL_DEVICE_ONLY__
22672248 detail::associateWithHandler (CommandGroupHandler, this ,
22682249 access::target::image);
@@ -2274,8 +2255,7 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
22742255 handler &CommandGroupHandler, const property_list &propList)
22752256 : detail::image_accessor<DataT, Dimensions, AccessMode,
22762257 access::target::image, IsPlaceholder>(
2277- Image, CommandGroupHandler,
2278- (detail::getSyclObjImpl(Image))->getElementSize()) {
2258+ Image, CommandGroupHandler, Image.getElementSize()) {
22792259 (void )propList;
22802260#ifndef __SYCL_DEVICE_ONLY__
22812261 detail::associateWithHandler (CommandGroupHandler, this ,
@@ -2319,14 +2299,14 @@ class accessor<DataT, Dimensions, AccessMode, access::target::host_image,
23192299 accessor (sycl::image<Dimensions, AllocatorT> &Image)
23202300 : detail::image_accessor<DataT, Dimensions, AccessMode,
23212301 access::target::host_image, IsPlaceholder>(
2322- Image, (detail::getSyclObjImpl( Image))-> getElementSize ()) {}
2302+ Image, Image. getElementSize()) {}
23232303
23242304 template <typename AllocatorT>
23252305 accessor (sycl::image<Dimensions, AllocatorT> &Image,
23262306 const property_list &propList)
23272307 : detail::image_accessor<DataT, Dimensions, AccessMode,
23282308 access::target::host_image, IsPlaceholder>(
2329- Image, (detail::getSyclObjImpl( Image))-> getElementSize()) {
2309+ Image, Image. getElementSize()) {
23302310 (void )propList;
23312311 }
23322312};
@@ -2368,8 +2348,7 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
23682348 handler &CommandGroupHandler)
23692349 : detail::image_accessor<DataT, Dimensions + 1 , AccessMode,
23702350 access::target::image, IsPlaceholder>(
2371- Image, CommandGroupHandler,
2372- (detail::getSyclObjImpl(Image))->getElementSize ()) {
2351+ Image, CommandGroupHandler, Image.getElementSize()) {
23732352#ifndef __SYCL_DEVICE_ONLY__
23742353 detail::associateWithHandler (CommandGroupHandler, this ,
23752354 access::target::image_array);
@@ -2381,8 +2360,7 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
23812360 handler &CommandGroupHandler, const property_list &propList)
23822361 : detail::image_accessor<DataT, Dimensions + 1 , AccessMode,
23832362 access::target::image, IsPlaceholder>(
2384- Image, CommandGroupHandler,
2385- (detail::getSyclObjImpl(Image))->getElementSize()) {
2363+ Image, CommandGroupHandler, Image.getElementSize()) {
23862364 (void )propList;
23872365#ifndef __SYCL_DEVICE_ONLY__
23882366 detail::associateWithHandler (CommandGroupHandler, this ,
0 commit comments