28
28
namespace Oro
29
29
{
30
30
31
- // / @brief A helper function that casts an address of a pointer to the device memory to a void pointer to be used as an argument for kernel calls.
31
+ // / @brief A helper function that casts an address of a pointer to the device memory to a void pointer to be used as an argument for kernel calls.
32
32
// / @tparam T The type of the element stored in the device memory.
33
33
// / @param ptr The address of a pointer to the device memory.
34
34
// / @return A void pointer.
@@ -44,8 +44,8 @@ class GpuMemory final
44
44
public:
45
45
GpuMemory () = default ;
46
46
47
- // / @brief Allocate the device memory with the given size .
48
- // / @param init_size The initial size which represents the number of elements.
47
+ // / @brief Allocate the elements on the device memory .
48
+ // / @param init_size The initial container size which represents the number of elements.
49
49
explicit GpuMemory ( const size_t init_size )
50
50
{
51
51
OrochiUtils::malloc ( m_data, init_size );
@@ -61,9 +61,9 @@ class GpuMemory final
61
61
62
62
GpuMemory& operator =( GpuMemory&& other ) noexcept
63
63
{
64
- GpuMemory tmp ( std::move ( * this ) );
64
+ GpuMemory tmp ( std::move ( other ) );
65
65
66
- swap ( *this , other );
66
+ swap ( *this , tmp );
67
67
68
68
return *this ;
69
69
}
@@ -79,8 +79,8 @@ class GpuMemory final
79
79
m_capacity = 0ULL ;
80
80
}
81
81
82
- // / @brief Get the size of the device memory .
83
- // / @return The size of the device memory .
82
+ // / @brief Get the container size which represents the number of elements .
83
+ // / @return The container size which represents the number of elements .
84
84
size_t size () const noexcept { return m_size; }
85
85
86
86
// / @brief Get the pointer to the device memory.
@@ -91,9 +91,9 @@ class GpuMemory final
91
91
// / @return The address of the pointer to the device memory.
92
92
T* const * address () const noexcept { return &m_data; }
93
93
94
- // / @brief Resize the device memory . Its capacity is unchanged if the new size is smaller than the current one.
94
+ // / @brief Resize the container . Its capacity is unchanged if the new size is smaller than the current one.
95
95
// / The old data should be considered invalid to be used after the function is called unless @c copy is set to True.
96
- // / @param new_size The new memory size after the function is called.
96
+ // / @param new_size The new container size which represents the number of elements after the function is called.
97
97
// / @param copy If true, the function will copy the data to the newly created memory space as well.
98
98
void resize ( const size_t new_size, const bool copy = false ) noexcept
99
99
{
@@ -113,8 +113,8 @@ class GpuMemory final
113
113
*this = std::move ( tmp );
114
114
}
115
115
116
- // / @brief Asynchronous version of ' resize' using a given Orochi stream.
117
- // / @param new_size The new memory size after the function is called.
116
+ // / @brief Asynchronous version of @c resize using a given Orochi stream.
117
+ // / @param new_size The new container size which represents the number of elements after the function is called.
118
118
// / @param copy If true, the function will copy the data to the newly created memory space as well.
119
119
// / @param stream The Orochi stream used for the underlying operations.
120
120
void resizeAsync ( const size_t new_size, const bool copy = false , oroStream stream = 0 ) noexcept
@@ -138,7 +138,7 @@ class GpuMemory final
138
138
// / @brief Reset the memory space so that all bits inside are cleared to zero.
139
139
void reset () noexcept { OrochiUtils::memset ( m_data, 0 , m_size * sizeof ( T ) ); }
140
140
141
- // / @brief Asynchronous version of ' reset' using a given Orochi stream.
141
+ // / @brief Asynchronous version of @c reset using a given Orochi stream.
142
142
// / @param stream The Orochi stream used for the underlying operations.
143
143
void resetAsync ( oroStream stream = 0 ) noexcept { OrochiUtils::memsetAsync ( m_data, 0 , m_size * sizeof ( T ), stream ); }
144
144
0 commit comments