diff --git a/src/runtime_src/core/tools/common/TestRunner.cpp b/src/runtime_src/core/tools/common/TestRunner.cpp index 7c0ca4e2267..53892446f3b 100644 --- a/src/runtime_src/core/tools/common/TestRunner.cpp +++ b/src/runtime_src/core/tools/common/TestRunner.cpp @@ -506,7 +506,7 @@ TestRunner::get_test_header() // - mut: Mutex to lock the critical section // - cond_var: Condition variable to wait on // - thread_ready: Counter to track the number of ready threads -void TestRunner::wait_for_threads_ready(uint32_t thread_num, std::mutex& mut, std::condition_variable& cond_var, uint32_t& thread_ready) { +void TestRunner::wait_for_threads_ready(const int thread_num, std::mutex& mut, std::condition_variable& cond_var, int& thread_ready) { std::unique_lock lock(mut); while (thread_ready != thread_num) { lock.unlock(); diff --git a/src/runtime_src/core/tools/common/TestRunner.h b/src/runtime_src/core/tools/common/TestRunner.h index 86a5190193d..7ebbc844fcc 100644 --- a/src/runtime_src/core/tools/common/TestRunner.h +++ b/src/runtime_src/core/tools/common/TestRunner.h @@ -30,7 +30,7 @@ class TestRunner : public JSONConfigurable { const std::string & getConfigName() const { return get_name(); }; virtual const std::string& getConfigDescription() const { return m_description; }; boost::property_tree::ptree get_test_header(); - void wait_for_threads_ready(uint32_t thread_num, std::mutex& mut, std::condition_variable& cond_var, uint32_t& thread_ready); + void wait_for_threads_ready(const int thread_num, std::mutex& mut, std::condition_variable& cond_var, int& thread_ready); // Child class helper methods protected: diff --git a/src/runtime_src/core/tools/common/tests/TestHelper.cpp b/src/runtime_src/core/tools/common/tests/TestHelper.cpp index 43f9e95f229..8bf89fa5902 100644 --- a/src/runtime_src/core/tools/common/tests/TestHelper.cpp +++ b/src/runtime_src/core/tools/common/tests/TestHelper.cpp @@ -55,7 +55,7 @@ void BO_set::set_kernel_args(xrt::run& run) { // - cond_var: Condition variable to wait on // - thread_ready: Counter to track the number of ready threads void -TestCase::run(std::mutex& mut, std::condition_variable& cond_var, uint32_t& thread_ready) +TestCase::run(std::mutex& mut, std::condition_variable& cond_var, int& thread_ready) { std::vector kernels; std::vector bo_set_list; @@ -92,7 +92,7 @@ TestCase::run(std::mutex& mut, std::condition_variable& cond_var, uint32_t& thre } // Method to signal that a thread is ready to run -void TestCase::thread_ready_to_run(std::mutex& mut, std::condition_variable& cond_var, uint32_t& thread_ready) { +void TestCase::thread_ready_to_run(std::mutex& mut, std::condition_variable& cond_var, int& thread_ready) { std::unique_lock lock(mut); thread_ready++; cond_var.wait(lock); diff --git a/src/runtime_src/core/tools/common/tests/TestHelper.h b/src/runtime_src/core/tools/common/tests/TestHelper.h index 30b5013b81f..837b7f96d1d 100644 --- a/src/runtime_src/core/tools/common/tests/TestHelper.h +++ b/src/runtime_src/core/tools/common/tests/TestHelper.h @@ -1,6 +1,9 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved. +#ifndef __TestHelper_h_ +#define __TestHelper_h_ + // ------ I N C L U D E F I L E S ------------------------------------------- // Local - Include Files #include "tools/common/TestRunner.h" @@ -39,17 +42,16 @@ class TestCase { int itr_count; // Number of iterations // Method to signal that a thread is ready to run - void thread_ready_to_run(std::mutex&, std::condition_variable&, uint32_t&); + void thread_ready_to_run(std::mutex&, std::condition_variable&, int&); public: // Constructor to initialize the test case with xclbin and kernel name with hardware context creation - TestCase(xrt::xclbin& xclbin, std::string& kernel, size_t buffer_size = 1024) - : device(xrt::device(0)), xclbin(xclbin), kernel_name(kernel), buffer_size(buffer_size), itr_count(1000) + TestCase(xrt::xclbin& xclbin, std::string& kernel, xrt::device& device) + : device(device), xclbin(xclbin), kernel_name(kernel), buffer_size(1024), itr_count(1000) { - device.register_xclbin(xclbin); hw_ctx = xrt::hw_context(device, xclbin.get_uuid()); } - void run(std::mutex&, std::condition_variable&, uint32_t&); + void run(std::mutex&, std::condition_variable&, int&); }; - +#endif diff --git a/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp b/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp index ae485426be6..721c8dc4a83 100644 --- a/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp +++ b/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp @@ -83,15 +83,15 @@ boost::property_tree::ptree TestSpatialSharingOvd::run(std::shared_ptr threads; std::vector testcases; // Create two test cases and add them to the vector - testcases.emplace_back(xclbin, kernelName); - testcases.emplace_back(xclbin, kernelName); + testcases.emplace_back(xclbin, kernelName, working_dev); + testcases.emplace_back(xclbin, kernelName, working_dev); // Lambda function to run a test case. This will be sent to individual thread to be run. auto runTestcase = [&](TestCase& test) { @@ -109,7 +109,7 @@ boost::property_tree::ptree TestSpatialSharingOvd::run(std::shared_ptr