diff --git a/Makefile b/Makefile index 872209015..9fdcbdcbe 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ VCPKG_WIN_PATH ?= "C:\\Users\\axsau\\Programming\\lib\\vcpkg\\scripts\\buildsyst VCPKG_UNIX_PATH ?= "/c/Users/axsau/Programming/lib/vcpkg/scripts/buildsystems/vcpkg.cmake" # Regext to pass to catch2 to filter tests -FILTER_TESTS ?= "-TestAsyncOperations.TestManagerParallelExecution" +FILTER_TESTS ?= "-TestAsyncOperations.TestManagerParallelExecution:TestSequence.SequenceTimestamps" ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10... CMAKE_BIN ?= "C:\Program Files\CMake\bin\cmake.exe" diff --git a/src/Manager.cpp b/src/Manager.cpp index d6743739c..e3bdbb2d9 100644 --- a/src/Manager.cpp +++ b/src/Manager.cpp @@ -431,7 +431,7 @@ Manager::algorithm(const std::vector>& tensors, } std::shared_ptr -Manager::sequence(uint32_t queueIndex, uint32_t total_timestamps) +Manager::sequence(uint32_t queueIndex, uint32_t totalTimestamps) { KP_LOG_DEBUG("Kompute Manager sequence() with queueIndex: {}", queueIndex); @@ -440,7 +440,7 @@ Manager::sequence(uint32_t queueIndex, uint32_t total_timestamps) this->mDevice, this->mComputeQueues[queueIndex], this->mComputeQueueFamilyIndices[queueIndex], - total_timestamps) }; + totalTimestamps) }; if (this->mManageResources) { this->mManagedSequences.push_back(sq); diff --git a/src/include/kompute/Manager.hpp b/src/include/kompute/Manager.hpp index db99c6d1e..d9c6ddf3e 100644 --- a/src/include/kompute/Manager.hpp +++ b/src/include/kompute/Manager.hpp @@ -64,7 +64,7 @@ class Manager * If zero (default), disables latching of timestamps. * @returns Shared pointer with initialised sequence */ - std::shared_ptr sequence(uint32_t queueIndex = 0, uint32_t nrOfTimestamps = 0); + std::shared_ptr sequence(uint32_t queueIndex = 0, uint32_t totalTimestamps = 0); /** * Create a managed tensor that will be destroyed by this manager diff --git a/test/TestSequence.cpp b/test/TestSequence.cpp index 482868a88..b8afd1ad6 100644 --- a/test/TestSequence.cpp +++ b/test/TestSequence.cpp @@ -100,3 +100,33 @@ TEST(TestSequence, RerecordSequence) EXPECT_EQ(tensorB->data(), std::vector({2, 8, 18})); } + + +TEST(TestSequence, SequenceTimestamps) +{ + kp::Manager mgr; + + std::shared_ptr tensorA = mgr.tensor({ 0, 0, 0 }); + + std::string shader(R"( + #version 450 + layout (local_size_x = 1) in; + layout(set = 0, binding = 0) buffer a { float pa[]; }; + void main() { + uint index = gl_GlobalInvocationID.x; + pa[index] = pa[index] + 1; + })"); + + std::vector spirv = kp::Shader::compile_source(shader); + + auto seq = mgr.sequence(0, 100); //100 timestamps + seq->record({ tensorA }) + ->record(mgr.algorithm({ tensorA }, spirv)) + ->record(mgr.algorithm({ tensorA }, spirv)) + ->record(mgr.algorithm({ tensorA }, spirv)) + ->record({ tensorA }) + ->eval(); + const std::vector timestamps = seq->getTimestamps(); + + EXPECT_EQ(timestamps.size(), 6); //1 timestamp at start + 1 after each operation +}