diff --git a/src/OpTensorCreate.cpp b/src/OpTensorCreate.cpp index 5bd7317d1..55dddb006 100644 --- a/src/OpTensorCreate.cpp +++ b/src/OpTensorCreate.cpp @@ -84,10 +84,7 @@ OpTensorCreate::postSubmit() { SPDLOG_DEBUG("Kompute OpTensorCreate postSubmit called"); - // TODO: Remove and add a test that checks that the memory in - // the staging tensor is actually storing the data SPDLOG_DEBUG("Kompute OpTensorCreate destroying staging tensors"); - // TODO: This would cause issues if there is no CPU barrier this->mStagingTensors.clear(); } diff --git a/src/OpTensorSyncLocal.cpp b/src/OpTensorSyncLocal.cpp index 37037ff99..8412c5063 100644 --- a/src/OpTensorSyncLocal.cpp +++ b/src/OpTensorSyncLocal.cpp @@ -89,7 +89,6 @@ OpTensorSyncLocal::postSubmit() // Remove all staging tensors as they are not required after operation SPDLOG_DEBUG("Kompute OpTensorSyncLocal destroying staging tensors"); - // TODO: This would cause issues if there is no CPU barrier this->mStagingTensors.clear(); } diff --git a/test/TestOpTensorCopy.cpp b/test/TestOpTensorCopy.cpp index 9325cacf5..5c44f3a39 100644 --- a/test/TestOpTensorCopy.cpp +++ b/test/TestOpTensorCopy.cpp @@ -27,6 +27,35 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensor) { EXPECT_EQ(tensorA->data(), tensorB->data()); } +TEST(TestOpTensorCopy, CopyDeviceToDeviceTensorMulti) { + + kp::Manager mgr; + + std::vector testVecA{ 9, 8, 7 }; + std::vector testVecB{ 0, 0, 0 }; + std::vector testVecC{ 0, 0, 0 }; + + std::shared_ptr tensorA{new kp::Tensor(testVecA)}; + std::shared_ptr tensorB{new kp::Tensor(testVecB)}; + std::shared_ptr tensorC{new kp::Tensor(testVecC)}; + + mgr.evalOpDefault({tensorA, tensorB, tensorC}); + + EXPECT_TRUE(tensorA->isInit()); + EXPECT_TRUE(tensorB->isInit()); + EXPECT_TRUE(tensorC->isInit()); + + mgr.evalOpDefault({tensorA, tensorB, tensorC}); + + EXPECT_EQ(tensorA->data(), tensorB->data()); + EXPECT_EQ(tensorA->data(), tensorC->data()); + + // Making sure the GPU holds the same data + mgr.evalOpDefault({tensorB, tensorC}); + EXPECT_EQ(tensorA->data(), tensorB->data()); + EXPECT_EQ(tensorA->data(), tensorC->data()); +} + TEST(TestOpTensorCopy, CopyDeviceToStagingTensor) { kp::Manager mgr;