Skip to content

Commit f53d913

Browse files
committed
Working draft
1 parent 655c935 commit f53d913

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

sycl/include/CL/sycl/accessor.hpp

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ class __SYCL_SPECIAL_CLASS accessor :
12001200
const property_list &PropertyList = {},
12011201
const detail::code_location CodeLoc = detail::code_location::current())
12021202
: accessor(BufferRef, PropertyList, CodeLoc) {
1203-
deleteAccPropsFromBuf(detail::getSyclObjImpl(BufferRef).get());
1203+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get());
12041204
}
12051205

12061206
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1215,7 +1215,7 @@ class __SYCL_SPECIAL_CLASS accessor :
12151215
{},
12161216
const detail::code_location CodeLoc = detail::code_location::current())
12171217
: accessor(BufferRef, PropertyList, CodeLoc) {
1218-
addOrReplaceAccPropsInBuf(PropertyList, detail::getSyclObjImpl(BufferRef).get());
1218+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get(), PropertyList);
12191219
}
12201220
#endif
12211221

@@ -1294,7 +1294,7 @@ class __SYCL_SPECIAL_CLASS accessor :
12941294
TagT, const property_list &PropertyList = {},
12951295
const detail::code_location CodeLoc = detail::code_location::current())
12961296
: accessor(BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {
1297-
deleteAccPropsFromBuf(detail::getSyclObjImpl(BufferRef).get());
1297+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get());
12981298
}
12991299

13001300
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1310,7 +1310,7 @@ class __SYCL_SPECIAL_CLASS accessor :
13101310
{},
13111311
const detail::code_location CodeLoc = detail::code_location::current())
13121312
: accessor(BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {
1313-
addOrReplaceAccPropsInBuf(PropertyList, detail::getSyclObjImpl(BufferRef).get());
1313+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get(), PropertyList);
13141314
}
13151315

13161316
#endif
@@ -1354,7 +1354,7 @@ class __SYCL_SPECIAL_CLASS accessor :
13541354
TagT, const property_list &PropertyList = {},
13551355
const detail::code_location CodeLoc = detail::code_location::current())
13561356
: accessor(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {
1357-
deleteAccPropsFromBuf(detail::getSyclObjImpl(BufferRef).get());
1357+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get());
13581358
}
13591359

13601360
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1370,7 +1370,7 @@ class __SYCL_SPECIAL_CLASS accessor :
13701370
{},
13711371
const detail::code_location CodeLoc = detail::code_location::current())
13721372
: accessor(BufferRef, AccessRange, {}, PropertyList, CodeLoc) {
1373-
addOrReplaceAccPropsInBuf(PropertyList, detail::getSyclObjImpl(BufferRef).get());
1373+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get(), PropertyList);
13741374
}
13751375
#endif
13761376

@@ -1416,7 +1416,7 @@ class __SYCL_SPECIAL_CLASS accessor :
14161416
const detail::code_location CodeLoc = detail::code_location::current())
14171417
: accessor(BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
14181418
CodeLoc) {
1419-
deleteAccPropsFromBuf(detail::getSyclObjImpl(BufferRef).get());
1419+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get());
14201420
}
14211421

14221422
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1433,7 +1433,7 @@ class __SYCL_SPECIAL_CLASS accessor :
14331433
const detail::code_location CodeLoc = detail::code_location::current())
14341434
: accessor(BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
14351435
CodeLoc) {
1436-
addOrReplaceAccPropsInBuf(PropertyList, detail::getSyclObjImpl(BufferRef).get());
1436+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get(), PropertyList);
14371437
}
14381438
#endif
14391439

@@ -1515,7 +1515,7 @@ class __SYCL_SPECIAL_CLASS accessor :
15151515
id<Dimensions> AccessOffset, TagT, const property_list &PropertyList = {},
15161516
const detail::code_location CodeLoc = detail::code_location::current())
15171517
: accessor(BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
1518-
deleteAccPropsFromBuf(detail::getSyclObjImpl(BufferRef).get());
1518+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get());
15191519
}
15201520

15211521
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1531,7 +1531,7 @@ class __SYCL_SPECIAL_CLASS accessor :
15311531
{},
15321532
const detail::code_location CodeLoc = detail::code_location::current())
15331533
: accessor(BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
1534-
addOrReplaceAccPropsInBuf(PropertyList, detail::getSyclObjImpl(BufferRef).get());
1534+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get(), PropertyList);
15351535
}
15361536
#endif
15371537

@@ -1614,7 +1614,7 @@ class __SYCL_SPECIAL_CLASS accessor :
16141614
const detail::code_location CodeLoc = detail::code_location::current())
16151615
: accessor(BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
16161616
PropertyList, CodeLoc) {
1617-
deleteAccPropsFromBuf(detail::getSyclObjImpl(BufferRef).get());
1617+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get());
16181618
}
16191619

16201620
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1631,7 +1631,7 @@ class __SYCL_SPECIAL_CLASS accessor :
16311631
const detail::code_location CodeLoc = detail::code_location::current())
16321632
: accessor(BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
16331633
PropertyList, CodeLoc) {
1634-
addOrReplaceAccPropsInBuf(PropertyList, detail::getSyclObjImpl(BufferRef).get());
1634+
adjustAccPropsInBuf(detail::getSyclObjImpl(BufferRef).get(), PropertyList);
16351635
}
16361636
#endif
16371637

@@ -1793,12 +1793,10 @@ class __SYCL_SPECIAL_CLASS accessor :
17931793
PI_INVALID_VALUE);
17941794
}
17951795

1796-
/// my TODO: rename function
17971796
#if __cplusplus >= 201703L
17981797
template <typename... PropTypes>
1799-
void addOrReplaceAccPropsInBuf(
1800-
const sycl::ext::oneapi::accessor_property_list<PropTypes...> &PropertyList,
1801-
detail::SYCLMemObjI *SYCLMemObject) {
1798+
void adjustAccPropsInBuf(detail::SYCLMemObjI *SYCLMemObject,
1799+
const sycl::ext::oneapi::accessor_property_list<PropTypes...> &PropertyList = {}) {
18021800
if constexpr (PropertyListT::template has_property<
18031801
sycl::ext::intel::property::buffer_location>()) {
18041802
auto location = (PropertyListT::template get_property<
@@ -1808,13 +1806,6 @@ class __SYCL_SPECIAL_CLASS accessor :
18081806
} else {
18091807
deleteAccPropsFromBuf(SYCLMemObject);
18101808
}
1811-
/*if (PropertyList.template has_property<sycl::ext::intel::property::buffer_location>()){
1812-
auto location = PropertyList.template get_property<sycl::ext::intel::property::buffer_location>().get_location();
1813-
property_list PropList{sycl::property::buffer::detail::buffer_location(location)};
1814-
SYCLMemObject->addOrReplaceAccessorProperties(PropList);
1815-
} else {
1816-
deleteAccPropsFromBuf(SYCLMemObject);
1817-
}*/
18181809
}
18191810

18201811
void deleteAccPropsFromBuf(detail::SYCLMemObjI *SYCLMemObject) {

sycl/source/detail/memory_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void memBufferCreateHelper(const plugin &Plugin, pi_context Ctx,
148148
}};
149149
#endif
150150
Plugin.call<PiApiKind::piMemBufferCreate>(Ctx, Flags, Size, HostPtr, RetMem,
151-
nullptr);
151+
Props);
152152
}
153153
}
154154

0 commit comments

Comments
 (0)