Skip to content

Commit 5af7aa1

Browse files
committed
[SYCL] Work around build issues with GCC 7+.
Signed-off-by: Alexey Bader <alexey.bader@intel.com>
1 parent 5124d7c commit 5af7aa1

File tree

2 files changed

+28
-35
lines changed

2 files changed

+28
-35
lines changed

sycl/include/CL/sycl/accessor.hpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class subscript_obj<accessorDim, dataT, 1, accessMode, accessTarget,
6767

6868
dataT &operator[](size_t index) {
6969
ids[accessorDim - 1] = index;
70-
return accRef.__impl()->Data[getOffsetForId(
71-
accRef.__impl()->Range, ids, accRef.__impl()->Offset)];
70+
return accRef.__get_impl()->Data[getOffsetForId(
71+
accRef.__get_impl()->Range, ids, accRef.__get_impl()->Offset)];
7272
}
7373
};
7474

@@ -89,8 +89,8 @@ class subscript_obj<accessorDim, dataT, 1, access::mode::read, accessTarget,
8989
typename detail::remove_AS<dataT>::type
9090
operator[](size_t index) {
9191
ids[accessorDim - 1] = index;
92-
return accRef.__impl()->Data[getOffsetForId(
93-
accRef.__impl()->Range, ids, accRef.__impl()->Offset)];
92+
return accRef.__get_impl()->Data[getOffsetForId(
93+
accRef.__get_impl()->Range, ids, accRef.__get_impl()->Offset)];
9494
}
9595
};
9696

