Skip to content

Commit 4b9fcca

Browse files
committed
Move getter to private
Signed-off-by: Dmitry Sidorov <[email protected]>
1 parent f6d8bdf commit 4b9fcca

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sycl/include/CL/sycl/atomic.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ namespace sycl {
173173
template <typename T, access::address_space addressSpace =
174174
access::address_space::global_space>
175175
class atomic {
176+
friend class atomic<T, access::address_space::global_space>;
176177
static_assert(detail::IsValidAtomicType<T>::value,
177178
"Invalid SYCL atomic type. Valid types are: int, "
178179
"unsigned int, long, unsigned long, long long, unsigned "
@@ -198,12 +199,6 @@ class atomic {
198199
"T and pointerT must be same size");
199200
}
200201

201-
#ifdef __SYCL_DEVICE_ONLY__
202-
AtomicPtrType *getPtr() const { return Ptr; }
203-
#else
204-
std::atomic<T> *getPtr() const { return Ptr; }
205-
#endif
206-
207202
// Create atomic in global_space with one from global_device_space
208203
template <access::address_space _Space = addressSpace,
209204
typename = typename std::enable_if<
@@ -229,6 +224,14 @@ class atomic {
229224
#endif
230225
}
231226

227+
private:
228+
#ifdef __SYCL_DEVICE_ONLY__
229+
AtomicPtrType *getPtr() const { return Ptr; }
230+
#else
231+
std::atomic<T> *getPtr() const { return Ptr; }
232+
#endif
233+
234+
public:
232235
void store(T Operand, memory_order Order = memory_order::relaxed) {
233236
__spirv_AtomicStore(
234237
Ptr, SpirvScope, detail::getSPIRVMemorySemanticsMask(Order), Operand);

0 commit comments

Comments
 (0)