diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 16849731..b58d32e6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,17 +14,15 @@ add_library(kompute Algorithm.cpp OpMemoryBarrier.cpp OpTensorCopy.cpp OpTensorCopyToImage.cpp - OpTensorSyncDevice.cpp - OpTensorSyncLocal.cpp + OpSyncDevice.cpp + OpSyncLocal.cpp Sequence.cpp Tensor.cpp Core.cpp Image.cpp Memory.cpp OpImageCopy.cpp - OpImageCopyToTensor.cpp - OpImageSyncDevice.cpp - OpImageSyncLocal.cpp) + OpImageCopyToTensor.cpp) add_library(kompute::kompute ALIAS kompute) diff --git a/src/OpImageSyncDevice.cpp b/src/OpImageSyncDevice.cpp deleted file mode 100644 index 8610167b..00000000 --- a/src/OpImageSyncDevice.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -#include "kompute/operations/OpImageSyncDevice.hpp" - -namespace kp { - -OpImageSyncDevice::OpImageSyncDevice( - const std::vector>& images) -{ - KP_LOG_DEBUG("Kompute OpImageSyncDevice constructor with params"); - - if (images.size() < 1) { - throw std::runtime_error( - "Kompute OpImageSyncDevice called with less than 1 image"); - } - - for (std::shared_ptr image : images) { - if (std::dynamic_pointer_cast(image) == nullptr) { - throw std::runtime_error( - "Kompute OpImageSyncDevice: Memory object is not an Image"); - } - this->mImages.push_back(std::dynamic_pointer_cast(image)); - } -} - -OpImageSyncDevice::~OpImageSyncDevice() -{ - KP_LOG_DEBUG("Kompute OpImageSyncDevice destructor started"); - - this->mImages.clear(); -} - -void -OpImageSyncDevice::record(const vk::CommandBuffer& commandBuffer) -{ - KP_LOG_DEBUG("Kompute OpImageSyncDevice record called"); - - for (size_t i = 0; i < this->mImages.size(); i++) { - if (this->mImages[i]->memoryType() == Memory::MemoryTypes::eDevice) { - this->mImages[i]->recordCopyFromStagingToDevice(commandBuffer); - } - } -} - -void -OpImageSyncDevice::preEval(const vk::CommandBuffer& /*commandBuffer*/) -{ - KP_LOG_DEBUG("Kompute OpImageSyncDevice preEval called"); -} - -void -OpImageSyncDevice::postEval(const vk::CommandBuffer& /*commandBuffer*/) -{ - KP_LOG_DEBUG("Kompute OpImageSyncDevice postEval called"); -} - -} diff --git a/src/OpImageSyncLocal.cpp b/src/OpImageSyncLocal.cpp deleted file mode 100644 index c87673a0..00000000 --- a/src/OpImageSyncLocal.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -#include "kompute/Image.hpp" - -#include "kompute/operations/OpImageSyncLocal.hpp" - -namespace kp { - -OpImageSyncLocal::OpImageSyncLocal( - const std::vector>& images) -{ - KP_LOG_DEBUG("Kompute OpImageSyncLocal constructor with params"); - - if (images.size() < 1) { - throw std::runtime_error( - "Kompute OpImageSyncLocal called with less than 1 image"); - } - - for (std::shared_ptr image : images) { - if (std::dynamic_pointer_cast(image) == nullptr) { - throw std::runtime_error( - "Kompute OpImageSyncLocal: Memory object is not an Image"); - } - this->mImages.push_back(std::dynamic_pointer_cast(image)); - } -} - -OpImageSyncLocal::~OpImageSyncLocal() -{ - KP_LOG_DEBUG("Kompute OpImageSyncLocal destructor started"); -} - -void -OpImageSyncLocal::record(const vk::CommandBuffer& commandBuffer) -{ - KP_LOG_DEBUG("Kompute OpImageSyncLocal record called"); - - for (size_t i = 0; i < this->mImages.size(); i++) { - if (this->mImages[i]->memoryType() == Memory::MemoryTypes::eDevice) { - - this->mImages[i]->recordPrimaryMemoryBarrier( - commandBuffer, - vk::AccessFlagBits::eShaderWrite, - vk::AccessFlagBits::eTransferRead, - vk::PipelineStageFlagBits::eComputeShader, - vk::PipelineStageFlagBits::eTransfer); - - this->mImages[i]->recordCopyFromDeviceToStaging(commandBuffer); - - this->mImages[i]->recordPrimaryMemoryBarrier( - commandBuffer, - vk::AccessFlagBits::eTransferWrite, - vk::AccessFlagBits::eHostRead, - vk::PipelineStageFlagBits::eTransfer, - vk::PipelineStageFlagBits::eHost); - } - } -} - -void -OpImageSyncLocal::preEval(const vk::CommandBuffer& /*commandBuffer*/) -{ - KP_LOG_DEBUG("Kompute OpImageSyncLocal preEval called"); -} - -void -OpImageSyncLocal::postEval(const vk::CommandBuffer& /*commandBuffer*/) -{ - KP_LOG_DEBUG("Kompute OpImageSyncLocal postEval called"); - - KP_LOG_DEBUG("Kompute OpImageSyncLocal mapping data into image local"); -} - -} diff --git a/src/OpSyncDevice.cpp b/src/OpSyncDevice.cpp new file mode 100644 index 00000000..26f64594 --- /dev/null +++ b/src/OpSyncDevice.cpp @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: Apache-2.0 + +#include "kompute/operations/OpSyncDevice.hpp" + +namespace kp { + +OpSyncDevice::OpSyncDevice( + const std::vector>& memObjects) +{ + KP_LOG_DEBUG("Kompute OpSyncDevice constructor with params"); + + if (memObjects.size() < 1) { + throw std::runtime_error( + "Kompute OpSyncDevice called with less than 1 memory object"); + } + + this->mMemObjects = memObjects; +} + +OpSyncDevice::~OpSyncDevice() +{ + KP_LOG_DEBUG("Kompute OpSyncDevice destructor started"); + + this->mMemObjects.clear(); +} + +void +OpSyncDevice::record(const vk::CommandBuffer& commandBuffer) +{ + KP_LOG_DEBUG("Kompute OpSyncDevice record called"); + + for (size_t i = 0; i < this->mMemObjects.size(); i++) { + if (this->mMemObjects[i]->memoryType() == Tensor::MemoryTypes::eDevice) { + this->mMemObjects[i]->recordCopyFromStagingToDevice(commandBuffer); + } + } +} + +void +OpSyncDevice::preEval(const vk::CommandBuffer& /*commandBuffer*/) +{ + KP_LOG_DEBUG("Kompute OpSyncDevice preEval called"); +} + +void +OpSyncDevice::postEval(const vk::CommandBuffer& /*commandBuffer*/) +{ + KP_LOG_DEBUG("Kompute OpSyncDevice postEval called"); +} + +} diff --git a/src/OpSyncLocal.cpp b/src/OpSyncLocal.cpp new file mode 100644 index 00000000..a051b816 --- /dev/null +++ b/src/OpSyncLocal.cpp @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: Apache-2.0 + +#include "kompute/Tensor.hpp" + +#include "kompute/operations/OpSyncLocal.hpp" + +namespace kp { + +OpSyncLocal::OpSyncLocal( + const std::vector>& memObjects) +{ + KP_LOG_DEBUG("Kompute OpSyncLocal constructor with params"); + + if (memObjects.size() < 1) { + throw std::runtime_error( + "Kompute OpSyncLocal called with less than 1 memory object"); + } + + this->mMemObjects = memObjects; +} + +OpSyncLocal::~OpSyncLocal() +{ + KP_LOG_DEBUG("Kompute OpSyncLocal destructor started"); +} + +void +OpSyncLocal::record(const vk::CommandBuffer& commandBuffer) +{ + KP_LOG_DEBUG("Kompute OpSyncLocal record called"); + + for (size_t i = 0; i < this->mMemObjects.size(); i++) { + if (this->mMemObjects[i]->memoryType() == Memory::MemoryTypes::eDevice) { + + this->mMemObjects[i]->recordPrimaryMemoryBarrier( + commandBuffer, + vk::AccessFlagBits::eShaderWrite, + // FIXME: eTransferRead is not supported for the compute pipeline + vk::AccessFlagBits::eTransferRead, + vk::PipelineStageFlagBits::eComputeShader, + vk::PipelineStageFlagBits::eTransfer); + + this->mMemObjects[i]->recordCopyFromDeviceToStaging(commandBuffer); + + this->mMemObjects[i]->recordPrimaryMemoryBarrier( + commandBuffer, + // FIXME: eTransferRead is not supported for the compute pipeline + vk::AccessFlagBits::eTransferWrite, + vk::AccessFlagBits::eHostRead, + vk::PipelineStageFlagBits::eTransfer, + vk::PipelineStageFlagBits::eHost); + } + } +} + +void +OpSyncLocal::preEval(const vk::CommandBuffer& /*commandBuffer*/) +{ + KP_LOG_DEBUG("Kompute OpSyncLocal preEval called"); +} + +void +OpSyncLocal::postEval(const vk::CommandBuffer& /*commandBuffer*/) +{ + KP_LOG_DEBUG("Kompute OpSyncLocal postEval called"); + + KP_LOG_DEBUG("Kompute OpSyncLocal mapping data into tensor local"); +} + +} diff --git a/src/OpTensorSyncDevice.cpp b/src/OpTensorSyncDevice.cpp deleted file mode 100644 index c3c743b0..00000000 --- a/src/OpTensorSyncDevice.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -#include "kompute/operations/OpTensorSyncDevice.hpp" - -namespace kp { - -OpTensorSyncDevice::OpTensorSyncDevice( - const std::vector>& tensors) -{ - KP_LOG_DEBUG("Kompute OpTensorSyncDevice constructor with params"); - - if (tensors.size() < 1) { - throw std::runtime_error( - "Kompute OpTensorSyncDevice called with less than 1 tensor"); - } - - for (std::shared_ptr tensor : tensors) { - if (std::dynamic_pointer_cast(tensor) == nullptr) { - throw std::runtime_error( - "Kompute OpTensorSyncDevice: Memory object is not a Tensor"); - } - this->mTensors.push_back(std::dynamic_pointer_cast(tensor)); - } -} - -OpTensorSyncDevice::~OpTensorSyncDevice() -{ - KP_LOG_DEBUG("Kompute OpTensorSyncDevice destructor started"); - - this->mTensors.clear(); -} - -void -OpTensorSyncDevice::record(const vk::CommandBuffer& commandBuffer) -{ - KP_LOG_DEBUG("Kompute OpTensorSyncDevice record called"); - - for (size_t i = 0; i < this->mTensors.size(); i++) { - if (this->mTensors[i]->memoryType() == Tensor::MemoryTypes::eDevice) { - this->mTensors[i]->recordCopyFromStagingToDevice(commandBuffer); - } - } -} - -void -OpTensorSyncDevice::preEval(const vk::CommandBuffer& /*commandBuffer*/) -{ - KP_LOG_DEBUG("Kompute OpTensorSyncDevice preEval called"); -} - -void -OpTensorSyncDevice::postEval(const vk::CommandBuffer& /*commandBuffer*/) -{ - KP_LOG_DEBUG("Kompute OpTensorSyncDevice postEval called"); -} - -} diff --git a/src/OpTensorSyncLocal.cpp b/src/OpTensorSyncLocal.cpp deleted file mode 100644 index 3ffff043..00000000 --- a/src/OpTensorSyncLocal.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -#include "kompute/Tensor.hpp" - -#include "kompute/operations/OpTensorSyncLocal.hpp" - -namespace kp { - -OpTensorSyncLocal::OpTensorSyncLocal( - const std::vector>& tensors) -{ - KP_LOG_DEBUG("Kompute OpTensorSyncLocal constructor with params"); - - if (tensors.size() < 1) { - throw std::runtime_error( - "Kompute OpTensorSyncLocal called with less than 1 tensor"); - } - - for (std::shared_ptr tensor : tensors) { - if (std::dynamic_pointer_cast(tensor) == nullptr) { - throw std::runtime_error( - "Kompute OpTensorSyncLocal: Memory object is not a Tensor"); - } - this->mTensors.push_back(std::dynamic_pointer_cast(tensor)); - } -} - -OpTensorSyncLocal::~OpTensorSyncLocal() -{ - KP_LOG_DEBUG("Kompute OpTensorSyncLocal destructor started"); -} - -void -OpTensorSyncLocal::record(const vk::CommandBuffer& commandBuffer) -{ - KP_LOG_DEBUG("Kompute OpTensorSyncLocal record called"); - - for (size_t i = 0; i < this->mTensors.size(); i++) { - if (this->mTensors[i]->memoryType() == Memory::MemoryTypes::eDevice) { - - this->mTensors[i]->recordPrimaryMemoryBarrier( - commandBuffer, - vk::AccessFlagBits::eShaderWrite, - // FIXME: eTransferRead is not supported for the compute pipeline - vk::AccessFlagBits::eTransferRead, - vk::PipelineStageFlagBits::eComputeShader, - vk::PipelineStageFlagBits::eTransfer); - - this->mTensors[i]->recordCopyFromDeviceToStaging(commandBuffer); - - this->mTensors[i]->recordPrimaryMemoryBarrier( - commandBuffer, - // FIXME: eTransferRead is not supported for the compute pipeline - vk::AccessFlagBits::eTransferWrite, - vk::AccessFlagBits::eHostRead, - vk::PipelineStageFlagBits::eTransfer, - vk::PipelineStageFlagBits::eHost); - } - } -} - -void -OpTensorSyncLocal::preEval(const vk::CommandBuffer& /*commandBuffer*/) -{ - KP_LOG_DEBUG("Kompute OpTensorSyncLocal preEval called"); -} - -void -OpTensorSyncLocal::postEval(const vk::CommandBuffer& /*commandBuffer*/) -{ - KP_LOG_DEBUG("Kompute OpTensorSyncLocal postEval called"); - - KP_LOG_DEBUG("Kompute OpTensorSyncLocal mapping data into tensor local"); -} - -} diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt index 046deea5..b55f9f15 100644 --- a/src/include/CMakeLists.txt +++ b/src/include/CMakeLists.txt @@ -21,8 +21,8 @@ target_sources(kompute PRIVATE kompute/operations/OpMemoryBarrier.hpp kompute/operations/OpMult.hpp kompute/operations/OpTensorCopy.hpp - kompute/operations/OpTensorSyncDevice.hpp - kompute/operations/OpTensorSyncLocal.hpp + kompute/operations/OpSyncDevice.hpp + kompute/operations/OpSyncLocal.hpp kompute/logger/Logger.hpp ) diff --git a/src/include/kompute/Kompute.hpp b/src/include/kompute/Kompute.hpp index bb64635e..9eb7341e 100644 --- a/src/include/kompute/Kompute.hpp +++ b/src/include/kompute/Kompute.hpp @@ -11,14 +11,12 @@ #include "operations/OpBase.hpp" #include "operations/OpImageCopy.hpp" #include "operations/OpImageCopyToTensor.hpp" -#include "operations/OpImageSyncDevice.hpp" -#include "operations/OpImageSyncLocal.hpp" #include "operations/OpMemoryBarrier.hpp" #include "operations/OpMult.hpp" #include "operations/OpTensorCopy.hpp" #include "operations/OpTensorCopyToImage.hpp" -#include "operations/OpTensorSyncDevice.hpp" -#include "operations/OpTensorSyncLocal.hpp" +#include "operations/OpSyncDevice.hpp" +#include "operations/OpSyncLocal.hpp" // Will be build by CMake and placed inside the build directory #include "ShaderLogisticRegression.hpp" diff --git a/src/include/kompute/operations/OpImageSyncDevice.hpp b/src/include/kompute/operations/OpImageSyncDevice.hpp deleted file mode 100644 index 433d217d..00000000 --- a/src/include/kompute/operations/OpImageSyncDevice.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -#pragma once - -#include "kompute/Core.hpp" -#include "kompute/Image.hpp" -#include "kompute/operations/OpBase.hpp" - -namespace kp { - -/** - * Operation that syncs image's device by mapping local data into the device - * memory. For ImageTypes::eDevice it will use a record operation for the - * memory to be syncd into GPU memory which means that the operation will be - * done in sync with GPU commands. For ImageTypes::eHost it will only map the - * data into host memory which will happen during preEval before the recorded - * commands are dispatched. - */ -class OpImageSyncDevice : public OpBase -{ - public: - /** - * Default constructor with parameters that provides the core vulkan - * resources and the images that will be used in the operation. The tensos - * provided cannot be of type ImageTypes::eStorage. - * - * @param images Images that will be used to create in operation. - */ - OpImageSyncDevice(const std::vector>& images); - - /** - * Default destructor. This class does not manage memory so it won't be - * expecting the parent to perform a release. - */ - ~OpImageSyncDevice() override; - - /** - * For device images, it records the copy command for the image to copy - * the data from its staging to device memory. - * - * @param commandBuffer The command buffer to record the command into. - */ - void record(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any preEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void preEval(const vk::CommandBuffer& commandBuffer) override; - - /** - * Does not perform any postEval commands. - * - * @param commandBuffer The command buffer to record the command into. - */ - virtual void postEval(const vk::CommandBuffer& commandBuffer) override; - - private: - // -------------- ALWAYS OWNED RESOURCES - std::vector> mImages; -}; - -} // End namespace kp diff --git a/src/include/kompute/operations/OpTensorSyncDevice.hpp b/src/include/kompute/operations/OpSyncDevice.hpp similarity index 65% rename from src/include/kompute/operations/OpTensorSyncDevice.hpp rename to src/include/kompute/operations/OpSyncDevice.hpp index c2859e79..3b2f3c25 100644 --- a/src/include/kompute/operations/OpTensorSyncDevice.hpp +++ b/src/include/kompute/operations/OpSyncDevice.hpp @@ -8,33 +8,33 @@ namespace kp { /** - * Operation that syncs tensor's device by mapping local data into the device - * memory. For TensorTypes::eDevice it will use a record operation for the + * Operation that syncs mem object's device memory by mapping local data into the device + * memory. For MemoryTypes::eDevice it will use a record operation for the * memory to be syncd into GPU memory which means that the operation will be - * done in sync with GPU commands. For TensorTypes::eHost it will only map the + * done in sync with GPU commands. For MemoryTypes::eHost it will only map the * data into host memory which will happen during preEval before the recorded * commands are dispatched. */ -class OpTensorSyncDevice : public OpBase +class OpSyncDevice : public OpBase { public: /** * Default constructor with parameters that provides the core vulkan - * resources and the tensors that will be used in the operation. The tensos - * provided cannot be of type TensorTypes::eStorage. + * resources and the memory objects that will be used in the operation. The memory objects + * provided cannot be of type MemoryTypes::eStorage. * - * @param tensors Tensors that will be used to create in operation. + * @param memObjects Memory objects that will be used to create in operation. */ - OpTensorSyncDevice(const std::vector>& tensors); + OpSyncDevice(const std::vector>& memObjects); /** * Default destructor. This class does not manage memory so it won't be * expecting the parent to perform a release. */ - ~OpTensorSyncDevice() override; + ~OpSyncDevice() override; /** - * For device tensors, it records the copy command for the tensor to copy + * For device memory objects, it records the copy command for the memory object to copy * the data from its staging to device memory. * * @param commandBuffer The command buffer to record the command into. @@ -57,7 +57,7 @@ class OpTensorSyncDevice : public OpBase private: // -------------- ALWAYS OWNED RESOURCES - std::vector> mTensors; + std::vector> mMemObjects; }; } // End namespace kp diff --git a/src/include/kompute/operations/OpTensorSyncLocal.hpp b/src/include/kompute/operations/OpSyncLocal.hpp similarity index 79% rename from src/include/kompute/operations/OpTensorSyncLocal.hpp rename to src/include/kompute/operations/OpSyncLocal.hpp index 7564c0c1..58d02f42 100644 --- a/src/include/kompute/operations/OpTensorSyncLocal.hpp +++ b/src/include/kompute/operations/OpSyncLocal.hpp @@ -17,7 +17,7 @@ namespace kp { * only map the data into host memory which will happen during preEval before * the recorded commands are dispatched. */ -class OpTensorSyncLocal : public OpBase +class OpSyncLocal : public OpBase { public: /** @@ -25,18 +25,18 @@ class OpTensorSyncLocal : public OpBase * resources and the memory that will be used in the operation. The memory * provided cannot be of type MemoryTypes::eStorage. * - * @param tensors Tensors that will be used to create in operation. + * @param memObjects Memory objects that will be used to create in operation. */ - OpTensorSyncLocal(const std::vector>& tensors); + OpSyncLocal(const std::vector>& memObjects); /** * Default destructor. This class does not manage memory so it won't be * expecting the parent to perform a release. */ - ~OpTensorSyncLocal() override; + ~OpSyncLocal() override; /** - * For device tensors, it records the copy command for the tensor to copy + * For device memory objects, it records the copy command for the tensor to copy * the data from its device to staging memory. * * @param commandBuffer The command buffer to record the command into. @@ -51,7 +51,7 @@ class OpTensorSyncLocal : public OpBase virtual void preEval(const vk::CommandBuffer& commandBuffer) override; /** - * For host tensors it performs the map command from the host memory into + * For host memory objects it performs the map command from the host memory into * local memory. * * @param commandBuffer The command buffer to record the command into. @@ -60,7 +60,7 @@ class OpTensorSyncLocal : public OpBase private: // -------------- ALWAYS OWNED RESOURCES - std::vector> mTensors; + std::vector> mMemObjects; }; } // End namespace kp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c213be94..a012edc1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,7 +19,7 @@ add_executable(kompute_tests TestAsyncOperations.cpp TestOpTensorCopy.cpp TestOpTensorCopyToImage.cpp TestOpTensorCreate.cpp - TestOpTensorSync.cpp + TestOpSync.cpp TestPushConstant.cpp TestSequence.cpp TestSpecializationConstant.cpp @@ -28,7 +28,6 @@ add_executable(kompute_tests TestAsyncOperations.cpp TestImage.cpp TestOpImageCreate.cpp TestOpImageCopy.cpp - TestOpImageSync.cpp TestOpImageCopyToTensor.cpp) target_link_libraries(kompute_tests PRIVATE GTest::gtest_main diff --git a/test/TestAsyncOperations.cpp b/test/TestAsyncOperations.cpp index 24e37f33..92ec664b 100644 --- a/test/TestAsyncOperations.cpp +++ b/test/TestAsyncOperations.cpp @@ -58,9 +58,9 @@ TEST(TestAsyncOperations, TestManagerParallelExecution) algorithms.push_back(mgr.algorithm({ inputsSyncB[i] }, spirv)); } - sq->eval(inputsSyncB); + sq->eval(inputsSyncB); - mgr.sequence()->eval(inputsSyncB); + mgr.sequence()->eval(inputsSyncB); auto startSync = std::chrono::high_resolution_clock::now(); @@ -73,7 +73,7 @@ TEST(TestAsyncOperations, TestManagerParallelExecution) std::chrono::duration_cast(endSync - startSync) .count(); - sq->eval(inputsSyncB); + sq->eval(inputsSyncB); for (uint32_t i = 0; i < numParallel; i++) { EXPECT_EQ(inputsSyncB[i]->vector(), resultSync); @@ -111,7 +111,7 @@ TEST(TestAsyncOperations, TestManagerParallelExecution) endAsync - startAsync) .count(); - sq->eval({ inputsAsyncB }); + sq->eval({ inputsAsyncB }); for (uint32_t i = 0; i < numParallel; i++) { EXPECT_EQ((inputsAsyncB[i]->vector()), resultAsync); @@ -161,7 +161,7 @@ TEST(TestAsyncOperations, TestManagerAsyncExecution) std::shared_ptr sq1 = mgr.sequence(); std::shared_ptr sq2 = mgr.sequence(); - sq1->eval({ tensorA, tensorB }); + sq1->eval({ tensorA, tensorB }); std::shared_ptr algo1 = mgr.algorithm({ tensorA }, spirv); std::shared_ptr algo2 = mgr.algorithm({ tensorB }, spirv); @@ -178,7 +178,7 @@ TEST(TestAsyncOperations, TestManagerAsyncExecution) sq1->evalAwait(); sq2->evalAwait(); - sq1->evalAsync({ tensorA, tensorB }); + sq1->evalAsync({ tensorA, tensorB }); sq1->evalAwait(); EXPECT_EQ(tensorA->vector(), resultAsync); @@ -225,7 +225,7 @@ TEST(TestAsyncOperations, TestManagerAsyncExecutionTimeout) std::shared_ptr sq1 = mgr.sequence(); std::shared_ptr sq2 = mgr.sequence(); - sq1->eval({ tensorA, tensorB }); + sq1->eval({ tensorA, tensorB }); std::shared_ptr algo1 = mgr.algorithm({ tensorA }, spirv); std::shared_ptr algo2 = mgr.algorithm({ tensorB }, spirv); @@ -253,7 +253,7 @@ TEST(TestAsyncOperations, TestManagerAsyncExecutionTimeout) // of 1m ns) EXPECT_LT(duration, 100000); - sq1->evalAsync({ tensorA, tensorB }); + sq1->evalAsync({ tensorA, tensorB }); sq1->evalAwait(); EXPECT_EQ(tensorA->vector(), resultAsync); diff --git a/test/TestDestroy.cpp b/test/TestDestroy.cpp index 63052e9e..a7f2ce6d 100644 --- a/test/TestDestroy.cpp +++ b/test/TestDestroy.cpp @@ -36,14 +36,14 @@ TEST(TestDestroy, TestDestroyTensorSingle) mgr.algorithm({ tensorA }, spirv); // Sync values to and from device - mgr.sequence()->eval(algo->getMemObjects()); + mgr.sequence()->eval(algo->getMemObjects()); EXPECT_EQ(tensorA->vector(), initialValues); mgr.sequence() ->record(algo) ->eval() - ->eval(algo->getMemObjects()); + ->eval(algo->getMemObjects()); const std::vector expectedFinalValues = { 1.0f, 1.0f, 1.0f }; EXPECT_EQ(tensorA->vector(), expectedFinalValues); @@ -85,9 +85,9 @@ TEST(TestDestroy, TestDestroyTensorVector) mgr.algorithm({ tensorA, tensorB }, spirv); mgr.sequence() - ->record(algo->getMemObjects()) + ->record(algo->getMemObjects()) ->record(algo) - ->record(algo->getMemObjects()) + ->record(algo->getMemObjects()) ->eval(); EXPECT_EQ(tensorA->vector(), std::vector({ 2, 2, 2 })); @@ -127,9 +127,9 @@ TEST(TestDestroy, TestDestroySequenceSingle) sq = mgr.sequence() - ->record({ tensorA }) + ->record({ tensorA }) ->record(mgr.algorithm({ tensorA }, spirv)) - ->record({ tensorA }) + ->record({ tensorA }) ->eval(); sq->destroy(); diff --git a/test/TestLogisticRegression.cpp b/test/TestLogisticRegression.cpp index 955c5992..4fe2832f 100644 --- a/test/TestLogisticRegression.cpp +++ b/test/TestLogisticRegression.cpp @@ -38,7 +38,7 @@ TEST(TestLogisticRegression, TestMainLogisticRegression) wIn, wOutI, wOutJ, bIn, bOut, lOut }; - mgr.sequence()->eval(params); + mgr.sequence()->eval(params); std::vector spirv2{ 0x1, 0x2 }; @@ -51,9 +51,9 @@ TEST(TestLogisticRegression, TestMainLogisticRegression) std::shared_ptr sq = mgr.sequence() - ->record({ wIn, bIn }) + ->record({ wIn, bIn }) ->record(algorithm) - ->record({ wOutI, wOutJ, bOut, lOut }); + ->record({ wOutI, wOutJ, bOut, lOut }); // Iterate across all expected iterations for (size_t i = 0; i < ITERATIONS; i++) { @@ -115,7 +115,7 @@ TEST(TestLogisticRegression, TestMainLogisticRegressionManualCopy) wIn, wOutI, wOutJ, bIn, bOut, lOut }; - mgr.sequence()->record(params)->eval(); + mgr.sequence()->record(params)->eval(); std::vector spirv( kp::TEST_LOGISTIC_REGRESSION_SHADER_COMP_SPV.begin(), @@ -126,9 +126,9 @@ TEST(TestLogisticRegression, TestMainLogisticRegressionManualCopy) std::shared_ptr sq = mgr.sequence() - ->record({ wIn, bIn }) + ->record({ wIn, bIn }) ->record(algorithm) - ->record({ wOutI, wOutJ, bOut, lOut }); + ->record({ wOutI, wOutJ, bOut, lOut }); // Iterate across all expected iterations for (size_t i = 0; i < ITERATIONS; i++) { diff --git a/test/TestManager.cpp b/test/TestManager.cpp index 188e44af..f2eb62b1 100644 --- a/test/TestManager.cpp +++ b/test/TestManager.cpp @@ -18,9 +18,9 @@ TEST(TestManager, EndToEndOpMultEvalFlow) tensorOutput }; mgr.sequence() - ->eval(params) + ->eval(params) ->eval(params, mgr.algorithm()) - ->eval(params); + ->eval(params); EXPECT_EQ(tensorOutput->vector(), std::vector({ 0, 4, 12 })); } @@ -38,9 +38,9 @@ TEST(TestManager, EndToEndOpMultSeqFlow) tensorOutput }; mgr.sequence() - ->record(params) + ->record(params) ->record(params, mgr.algorithm()) - ->record(params) + ->record(params) ->eval(); EXPECT_EQ(tensorOutput->vector(), std::vector({ 0, 4, 12 })); @@ -58,9 +58,9 @@ TEST(TestManager, TestMultipleSequences) tensorRHS, tensorOutput }; - mgr.sequence()->eval(params); + mgr.sequence()->eval(params); mgr.sequence()->eval(params, mgr.algorithm()); - mgr.sequence()->eval(params); + mgr.sequence()->eval(params); EXPECT_EQ(tensorOutput->vector(), std::vector({ 0, 4, 12 })); } @@ -95,9 +95,9 @@ TEST(TestManager, TestClearDestroy) tensorRHS, tensorOutput }; - mgr.sequence()->eval(params); + mgr.sequence()->eval(params); mgr.sequence()->eval(params, mgr.algorithm()); - mgr.sequence()->eval(params); + mgr.sequence()->eval(params); EXPECT_EQ(tensorOutput->vector(), std::vector({ 0, 4, 12 })); } diff --git a/test/TestMultipleAlgoExecutions.cpp b/test/TestMultipleAlgoExecutions.cpp index 1ef0fb94..2fcca98b 100644 --- a/test/TestMultipleAlgoExecutions.cpp +++ b/test/TestMultipleAlgoExecutions.cpp @@ -59,14 +59,14 @@ TEST(TestMultipleAlgoExecutions, TestEndToEndFunctionality) // 3. Run operation with string shader synchronously mgr.sequence() - ->record(params) + ->record(params) ->record(algorithm) ->eval() ->record(algorithm, pushConstsB) ->eval(); auto sq = mgr.sequence(); - sq->evalAsync(params); + sq->evalAsync(params); sq->evalAwait(); @@ -103,13 +103,13 @@ TEST(TestMultipleAlgoExecutions, SingleSequenceRecord) }; mgr.sequence() - ->record({ tensorA }) + ->record({ tensorA }) ->record(mgr.algorithm({ tensorA }, spirv)) ->record(shaderBarrier) ->record(mgr.algorithm({ tensorA }, spirv)) ->record(shaderBarrier) ->record(mgr.algorithm({ tensorA }, spirv)) - ->record({ tensorA }) + ->record({ tensorA }) ->eval(); } @@ -138,7 +138,7 @@ TEST(TestMultipleAlgoExecutions, MultipleCmdBufRecords) std::shared_ptr sq = mgr.sequence(); - mgr.sequence()->record({ tensorA })->eval(); + mgr.sequence()->record({ tensorA })->eval(); mgr.sequence()->record(algorithm)->eval(); @@ -146,7 +146,7 @@ TEST(TestMultipleAlgoExecutions, MultipleCmdBufRecords) mgr.sequence()->record(algorithm)->eval(); - mgr.sequence()->record({ tensorA })->eval(); + mgr.sequence()->record({ tensorA })->eval(); EXPECT_EQ(tensorA->vector(), std::vector({ 3, 3, 3 })); } @@ -174,7 +174,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences) std::shared_ptr sq = mgr.sequence(); - sq->record({ tensorA })->eval(); + sq->record({ tensorA })->eval(); sq->record(algorithm)->eval(); @@ -182,7 +182,7 @@ TEST(TestMultipleAlgoExecutions, MultipleSequences) sq->record(algorithm)->eval(); - sq->record({ tensorA })->eval(); + sq->record({ tensorA })->eval(); EXPECT_EQ(tensorA->vector(), std::vector({ 3, 3, 3 })); } @@ -209,11 +209,11 @@ TEST(TestMultipleAlgoExecutions, SingleRecordMultipleEval) std::shared_ptr sq = mgr.sequence(); - sq->record({ tensorA })->eval(); + sq->record({ tensorA })->eval(); sq->record(algorithm)->eval()->eval()->eval(); - sq->record({ tensorA })->eval(); + sq->record({ tensorA })->eval(); EXPECT_EQ(tensorA->vector(), std::vector({ 3, 3, 3 })); } diff --git a/test/TestOpImageCopy.cpp b/test/TestOpImageCopy.cpp index 5d3beacc..2fd7766b 100644 --- a/test/TestOpImageCopy.cpp +++ b/test/TestOpImageCopy.cpp @@ -21,9 +21,9 @@ TEST(TestOpImageCopy, CopyDeviceToDeviceImage) EXPECT_TRUE(imageB->isInit()); mgr.sequence() - ->eval({ imageA, imageB }) + ->eval({ imageA, imageB }) ->eval({ imageA, imageB }) - ->eval({ imageA, imageB }); + ->eval({ imageA, imageB }); // Making sure the GPU holds the same vector EXPECT_EQ(imageA->vector(), imageB->vector()); @@ -48,9 +48,9 @@ TEST(TestOpImageCopy, CopyDeviceToDeviceImage2D) EXPECT_TRUE(imageB->isInit()); mgr.sequence() - ->eval({ imageA, imageB }) + ->eval({ imageA, imageB }) ->eval({ imageA, imageB }) - ->eval({ imageA, imageB }); + ->eval({ imageA, imageB }); // Making sure the GPU holds the same vector EXPECT_EQ(imageA->vector(), imageB->vector()); @@ -79,9 +79,9 @@ TEST(TestOpImageCopy, CopyDeviceToDeviceImageMulti) EXPECT_TRUE(tensorC->isInit()); mgr.sequence() - ->eval({ imageA }) + ->eval({ imageA }) ->eval({ imageA, imageB, tensorC }) - ->eval({ imageB, tensorC }); + ->eval({ imageB, tensorC }); EXPECT_EQ(imageA->vector(), testVecA); EXPECT_EQ(imageB->vector(), testVecA); @@ -100,7 +100,7 @@ TEST(TestOpImageCopy, CopyDeviceToHostImage) mgr.image(testVecB, 3, 1, 1, kp::Memory::MemoryTypes::eHost); // Only calling sync on device type tensor - mgr.sequence()->eval({ imageA }); + mgr.sequence()->eval({ imageA }); EXPECT_TRUE(imageA->isInit()); EXPECT_TRUE(imageB->isInit()); @@ -110,7 +110,7 @@ TEST(TestOpImageCopy, CopyDeviceToHostImage) EXPECT_EQ(imageA->vector(), imageB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ imageB }); + mgr.sequence()->eval({ imageB }); EXPECT_EQ(imageA->vector(), imageB->vector()); } @@ -126,7 +126,7 @@ TEST(TestOpImageCopy, CopyHostToDeviceImage) std::shared_ptr> imageB = mgr.image(testVecB, 3, 1, 1); // Only calling sync on device type tensor - mgr.sequence()->eval({ imageA, imageB }); + mgr.sequence()->eval({ imageA, imageB }); EXPECT_TRUE(imageA->isInit()); EXPECT_TRUE(imageB->isInit()); @@ -136,7 +136,7 @@ TEST(TestOpImageCopy, CopyHostToDeviceImage) EXPECT_EQ(imageA->vector(), imageB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ imageB }); + mgr.sequence()->eval({ imageB }); EXPECT_EQ(imageA->vector(), imageB->vector()); } @@ -156,13 +156,13 @@ TEST(TestOpImageCopy, CopyHostToHostImage) EXPECT_TRUE(imageB->isInit()); mgr.sequence() - ->eval({ imageA }) + ->eval({ imageA }) ->eval({ imageA, imageB }); EXPECT_EQ(imageA->vector(), imageB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ imageB }); + mgr.sequence()->eval({ imageB }); EXPECT_EQ(imageA->vector(), imageB->vector()); } @@ -211,10 +211,10 @@ TEST(TestOpImageCopy, CopyThroughStorageImage) mgr.image({ 0, 0, 0 }, 3, 1, 1, kp::Memory::MemoryTypes::eStorage); mgr.sequence() - ->eval({ ImageIn, ImageOut }) + ->eval({ ImageIn, ImageOut }) ->eval({ ImageIn, tensorStorage }) ->eval({ tensorStorage, ImageOut }) - ->eval({ ImageIn, ImageOut }); + ->eval({ ImageIn, ImageOut }); // Making sure the GPU holds the same vector EXPECT_EQ(ImageIn->vector(), ImageOut->vector()); @@ -274,10 +274,10 @@ TEST(TestOpImageCopy, CopyImageThroughStorageViaAlgorithms) mgr.algorithm({ tensorStorage, ImageOut }, compileSource(shaderB)); mgr.sequence() - ->eval({ ImageIn }) + ->eval({ ImageIn }) ->eval(algoA) ->eval(algoB) - ->eval({ ImageOut }); + ->eval({ ImageOut }); // Making sure the GPU holds the same vector EXPECT_EQ(ImageIn->vector(), ImageOut->vector()); @@ -296,9 +296,9 @@ TEST(TestOpImageCopy, CopyDeviceToDeviceImageUninitialised) EXPECT_TRUE(imageB->isInit()); mgr.sequence() - ->eval({ imageA, imageB }) + ->eval({ imageA, imageB }) ->eval({ imageA, imageB }) - ->eval({ imageA, imageB }); + ->eval({ imageA, imageB }); // Making sure the GPU holds the same vector EXPECT_EQ(imageA->vector(), imageB->vector()); @@ -358,10 +358,10 @@ TEST(TestOpImageCopy, CopyImageThroughStorageViaAlgorithmsUninitialisedOutput) mgr.algorithm({ tensorStorage, ImageOut }, compileSource(shaderB)); mgr.sequence() - ->eval({ ImageIn }) + ->eval({ ImageIn }) ->eval(algoA) ->eval(algoB) - ->eval({ ImageOut }); + ->eval({ ImageOut }); // Making sure the GPU holds the same vector EXPECT_EQ(ImageIn->vector(), ImageOut->vector()); diff --git a/test/TestOpImageCopyToTensor.cpp b/test/TestOpImageCopyToTensor.cpp index 1159c080..f7612ec7 100644 --- a/test/TestOpImageCopyToTensor.cpp +++ b/test/TestOpImageCopyToTensor.cpp @@ -23,11 +23,11 @@ TEST(TestOpImageCopyToTensor, CopyDeviceToDeviceTensor) EXPECT_TRUE(image->isInit()); mgr.sequence() - ->eval({ tensor }) - ->eval({ image }) + ->eval({ tensor }) + ->eval({ image }) ->eval({ image, tensor }) - ->eval({ tensor }) - ->eval({ image }); + ->eval({ tensor }) + ->eval({ image }); // Making sure the GPU holds the same vector EXPECT_EQ(tensor->vector(), image->vector()); @@ -52,9 +52,9 @@ TEST(TestOpImageCopyToTensor, CopyDeviceToDeviceTensorMulti) EXPECT_TRUE(tensorC->isInit()); mgr.sequence() - ->eval({ imageA }) + ->eval({ imageA }) ->eval({ imageA, tensorB, tensorC }) - ->eval({ tensorB, tensorC }); + ->eval({ tensorB, tensorC }); EXPECT_EQ(testVecA, imageA->vector()); EXPECT_EQ(testVecA, tensorB->vector()); @@ -75,7 +75,7 @@ TEST(TestOpImageCopyToTensor, CopyDeviceToHostTensor) mgr.tensor(testVecB, kp::Memory::MemoryTypes::eHost); // Only calling sync on device type tensor - mgr.sequence()->eval({ imageA }); + mgr.sequence()->eval({ imageA }); EXPECT_TRUE(imageA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -85,7 +85,7 @@ TEST(TestOpImageCopyToTensor, CopyDeviceToHostTensor) EXPECT_EQ(imageA->vector(), tensorB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ tensorB }); + mgr.sequence()->eval({ tensorB }); EXPECT_EQ(imageA->vector(), tensorB->vector()); } @@ -102,8 +102,8 @@ TEST(TestOpImageCopyToTensor, CopyHostToDeviceTensor) std::shared_ptr> tensorB = mgr.tensor(testVecB); // Only calling sync on device type tensor - mgr.sequence()->eval({ imageA }); - mgr.sequence()->eval({ tensorB }); + mgr.sequence()->eval({ imageA }); + mgr.sequence()->eval({ tensorB }); EXPECT_TRUE(imageA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -113,7 +113,7 @@ TEST(TestOpImageCopyToTensor, CopyHostToDeviceTensor) EXPECT_EQ(imageA->vector(), tensorB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ tensorB }); + mgr.sequence()->eval({ tensorB }); EXPECT_EQ(imageA->vector(), tensorB->vector()); } @@ -134,13 +134,13 @@ TEST(TestOpImageCopyToTensor, CopyHostToHostTensor) EXPECT_TRUE(tensorB->isInit()); mgr.sequence() - ->eval({ imageA }) + ->eval({ imageA }) ->eval({ imageA, tensorB }); EXPECT_EQ(imageA->vector(), tensorB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ tensorB }); + mgr.sequence()->eval({ tensorB }); EXPECT_EQ(imageA->vector(), tensorB->vector()); } @@ -209,12 +209,12 @@ TEST(TestOpImageCopyToTensor, CopyThroughStorageTensor) testVecIn, testVecIn.size(), 1, 1, kp::Memory::MemoryTypes::eStorage); mgr.sequence() - ->eval({ imageIn }) - ->eval({ tensorOut }) + ->eval({ imageIn }) + ->eval({ tensorOut }) ->eval({ imageIn, imageStorage }) ->eval({ imageStorage, tensorOut }) - ->eval({ imageIn }) - ->eval({ tensorOut }); + ->eval({ imageIn }) + ->eval({ tensorOut }); // Making sure the GPU holds the same vector EXPECT_EQ(imageIn->vector(), tensorOut->vector()); @@ -234,13 +234,13 @@ TEST(TestOpImageCopyToTensor, CopyDeviceToDeviceImageUninitialised) EXPECT_TRUE(tensorB->isInit()); mgr.sequence() - ->eval({ imageA }) - ->eval({ tensorB }) + ->eval({ imageA }) + ->eval({ tensorB }) ->eval({ imageA, tensorB }) - ->eval({ + ->eval({ imageA, }) - ->eval({ tensorB }); + ->eval({ tensorB }); // Making sure the GPU holds the same vector EXPECT_EQ(imageA->vector(), tensorB->vector()); diff --git a/test/TestOpShadersFromStringAndFile.cpp b/test/TestOpShadersFromStringAndFile.cpp index 7d4c4519..cc9949d4 100644 --- a/test/TestOpShadersFromStringAndFile.cpp +++ b/test/TestOpShadersFromStringAndFile.cpp @@ -67,9 +67,9 @@ TEST(TestShader, ShaderRawDataFromConstructorCustomDataType) std::vector> params = { tensorA, tensorB }; mgr.sequence() - ->eval(params) + ->eval(params) ->eval(mgr.algorithm(params, spirv)) - ->eval(params); + ->eval(params); EXPECT_EQ(tensorA->vector(), std::vector({ TestStruct{ 0.1, 2, 3 } })); @@ -130,9 +130,9 @@ TEST(TestOpAlgoCreate, ShaderRawDataFromConstructor) std::vector> params = { tensorA, tensorB }; mgr.sequence() - ->eval(params) + ->eval(params) ->eval(mgr.algorithm(params, spirv)) - ->eval(params); + ->eval(params); EXPECT_EQ(tensorA->vector(), std::vector({ 0, 1, 2 })); EXPECT_EQ(tensorB->vector(), std::vector({ 3, 4, 5 })); @@ -150,9 +150,9 @@ TEST(TestOpAlgoCreate, ShaderCompiledDataFromConstructor) std::vector> params = { tensorA, tensorB }; mgr.sequence() - ->eval(params) + ->eval(params) ->eval(mgr.algorithm(params, spirv)) - ->eval(params); + ->eval(params); EXPECT_EQ(tensorA->vector(), std::vector({ 0, 1, 2 })); EXPECT_EQ(tensorB->vector(), std::vector({ 3, 4, 5 })); diff --git a/test/TestOpImageSync.cpp b/test/TestOpSync.cpp similarity index 50% rename from test/TestOpImageSync.cpp rename to test/TestOpSync.cpp index 865544ff..f3c1561c 100644 --- a/test/TestOpImageSync.cpp +++ b/test/TestOpSync.cpp @@ -5,7 +5,54 @@ #include "kompute/Kompute.hpp" #include "kompute/logger/Logger.hpp" -TEST(TestOpImageSync, SyncToDeviceMemorySingleImage) +TEST(TestOpSync, SyncToDeviceMemorySingleTensor) +{ + kp::Manager mgr; + + std::vector testVecPreA{ 0, 0, 0 }; + std::vector testVecPostA{ 9, 8, 7 }; + + std::shared_ptr> tensorA = mgr.tensor(testVecPreA); + + EXPECT_TRUE(tensorA->isInit()); + + tensorA->setData(testVecPostA); + + mgr.sequence()->eval({ tensorA }); + + mgr.sequence()->eval({ tensorA }); + + EXPECT_EQ(tensorA->vector(), testVecPostA); +} + +TEST(TestOpSync, SyncToDeviceMemoryMultiTensor) +{ + kp::Manager mgr; + + std::vector testVec{ 9, 8, 7 }; + + std::shared_ptr> tensorA = mgr.tensor({ 0, 0, 0 }); + std::shared_ptr> tensorB = mgr.tensor({ 0, 0, 0 }); + std::shared_ptr> tensorC = mgr.tensor({ 0, 0, 0 }); + + EXPECT_TRUE(tensorA->isInit()); + EXPECT_TRUE(tensorB->isInit()); + EXPECT_TRUE(tensorC->isInit()); + + tensorA->setData(testVec); + + mgr.sequence()->eval({ tensorA }); + + mgr.sequence()->eval({ tensorA, tensorB, tensorC }); + + mgr.sequence()->eval({ tensorA, tensorB, tensorC }); + + EXPECT_EQ(tensorA->vector(), testVec); + EXPECT_EQ(tensorB->vector(), testVec); + EXPECT_EQ(tensorC->vector(), testVec); +} + +TEST(TestOpSync, SyncToDeviceMemorySingleImage) { kp::Manager mgr; @@ -18,16 +65,15 @@ TEST(TestOpImageSync, SyncToDeviceMemorySingleImage) imageA->setData(testVecPostA); - mgr.sequence()->eval({ imageA }); + mgr.sequence()->eval({ imageA }); - mgr.sequence()->eval({ imageA }); + mgr.sequence()->eval({ imageA }); EXPECT_EQ(imageA->vector(), testVecPostA); } -TEST(TestOpImageSync, SyncToDeviceMemoryMultiImage) +TEST(TestOpSync, SyncToDeviceMemoryMultiImage) { - kp::Manager mgr; std::vector testVec{ 9, 8, 7 }; @@ -42,18 +88,18 @@ TEST(TestOpImageSync, SyncToDeviceMemoryMultiImage) imageA->setData(testVec); - mgr.sequence()->eval({ imageA }); + mgr.sequence()->eval({ imageA }); mgr.sequence()->eval({ imageA, imageB, imageC }); - mgr.sequence()->eval({ imageA, imageB, imageC }); + mgr.sequence()->eval({ imageA, imageB, imageC }); EXPECT_EQ(imageA->vector(), testVec); EXPECT_EQ(imageB->vector(), testVec); EXPECT_EQ(imageC->vector(), testVec); } -TEST(TestOpImageSync, NegativeUnrelatedImageSync) +TEST(TestOpSync, NegativeUnrelatedImageSync) { kp::Manager mgr; @@ -68,24 +114,9 @@ TEST(TestOpImageSync, NegativeUnrelatedImageSync) // Syncing one image to the device should not update an unrelated one mgr.sequence() - ->eval({ ImageIn }) - ->eval({ ImageOut }); + ->eval({ ImageIn }) + ->eval({ ImageOut }); // Making sure the GPU holds the same vector EXPECT_NE(ImageIn->vector(), ImageOut->vector()); } - -TEST(TestOpImageSync, TensorShouldFail) -{ - kp::Manager mgr; - - std::vector testVecPreA{ 0, 0, 0 }; - - std::shared_ptr> tensor = mgr.tensor(testVecPreA); - - EXPECT_THROW(mgr.sequence()->eval({ tensor }), - std::runtime_error); - - EXPECT_THROW(mgr.sequence()->eval({ tensor }), - std::runtime_error); -} diff --git a/test/TestOpTensorCopy.cpp b/test/TestOpTensorCopy.cpp index 82d7b4d3..ea15425a 100644 --- a/test/TestOpTensorCopy.cpp +++ b/test/TestOpTensorCopy.cpp @@ -22,9 +22,9 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensor) EXPECT_TRUE(tensorB->isInit()); mgr.sequence() - ->eval({ tensorA, tensorB }) + ->eval({ tensorA, tensorB }) ->eval({ tensorA, tensorB }) - ->eval({ tensorA, tensorB }); + ->eval({ tensorA, tensorB }); // Making sure the GPU holds the same vector EXPECT_EQ(tensorA->vector(), tensorB->vector()); @@ -48,9 +48,9 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensorMulti) EXPECT_TRUE(tensorC->isInit()); mgr.sequence() - ->eval({ tensorA }) + ->eval({ tensorA }) ->eval({ tensorA, tensorB, tensorC }) - ->eval({ tensorB, tensorC }); + ->eval({ tensorB, tensorC }); EXPECT_EQ(testVecA, tensorA->vector()); EXPECT_EQ(testVecA, tensorB->vector()); @@ -70,7 +70,7 @@ TEST(TestOpTensorCopy, CopyDeviceToHostTensor) mgr.tensor(testVecB, kp::Memory::MemoryTypes::eHost); // Only calling sync on device type tensor - mgr.sequence()->eval({ tensorA }); + mgr.sequence()->eval({ tensorA }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -80,7 +80,7 @@ TEST(TestOpTensorCopy, CopyDeviceToHostTensor) EXPECT_EQ(tensorA->vector(), tensorB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ tensorB }); + mgr.sequence()->eval({ tensorB }); EXPECT_EQ(tensorA->vector(), tensorB->vector()); } @@ -97,7 +97,7 @@ TEST(TestOpTensorCopy, CopyHostToDeviceTensor) std::shared_ptr> tensorB = mgr.tensor(testVecB); // Only calling sync on device type tensor - mgr.sequence()->eval({ tensorA, tensorB }); + mgr.sequence()->eval({ tensorA, tensorB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(tensorB->isInit()); @@ -107,7 +107,7 @@ TEST(TestOpTensorCopy, CopyHostToDeviceTensor) EXPECT_EQ(tensorA->vector(), tensorB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ tensorB }); + mgr.sequence()->eval({ tensorB }); EXPECT_EQ(tensorA->vector(), tensorB->vector()); } @@ -128,13 +128,13 @@ TEST(TestOpTensorCopy, CopyHostToHostTensor) EXPECT_TRUE(tensorB->isInit()); mgr.sequence() - ->eval({ tensorA }) + ->eval({ tensorA }) ->eval({ tensorA, tensorB }); EXPECT_EQ(tensorA->vector(), tensorB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ tensorB }); + mgr.sequence()->eval({ tensorB }); EXPECT_EQ(tensorA->vector(), tensorB->vector()); } @@ -184,10 +184,10 @@ TEST(TestOpTensorCopy, CopyThroughStorageTensor) mgr.tensor({ 0, 0, 0 }, kp::Memory::MemoryTypes::eStorage); mgr.sequence() - ->eval({ tensorIn, tensorOut }) + ->eval({ tensorIn, tensorOut }) ->eval({ tensorIn, tensorStorage }) ->eval({ tensorStorage, tensorOut }) - ->eval({ tensorIn, tensorOut }); + ->eval({ tensorIn, tensorOut }); // Making sure the GPU holds the same vector EXPECT_EQ(tensorIn->vector(), tensorOut->vector()); @@ -247,10 +247,10 @@ TEST(TestOpTensorCopy, CopyTensorThroughStorageViaAlgorithms) mgr.algorithm({ tensorStorage, tensorOut }, compileSource(shaderB)); mgr.sequence() - ->eval({ tensorIn }) + ->eval({ tensorIn }) ->eval(algoA) ->eval(algoB) - ->eval({ tensorOut }); + ->eval({ tensorOut }); // Making sure the GPU holds the same vector EXPECT_EQ(tensorIn->vector(), tensorOut->vector()); @@ -269,9 +269,9 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensorUninitialised) EXPECT_TRUE(tensorB->isInit()); mgr.sequence() - ->eval({ tensorA, tensorB }) + ->eval({ tensorA, tensorB }) ->eval({ tensorA, tensorB }) - ->eval({ tensorA, tensorB }); + ->eval({ tensorA, tensorB }); // Making sure the GPU holds the same vector EXPECT_EQ(tensorA->vector(), tensorB->vector()); @@ -332,10 +332,10 @@ TEST(TestOpTensorCopy, CopyTensorThroughStorageViaAlgorithmsUninitialisedOutput) mgr.algorithm({ tensorStorage, tensorOut }, compileSource(shaderB)); mgr.sequence() - ->eval({ tensorIn }) + ->eval({ tensorIn }) ->eval(algoA) ->eval(algoB) - ->eval({ tensorOut }); + ->eval({ tensorOut }); // Making sure the GPU holds the same vector EXPECT_EQ(tensorIn->vector(), tensorOut->vector()); diff --git a/test/TestOpTensorCopyToImage.cpp b/test/TestOpTensorCopyToImage.cpp index eefa91d4..4dd9af88 100644 --- a/test/TestOpTensorCopyToImage.cpp +++ b/test/TestOpTensorCopyToImage.cpp @@ -23,11 +23,11 @@ TEST(TestOpTensorCopyToImage, CopyDeviceToDeviceTensor) EXPECT_TRUE(image->isInit()); mgr.sequence() - ->eval({ tensor }) - ->eval({ image }) + ->eval({ tensor }) + ->eval({ image }) ->eval({ tensor, image }) - ->eval({ tensor }) - ->eval({ image }); + ->eval({ tensor }) + ->eval({ image }); // Making sure the GPU holds the same vector EXPECT_EQ(tensor->vector(), image->vector()); @@ -53,9 +53,9 @@ TEST(TestOpTensorCopyToImage, CopyDeviceToDeviceTensorMulti) EXPECT_TRUE(imageC->isInit()); mgr.sequence() - ->eval({ tensorA }) + ->eval({ tensorA }) ->eval({ tensorA, imageB, imageC }) - ->eval({ imageB, imageC }); + ->eval({ imageB, imageC }); // Making sure the GPU holds the same vector EXPECT_EQ(testVecA, tensorA->vector()); @@ -76,7 +76,7 @@ TEST(TestOpTensorCopyToImage, CopyDeviceToHostTensor) testVecB, testVecB.size(), 1, 1, kp::Memory::MemoryTypes::eHost); // Only calling sync on device type tensor - mgr.sequence()->eval({ tensorA }); + mgr.sequence()->eval({ tensorA }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(imageB->isInit()); @@ -86,7 +86,7 @@ TEST(TestOpTensorCopyToImage, CopyDeviceToHostTensor) EXPECT_EQ(tensorA->vector(), imageB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ imageB }); + mgr.sequence()->eval({ imageB }); EXPECT_EQ(tensorA->vector(), imageB->vector()); } @@ -104,8 +104,8 @@ TEST(TestOpTensorCopyToImage, CopyHostToDeviceTensor) mgr.image(testVecB, testVecB.size(), 1, 1); // Only calling sync on device type tensor - mgr.sequence()->eval({ tensorA }); - mgr.sequence()->eval({ imageB }); + mgr.sequence()->eval({ tensorA }); + mgr.sequence()->eval({ imageB }); EXPECT_TRUE(tensorA->isInit()); EXPECT_TRUE(imageB->isInit()); @@ -115,7 +115,7 @@ TEST(TestOpTensorCopyToImage, CopyHostToDeviceTensor) EXPECT_EQ(tensorA->vector(), imageB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ imageB }); + mgr.sequence()->eval({ imageB }); EXPECT_EQ(tensorA->vector(), imageB->vector()); } @@ -136,13 +136,13 @@ TEST(TestOpTensorCopyToImage, CopyHostToHostTensor) EXPECT_TRUE(imageB->isInit()); mgr.sequence() - ->eval({ tensorA }) + ->eval({ tensorA }) ->eval({ tensorA, imageB }); EXPECT_EQ(tensorA->vector(), imageB->vector()); // Making sure the GPU holds the same vector - mgr.sequence()->eval({ imageB }); + mgr.sequence()->eval({ imageB }); EXPECT_EQ(tensorA->vector(), imageB->vector()); } @@ -211,12 +211,12 @@ TEST(TestOpTensorCopyToImage, CopyThroughStorageTensor) mgr.tensor({ 0, 0, 0 }, kp::Memory::MemoryTypes::eStorage); mgr.sequence() - ->eval({ tensorIn }) - ->eval({ imageOut }) + ->eval({ tensorIn }) + ->eval({ imageOut }) ->eval({ tensorIn, tensorStorage }) ->eval({ tensorStorage, imageOut }) - ->eval({ tensorIn }) - ->eval({ imageOut }); + ->eval({ tensorIn }) + ->eval({ imageOut }); // Making sure the GPU holds the same vector EXPECT_EQ(tensorIn->vector(), imageOut->vector()); @@ -236,13 +236,13 @@ TEST(TestOpTensorCopyToImage, CopyDeviceToDeviceImageUninitialised) EXPECT_TRUE(imageB->isInit()); mgr.sequence() - ->eval({ tensorA }) - ->eval({ imageB }) + ->eval({ tensorA }) + ->eval({ imageB }) ->eval({ tensorA, imageB }) - ->eval({ + ->eval({ tensorA, }) - ->eval({ imageB }); + ->eval({ imageB }); // Making sure the GPU holds the same vector EXPECT_EQ(tensorA->vector(), imageB->vector()); diff --git a/test/TestOpTensorSync.cpp b/test/TestOpTensorSync.cpp deleted file mode 100644 index ab2d242b..00000000 --- a/test/TestOpTensorSync.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -#include "gtest/gtest.h" - -#include "kompute/Kompute.hpp" -#include "kompute/logger/Logger.hpp" - -TEST(TestOpTensorSync, SyncToDeviceMemorySingleTensor) -{ - - kp::Manager mgr; - - std::vector testVecPreA{ 0, 0, 0 }; - std::vector testVecPostA{ 9, 8, 7 }; - - std::shared_ptr> tensorA = mgr.tensor(testVecPreA); - - EXPECT_TRUE(tensorA->isInit()); - - tensorA->setData(testVecPostA); - - mgr.sequence()->eval({ tensorA }); - - mgr.sequence()->eval({ tensorA }); - - EXPECT_EQ(tensorA->vector(), testVecPostA); -} - -TEST(TestOpTensorSync, SyncToDeviceMemoryMultiTensor) -{ - - kp::Manager mgr; - - std::vector testVec{ 9, 8, 7 }; - - std::shared_ptr> tensorA = mgr.tensor({ 0, 0, 0 }); - std::shared_ptr> tensorB = mgr.tensor({ 0, 0, 0 }); - std::shared_ptr> tensorC = mgr.tensor({ 0, 0, 0 }); - - EXPECT_TRUE(tensorA->isInit()); - EXPECT_TRUE(tensorB->isInit()); - EXPECT_TRUE(tensorC->isInit()); - - tensorA->setData(testVec); - - mgr.sequence()->eval({ tensorA }); - - mgr.sequence()->eval({ tensorA, tensorB, tensorC }); - - mgr.sequence()->eval({ tensorA, tensorB, tensorC }); - - EXPECT_EQ(tensorA->vector(), testVec); - EXPECT_EQ(tensorB->vector(), testVec); - EXPECT_EQ(tensorC->vector(), testVec); -} -TEST(TestOpTensorSync, ImageShouldFail) -{ - kp::Manager mgr; - - std::vector testVecPreA{ 0, 0, 0 }; - - std::shared_ptr> image = mgr.image(testVecPreA, 3, 1, 1); - - EXPECT_THROW(mgr.sequence()->eval({ image }), - std::runtime_error); - - EXPECT_THROW(mgr.sequence()->eval({ image }), - std::runtime_error); -} diff --git a/test/TestPushConstant.cpp b/test/TestPushConstant.cpp index 1356425c..d575a62f 100644 --- a/test/TestPushConstant.cpp +++ b/test/TestPushConstant.cpp @@ -38,7 +38,7 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchOverride) std::shared_ptr algo = mgr.algorithm( { tensor }, spirv, kp::Workgroup({ 1 }), {}, { 0.0, 0.0, 0.0 }); - sq = mgr.sequence()->eval({ tensor }); + sq = mgr.sequence()->eval({ tensor }); // We need to run this in sequence to avoid race condition // We can't use atomicAdd as swiftshader doesn't support it for @@ -47,7 +47,7 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchOverride) std::vector{ 0.1, 0.2, 0.3 }); sq->eval(algo, std::vector{ 0.3, 0.2, 0.1 }); - sq->eval({ tensor }); + sq->eval({ tensor }); EXPECT_EQ(tensor->vector(), std::vector({ 0.4, 0.4, 0.4 })); } @@ -85,7 +85,7 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchNoOverride) std::shared_ptr algo = mgr.algorithm( { tensor }, spirv, kp::Workgroup({ 1 }), {}, { 0.1, 0.2, 0.3 }); - sq = mgr.sequence()->eval({ tensor }); + sq = mgr.sequence()->eval({ tensor }); // We need to run this in sequence to avoid race condition // We can't use atomicAdd as swiftshader doesn't support it for @@ -93,7 +93,7 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchNoOverride) sq->eval(algo); sq->eval(algo, std::vector{ 0.3, 0.2, 0.1 }); - sq->eval({ tensor }); + sq->eval({ tensor }); EXPECT_EQ(tensor->vector(), std::vector({ 0.4, 0.4, 0.4 })); } @@ -131,7 +131,7 @@ TEST(TestPushConstants, TestConstantsWrongSize) std::shared_ptr algo = mgr.algorithm( { tensor }, spirv, kp::Workgroup({ 1 }), {}, { 0.0 }); - sq = mgr.sequence()->record({ tensor }); + sq = mgr.sequence()->record({ tensor }); EXPECT_THROW(sq->record( algo, std::vector{ 0.1, 0.2, 0.3 }), @@ -172,7 +172,7 @@ TEST(TestPushConstants, TestConstantsWrongSize) // std::shared_ptr algo = mgr.algorithm( // { tensor }, spirv, kp::Workgroup({ 1 }), {}, { 0.0 }); // -// sq = mgr.sequence()->record({ tensor }); +// sq = mgr.sequence()->record({ tensor }); // // EXPECT_THROW(sq->record( // algo, std::vector{ 1, 2, 3 }), @@ -220,7 +220,7 @@ TEST(TestPushConstants, TestConstantsMixedTypes) mgr.algorithm( { tensor }, spirv, kp::Workgroup({ 1 }), {}, { { 0, 0, 0 } }); - sq = mgr.sequence()->eval({ tensor }); + sq = mgr.sequence()->eval({ tensor }); // We need to run this in sequence to avoid race condition // We can't use atomicAdd as swiftshader doesn't support it for @@ -229,7 +229,7 @@ TEST(TestPushConstants, TestConstantsMixedTypes) algo, std::vector{ { 15.32, 2147483650, 10 } }); sq->eval( algo, std::vector{ { 30.32, 2147483650, -3 } }); - sq->eval({ tensor }); + sq->eval({ tensor }); EXPECT_EQ(tensor->vector(), std::vector({ 45.64, 1300, 7 })); } @@ -268,7 +268,7 @@ TEST(TestPushConstants, TestConstantsInt) mgr.algorithm( { tensor }, spirv, kp::Workgroup({ 1 }), {}, { { 0, 0, 0 } }); - sq = mgr.sequence()->eval({ tensor }); + sq = mgr.sequence()->eval({ tensor }); // We need to run this in sequence to avoid race condition // We can't use atomicAdd as swiftshader doesn't support it for @@ -277,7 +277,7 @@ TEST(TestPushConstants, TestConstantsInt) algo, std::vector{ { -1, -1, -1 } }); sq->eval( algo, std::vector{ { -1, -1, -1 } }); - sq->eval({ tensor }); + sq->eval({ tensor }); EXPECT_EQ(tensor->vector(), std::vector({ -3, -3, -3 })); } @@ -316,7 +316,7 @@ TEST(TestPushConstants, TestConstantsUnsignedInt) mgr.algorithm( { tensor }, spirv, kp::Workgroup({ 1 }), {}, { { 0, 0, 0 } }); - sq = mgr.sequence()->eval({ tensor }); + sq = mgr.sequence()->eval({ tensor }); // We need to run this in sequence to avoid race condition // We can't use atomicAdd as swiftshader doesn't support it for @@ -326,7 +326,7 @@ TEST(TestPushConstants, TestConstantsUnsignedInt) std::vector{ { 2147483650, 2147483650, 2147483650 } }); sq->eval(algo, std::vector{ { 5, 5, 5 } }); - sq->eval({ tensor }); + sq->eval({ tensor }); EXPECT_EQ( tensor->vector(), @@ -366,7 +366,7 @@ TEST(TestPushConstants, TestConstantsDouble) std::shared_ptr algo = mgr.algorithm( { tensor }, spirv, kp::Workgroup({ 1 }), {}, { { 0, 0, 0 } }); - sq = mgr.sequence()->eval({ tensor }); + sq = mgr.sequence()->eval({ tensor }); // We need to run this in sequence to avoid race condition // We can't use atomicAdd as swiftshader doesn't support it for @@ -381,7 +381,7 @@ TEST(TestPushConstants, TestConstantsDouble) std::vector{ { 1.1111222233334444, 2.1111222233334444, 3.1111222233334444 } }); - sq->eval({ tensor }); + sq->eval({ tensor }); EXPECT_EQ(tensor->vector(), std::vector({ 2.2222444466668888, diff --git a/test/TestSequence.cpp b/test/TestSequence.cpp index d99107a9..3a4cce66 100644 --- a/test/TestSequence.cpp +++ b/test/TestSequence.cpp @@ -68,7 +68,7 @@ TEST(TestSequence, RerecordSequence) std::shared_ptr> tensorB = mgr.tensor({ 2, 2, 2 }); std::shared_ptr> tensorOut = mgr.tensor({ 0, 0, 0 }); - sq->eval({ tensorA, tensorB, tensorOut }); + sq->eval({ tensorA, tensorB, tensorOut }); std::vector spirv = compileSource(R"( #version 450 @@ -89,7 +89,7 @@ TEST(TestSequence, RerecordSequence) std::shared_ptr algo = mgr.algorithm({ tensorA, tensorB, tensorOut }, spirv); - sq->record(algo)->record( + sq->record(algo)->record( { tensorA, tensorB, tensorOut }); sq->eval(); @@ -123,11 +123,11 @@ TEST(TestSequence, SequenceTimestamps) std::vector spirv = compileSource(shader); auto seq = mgr.sequence(0, 100); // 100 timestamps - seq->record({ tensorA }) + seq->record({ tensorA }) ->record(mgr.algorithm({ tensorA }, spirv)) ->record(mgr.algorithm({ tensorA }, spirv)) ->record(mgr.algorithm({ tensorA }, spirv)) - ->record({ tensorA }) + ->record({ tensorA }) ->eval(); const std::vector timestamps = seq->getTimestamps(); @@ -145,7 +145,7 @@ TEST(TestSequence, UtilsClearRecordingRunning) std::shared_ptr> tensorB = mgr.tensor({ 2, 2, 2 }); std::shared_ptr> tensorOut = mgr.tensor({ 0, 0, 0 }); - sq->eval({ tensorA, tensorB, tensorOut }); + sq->eval({ tensorA, tensorB, tensorOut }); std::vector spirv = compileSource(R"( #version 450 @@ -166,7 +166,7 @@ TEST(TestSequence, UtilsClearRecordingRunning) std::shared_ptr algo = mgr.algorithm({ tensorA, tensorB, tensorOut }, spirv); - sq->record(algo)->record( + sq->record(algo)->record( { tensorA, tensorB, tensorOut }); EXPECT_TRUE(sq->isRecording()); @@ -197,7 +197,7 @@ TEST(TestSequence, CorrectSequenceRunningError) std::shared_ptr> tensorB = mgr.tensor({ 2, 2, 2 }); std::shared_ptr> tensorOut = mgr.tensor({ 0, 0, 0 }); - sq->eval({ tensorA, tensorB, tensorOut }); + sq->eval({ tensorA, tensorB, tensorOut }); std::vector spirv = compileSource(R"( #version 450 @@ -218,7 +218,7 @@ TEST(TestSequence, CorrectSequenceRunningError) std::shared_ptr algo = mgr.algorithm({ tensorA, tensorB, tensorOut }, spirv); - sq->record(algo)->record( + sq->record(algo)->record( { tensorA, tensorB, tensorOut }); EXPECT_TRUE(sq->isRecording()); diff --git a/test/TestSpecializationConstant.cpp b/test/TestSpecializationConstant.cpp index 7de9e4ce..b461c354 100644 --- a/test/TestSpecializationConstant.cpp +++ b/test/TestSpecializationConstant.cpp @@ -44,9 +44,9 @@ TEST(TestSpecializationConstants, TestTwoConstants) mgr.algorithm(params, spirv, {}, spec); sq = mgr.sequence() - ->record(params) + ->record(params) ->record(algo) - ->record(params) + ->record(params) ->eval(); EXPECT_EQ(tensorA->vector(), std::vector({ 5, 5, 5 })); @@ -92,9 +92,9 @@ TEST(TestSpecializationConstants, TestConstantsInt) mgr.algorithm(params, spirv, {}, spec, {}); sq = mgr.sequence() - ->record(params) + ->record(params) ->record(algo) - ->record(params) + ->record(params) ->eval(); EXPECT_EQ(tensorA->vector(), std::vector({ -1, -1, -1 })); diff --git a/test/TestWorkgroup.cpp b/test/TestWorkgroup.cpp index e2a29ed4..f35e9af7 100644 --- a/test/TestWorkgroup.cpp +++ b/test/TestWorkgroup.cpp @@ -32,9 +32,9 @@ TEST(TestWorkgroup, TestSimpleWorkgroup) mgr.algorithm(params, spirv, workgroup); sq = mgr.sequence(); - sq->record(params); + sq->record(params); sq->record(algorithm); - sq->record(params); + sq->record(params); sq->eval(); std::vector expectedA = {