@@ -307,11 +307,11 @@ class accessor_base {
307307
using _ImplT =
308308
accessor_impl<dataT, dimensions, accessMode, accessTarget, isPlaceholder>;
309309

310-
const _ImplT *__impl() const {
310+
const _ImplT *__get_impl() const {
311311
return reinterpret_cast<const _ImplT *>(this);
312312
}
313313

314-
_ImplT *__impl() { return reinterpret_cast<_ImplT *>(this); }
314+
_ImplT *__get_impl() { return reinterpret_cast<_ImplT *>(this); }
315315

316316
static_assert(
317317
std::is_same<typename DeviceValueType<dataT, accessTarget>::type,
@@ -347,15 +347,15 @@ SYCL_ACCESSOR_SUBCLASS(accessor_common, accessor_base, true /* always */) {
347347
size_t get_size() const { return this->get_count() * sizeof(dataT); }
348348

349349
// Returns the number of accessed elements.
350-
size_t get_count() const { return this->__impl()->get_count(); }
350+
size_t get_count() const { return this->__get_impl()->get_count(); }
351351

352352
template <int Dimensions = dimensions>
353353
typename std::enable_if<(Dimensions > 0), range<Dimensions>>::type
354-
get_range() const { return this->__impl()->Range; }
354+
get_range() const { return this->__get_impl()->Range; }
355355

356356
template <int Dimensions = dimensions>
357357
typename std::enable_if<(Dimensions > 0), id<Dimensions>>::type
358-
get_offset() const { return this->__impl()->Offset; }
358+
get_offset() const { return this->__get_impl()->Offset; }
359359
};
360360

361361
SYCL_ACCESSOR_SUBCLASS(accessor_opdata_w, accessor_common,
@@ -365,7 +365,7 @@ SYCL_ACCESSOR_SUBCLASS(accessor_opdata_w, accessor_common,
365365
accessMode == access::mode::discard_read_write) &&
366366
dimensions == 0) {
367367
operator dataT &() const {
368-
return this->__impl()->Data[0];
368+
return this->__get_impl()->Data[0];
369369
}
370370
};
371371

@@ -376,7 +376,7 @@ SYCL_ACCESSOR_SUBCLASS(accessor_subscript_wn, accessor_opdata_w,
376376
accessMode == access::mode::discard_read_write) &&
377377
dimensions > 0) {
378378
dataT &operator[](id<dimensions> index) const {
379-
return this->__impl()->Data[getOffsetForId(
379+
return this->__get_impl()->Data[getOffsetForId(
380380
this->get_range(), index, this->get_offset())];
381381
}
382382

@@ -407,23 +407,23 @@ SYCL_ACCESSOR_SUBCLASS(accessor_subscript_w, accessor_subscript_wn,
407407
getOffsetForId(this->get_range(), index, this->get_offset()));
408408
}
409409
dataT &operator[](size_t index) const {
410-
return this->__impl()->Data[index];
410+
return this->__get_impl()->Data[index];
411411
}
412412
};
413413

414414
SYCL_ACCESSOR_SUBCLASS(accessor_opdata_r, accessor_subscript_w,
415415
accessMode == access::mode::read && dimensions == 0) {
416416
using PureType = typename detail::remove_AS<dataT>::type;
417417
operator PureType() const {
418-
return this->__impl()->Data[0];
418+
return this->__get_impl()->Data[0];
419419
}
420420
};
421421

422422
SYCL_ACCESSOR_SUBCLASS(accessor_subscript_rn, accessor_opdata_r,
423423
accessMode == access::mode::read && dimensions > 0) {
424424
typename detail::remove_AS<dataT>::type
425425
operator[](id<dimensions> index) const {
426-
return this->__impl()->Data[getOffsetForId(
426+
return this->__get_impl()->Data[getOffsetForId(
427427
this->get_range(), index, this->get_offset())];
428428
}
429429

@@ -446,7 +446,7 @@ SYCL_ACCESSOR_SUBCLASS(accessor_subscript_r, accessor_subscript_rn,
446446
}
447447
typename detail::remove_AS<dataT>::type
448448
operator[](size_t index) const {
449-
return this->__impl()->Data[index];
449+
return this->__get_impl()->Data[index];
450450
}
451451
};
452452

@@ -468,7 +468,7 @@ SYCL_ACCESSOR_SUBCLASS(accessor_subscript_atomic_eq0, accessor_subscript_r,
468468
getAddressSpace<accessTarget>::value;
469469
operator atomic<PureType, addressSpace>() const {
470470
return atomic<PureType, addressSpace>(
471-
multi_ptr<PureType, addressSpace>(&(this->__impl()->Data[0])));
471+
multi_ptr<PureType, addressSpace>(&(this->__get_impl()->Data[0])));
472472
}
473473
};
474474

@@ -481,8 +481,8 @@ SYCL_ACCESSOR_SUBCLASS(accessor_subscript_atomic_gt0,
481481
getAddressSpace<accessTarget>::value;
482482
atomic<PureType, addressSpace> operator[](id<dimensions> index) const {
483483
return atomic<PureType, addressSpace>(
484-
multi_ptr<PureType, addressSpace>(&(this->__impl()->Data[getOffsetForId(
485-
this->__impl()->Range, index, this->__impl()->Offset)])));
484+
multi_ptr<PureType, addressSpace>(&(this->__get_impl()->Data[getOffsetForId(
485+
this->__get_impl()->Range, index, this->__get_impl()->Offset)])));
486486
}
487487
};
488488

@@ -495,7 +495,7 @@ SYCL_ACCESSOR_SUBCLASS(accessor_subscript_atomic_eq1,
495495
getAddressSpace<accessTarget>::value;
496496
atomic<PureType, addressSpace> operator[](size_t index) const {
497497
return atomic<PureType, addressSpace>(
498-
multi_ptr<PureType, addressSpace>(&(this->__impl()->Data[index])));
498+
multi_ptr<PureType, addressSpace>(&(this->__get_impl()->Data[index])));
499499
}
500500
};
501501

@@ -510,31 +510,31 @@ SYCL_ACCESSOR_SUBCLASS(accessor_pointer, accessor_subscript_atomic_eq1, true) {
510510
typename std::enable_if<(AccessTarget == access::target::host_buffer),
511511
dataT *>::type
512512
get_pointer() const {
513-
return this->__impl()->Data;
513+
return this->__get_impl()->Data;
514514
}
515515
/* Available only when: accessTarget == access::target::global_buffer */
516516
template <typename DataT = typename detail::remove_AS<dataT>::type,
517517
access::target AccessTarget = accessTarget>
518518
typename std::enable_if<(AccessTarget == access::target::global_buffer),
519519
global_ptr<DataT>>::type
520520
get_pointer() const {
521-
return global_ptr<DataT>(this->__impl()->Data);
521+
return global_ptr<DataT>(this->__get_impl()->Data);
522522
}
523523
/* Available only when: accessTarget == access::target::constant_buffer */
524524
template <typename DataT = typename detail::remove_AS<dataT>::type,
525525
access::target AccessTarget = accessTarget>
526526
typename std::enable_if<(AccessTarget == access::target::constant_buffer),
527527
constant_ptr<DataT>>::type
528528
get_pointer() const {
529-
return constant_ptr<DataT>(this->__impl()->Data);
529+
return constant_ptr<DataT>(this->__get_impl()->Data);
530530
}
531531
/* Available only when: accessTarget == access::target::local */
532532
template <typename DataT = typename detail::remove_AS<dataT>::type,
533533
access::target AccessTarget = accessTarget>
534534
typename std::enable_if<(AccessTarget == access::target::local),
535535
local_ptr<DataT>>::type
536536
get_pointer() const {
537-
return local_ptr<DataT>(this->__impl()->Data);
537+
return local_ptr<DataT>(this->__get_impl()->Data);
538538
}
539539
};
540540

sycl/include/CL/sycl/detail/scheduler/scheduler.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ void Node::addAccRequirement(
5959
accessor<dataT, dimensions, accessMode, accessTarget, isPlaceholder> &&Acc,
6060
int argIndex) {
6161
detail::buffer_impl<buffer_allocator<char>> *buf =
62-
Acc.template accessor_base<dataT, dimensions, accessMode, accessTarget,
63-
isPlaceholder>::__impl()
64-
->m_Buf;
62+
Acc.__get_impl()->m_Buf;
6563
addBufRequirement<accessMode, accessTarget>(*buf);
6664
addInteropArg(nullptr, buf->get_size(), argIndex,
6765
getReqForBuffer(m_Bufs, *buf));
@@ -126,8 +124,7 @@ template <typename T, int Dimensions, access::mode mode, access::target tgt,
126124
access::placeholder isPlaceholder>
127125
void Node::addExplicitMemOp(
128126
accessor<T, Dimensions, mode, tgt, isPlaceholder> &Dest, T Src) {
129-
auto *DestBase = Dest.template accessor_base<T, Dimensions, mode, tgt,
130-
isPlaceholder>::__impl();
127+
auto *DestBase = Dest.__get_impl();
131128
assert(DestBase != nullptr &&
132129
"Accessor should have an initialized accessor_base");
133130
detail::buffer_impl<buffer_allocator<char>> *Buf = DestBase->m_Buf;
@@ -151,13 +148,10 @@ template <typename T_src, int dim_src, access::mode mode_src,
151148
void Node::addExplicitMemOp(
152149
accessor<T_src, dim_src, mode_src, tgt_src, isPlaceholder_src> Src,
153150
accessor<T_dest, dim_dest, mode_dest, tgt_dest, isPlaceholder_dest> Dest) {
154-
auto *SrcBase = Src.template accessor_base<T_src, dim_src, mode_src, tgt_src,
155-
isPlaceholder_src>::__impl();
151+
auto *SrcBase = Src.__get_impl();
156152
assert(SrcBase != nullptr &&
157153
"Accessor should have an initialized accessor_base");
158-
auto *DestBase =
159-
Dest.template accessor_base<T_dest, dim_dest, mode_dest, tgt_dest,
160-
isPlaceholder_dest>::__impl();
154+
auto *DestBase = Dest.__get_impl();
161155
assert(DestBase != nullptr &&
162156
"Accessor should have an initialized accessor_base");
163157

@@ -191,8 +185,7 @@ template <typename T, int Dimensions, access::mode mode, access::target tgt,
191185
void Scheduler::updateHost(
192186
accessor<T, Dimensions, mode, tgt, isPlaceholder> &Acc,
193187
cl::sycl::event &Event) {
194-
auto *AccBase = Acc.template accessor_base<T, Dimensions, mode, tgt,
195-
isPlaceholder>::__impl();
188+
auto *AccBase = Acc.__get_impl();
196189
assert(AccBase != nullptr &&
197190
"Accessor should have an initialized accessor_base");
198191
detail::buffer_impl<buffer_allocator<char>> *Buf = AccBase->m_Buf;

0 commit comments

Comments
 (0)