Skip to content

Commit

Permalink
fixup DeviceTensor's move ctor/assignment to avoid use of copying bta…
Browse files Browse the repository at this point in the history
…s::Tensor ops
  • Loading branch information
evaleev committed Jul 24, 2024
1 parent 36a309e commit 67606e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/spmm/spmm_cuda.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ struct DeviceTensor : public ttg::TTValue<DeviceTensor<_T, _Range, _Storage>>

DeviceTensor(DeviceTensor&& x) noexcept
: ttvalue_type(std::move(x))
, tensor_type(std::move(x))
, tensor_type(static_cast<tensor_type&&>(x))
/* Grrrr, moving a Tensor does not guarantee to move the pointer */
, b((this->size() == 0 ||
this->data() == x.b.host_ptr()) ? std::move(x.b)
Expand Down Expand Up @@ -237,7 +237,7 @@ struct DeviceTensor : public ttg::TTValue<DeviceTensor<_T, _Range, _Storage>>
/// move assignment operator
DeviceTensor& operator=(DeviceTensor&& x) noexcept {
ttvalue_type::operator=(std::move(x));
tensor_type::operator=(std::move(x));
tensor_type::operator=(static_cast<tensor_type&&>(x));
if (this->size() == 0 || this->data() == x.b.host_ptr()){
b = std::move(x.b);
} else {
Expand Down

0 comments on commit 67606e5

Please sign in to comment.