Skip to content

Commit 491f2ab

Browse files
committed
Add implementation comments
Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 46b0096 commit 491f2ab

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

sycl/include/sycl/ext/oneapi/weak_object.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ template <int Dims> static range<Dims> createDummyRange() {
2929
}
3030
} // namespace detail
3131

32+
// The weak_object class.
33+
// Since we use std::shared_ptr to implementations as a way to handle common
34+
// reference semantics in SYCL classes, the implementation of the weak_object
35+
// class holds a weak_ptr to the implementations. The weak_ptr is in the
36+
// weak_object_base class.
3237
template <typename SYCLObjT>
3338
class weak_object : public detail::weak_object_base<SYCLObjT> {
3439
public:
@@ -138,6 +143,7 @@ class weak_object<buffer<T, Dimensions, AllocatorT>>
138143
}
139144

140145
private:
146+
// Additional members required for recreating buffers.
141147
range<Dimensions> MRange;
142148
size_t MOffsetInBytes;
143149
bool MIsSubBuffer;

sycl/include/sycl/ext/oneapi/weak_object_base.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ template <typename SYCLObjT> class weak_object_base {
5252
}
5353

5454
protected:
55+
// Store a weak variant of the impl in the SYCLObjT.
5556
typename std::invoke_result_t<
5657
decltype(sycl::detail::getSyclObjImpl<SYCLObjT>), SYCLObjT>::weak_type
5758
MObjWeakPtr;

0 commit comments

Comments
 (0)