@@ -1195,7 +1195,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1195
1195
buffer<T, Dims, AllocatorT> &BufferRef, TagT,
1196
1196
const property_list &PropertyList = {},
1197
1197
const detail::code_location CodeLoc = detail::code_location::current ())
1198
- : accessor (BufferRef, PropertyList, CodeLoc) {}
1198
+ : accessor (BufferRef, PropertyList, CodeLoc) {
1199
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1200
+ }
1199
1201
1200
1202
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
1201
1203
typename TagT, typename ... PropTypes,
@@ -1208,7 +1210,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1208
1210
const ext::oneapi::accessor_property_list<PropTypes...> &PropertyList =
1209
1211
{},
1210
1212
const detail::code_location CodeLoc = detail::code_location::current ())
1211
- : accessor (BufferRef, PropertyList, CodeLoc) {}
1213
+ : accessor (BufferRef, PropertyList, CodeLoc) {
1214
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1215
+ }
1212
1216
#endif
1213
1217
1214
1218
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1285,7 +1289,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1285
1289
buffer<T, Dims, AllocatorT> &BufferRef, handler &CommandGroupHandler,
1286
1290
TagT, const property_list &PropertyList = {},
1287
1291
const detail::code_location CodeLoc = detail::code_location::current ())
1288
- : accessor (BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {}
1292
+ : accessor (BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {
1293
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1294
+ }
1289
1295
1290
1296
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
1291
1297
typename TagT, typename ... PropTypes,
@@ -1299,7 +1305,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1299
1305
const ext::oneapi::accessor_property_list<PropTypes...> &PropertyList =
1300
1306
{},
1301
1307
const detail::code_location CodeLoc = detail::code_location::current ())
1302
- : accessor (BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {}
1308
+ : accessor (BufferRef, CommandGroupHandler, PropertyList, CodeLoc) {
1309
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1310
+ }
1303
1311
1304
1312
#endif
1305
1313
@@ -1341,7 +1349,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1341
1349
buffer<T, Dims, AllocatorT> &BufferRef, range<Dimensions> AccessRange,
1342
1350
TagT, const property_list &PropertyList = {},
1343
1351
const detail::code_location CodeLoc = detail::code_location::current ())
1344
- : accessor (BufferRef, AccessRange, {}, PropertyList, CodeLoc) {}
1352
+ : accessor (BufferRef, AccessRange, {}, PropertyList, CodeLoc) {
1353
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1354
+ }
1345
1355
1346
1356
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
1347
1357
typename TagT, typename ... PropTypes,
@@ -1355,7 +1365,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1355
1365
const ext::oneapi::accessor_property_list<PropTypes...> &PropertyList =
1356
1366
{},
1357
1367
const detail::code_location CodeLoc = detail::code_location::current ())
1358
- : accessor (BufferRef, AccessRange, {}, PropertyList, CodeLoc) {}
1368
+ : accessor (BufferRef, AccessRange, {}, PropertyList, CodeLoc) {
1369
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1370
+ }
1359
1371
#endif
1360
1372
1361
1373
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1399,7 +1411,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1399
1411
const property_list &PropertyList = {},
1400
1412
const detail::code_location CodeLoc = detail::code_location::current ())
1401
1413
: accessor (BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
1402
- CodeLoc) {}
1414
+ CodeLoc) {
1415
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1416
+ }
1403
1417
1404
1418
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
1405
1419
typename TagT, typename ... PropTypes,
@@ -1414,7 +1428,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1414
1428
{},
1415
1429
const detail::code_location CodeLoc = detail::code_location::current ())
1416
1430
: accessor (BufferRef, CommandGroupHandler, AccessRange, {}, PropertyList,
1417
- CodeLoc) {}
1431
+ CodeLoc) {
1432
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1433
+ }
1418
1434
#endif
1419
1435
1420
1436
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1508,7 +1524,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1508
1524
buffer<T, Dims, AllocatorT> &BufferRef, range<Dimensions> AccessRange,
1509
1525
id<Dimensions> AccessOffset, TagT, const property_list &PropertyList = {},
1510
1526
const detail::code_location CodeLoc = detail::code_location::current ())
1511
- : accessor (BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {}
1527
+ : accessor (BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
1528
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1529
+ }
1512
1530
1513
1531
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
1514
1532
typename TagT, typename ... PropTypes,
@@ -1522,7 +1540,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1522
1540
const ext::oneapi::accessor_property_list<PropTypes...> &PropertyList =
1523
1541
{},
1524
1542
const detail::code_location CodeLoc = detail::code_location::current ())
1525
- : accessor (BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {}
1543
+ : accessor (BufferRef, AccessRange, AccessOffset, PropertyList, CodeLoc) {
1544
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1545
+ }
1526
1546
#endif
1527
1547
1528
1548
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
@@ -1617,7 +1637,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1617
1637
const property_list &PropertyList = {},
1618
1638
const detail::code_location CodeLoc = detail::code_location::current ())
1619
1639
: accessor (BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
1620
- PropertyList, CodeLoc) {}
1640
+ PropertyList, CodeLoc) {
1641
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1642
+ }
1621
1643
1622
1644
template <typename T = DataT, int Dims = Dimensions, typename AllocatorT,
1623
1645
typename TagT, typename ... PropTypes,
@@ -1632,7 +1654,9 @@ class __SYCL_SPECIAL_CLASS accessor :
1632
1654
{},
1633
1655
const detail::code_location CodeLoc = detail::code_location::current ())
1634
1656
: accessor (BufferRef, CommandGroupHandler, AccessRange, AccessOffset,
1635
- PropertyList, CodeLoc) {}
1657
+ PropertyList, CodeLoc) {
1658
+ adjustAccPropsInBuf (detail::getSyclObjImpl (BufferRef).get ());
1659
+ }
1636
1660
#endif
1637
1661
1638
1662
template <typename ... NewPropsT>
@@ -1802,6 +1826,32 @@ class __SYCL_SPECIAL_CLASS accessor :
1802
1826
PI_INVALID_VALUE);
1803
1827
}
1804
1828
}
1829
+
1830
+ #if __cplusplus >= 201703L
1831
+ template <typename ... PropTypes>
1832
+ void adjustAccPropsInBuf (detail::SYCLMemObjI *SYCLMemObject) {
1833
+ if constexpr (PropertyListT::template has_property<
1834
+ sycl::ext::intel::property::buffer_location>()) {
1835
+ auto location = (PropertyListT::template get_property<
1836
+ sycl::ext::intel::property::buffer_location>())
1837
+ .get_location ();
1838
+ property_list PropList{
1839
+ sycl::property::buffer::detail::buffer_location (location)};
1840
+ detail::SYCLMemObjT *SYCLMemObjectT =
1841
+ dynamic_cast <detail::SYCLMemObjT *>(SYCLMemObject);
1842
+ SYCLMemObjectT->addOrReplaceAccessorProperties (PropList);
1843
+ } else {
1844
+ deleteAccPropsFromBuf (SYCLMemObject);
1845
+ }
1846
+ }
1847
+
1848
+ void deleteAccPropsFromBuf (detail::SYCLMemObjI *SYCLMemObject) {
1849
+ detail::SYCLMemObjT *SYCLMemObjectT =
1850
+ dynamic_cast <detail::SYCLMemObjT *>(SYCLMemObject);
1851
+ SYCLMemObjectT->deleteAccessorProperty (
1852
+ sycl::detail::PropWithDataKind::AccPropBufferLocation);
1853
+ }
1854
+ #endif
1805
1855
};
1806
1856
1807
1857
#if __cplusplus >= 201703L
0 commit comments