Skip to content

Commit

Permalink
Review comment updates
Browse files Browse the repository at this point in the history
Signed-off-by: Akshay Tondak <[email protected]>
  • Loading branch information
Akshay Tondak authored and Akshay Tondak committed Oct 16, 2024
1 parent 4f2f7e9 commit d7c8282
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ TestAIEReconfigOverhead::run(std::shared_ptr<xrt_core::device> dev)
logger(ptree, "Details", boost::str(boost::format("No. of iterations: %f") % itr_count));
}

int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
auto start = std::chrono::high_resolution_clock::now();
for (int i = 0 ;i < itr_count ; i++){
try{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Local - Include Files
#include "TestCmdChainLatency.h"
#include "tools/common/XBUtilities.h"
#include "TestValidateUtilities.h"
#include "xrt/xrt_bo.h"
#include "xrt/xrt_device.h"
#include "xrt/xrt_hw_context.h"
Expand Down Expand Up @@ -138,8 +137,6 @@ TestCmdChainLatency::run(std::shared_ptr<xrt_core::device> dev)
for (auto& run : runs)
runlist.add(run);

int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
auto start = std::chrono::high_resolution_clock::now();
for (int i = 0; i < itr_count; ++i) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Local - Include Files
#include "TestCmdChainThroughput.h"
#include "tools/common/XBUtilities.h"
#include "TestValidateUtilities.h"
#include "xrt/xrt_bo.h"
#include "xrt/xrt_device.h"
#include "xrt/xrt_hw_context.h"
Expand Down Expand Up @@ -137,8 +136,6 @@ TestCmdChainThroughput::run(std::shared_ptr<xrt_core::device> dev)
for (auto& run : runs)
runlist.add(run);

int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
auto start = std::chrono::high_resolution_clock::now();
for (int i = 0; i < itr_count; ++i) {
try {
Expand Down
2 changes: 0 additions & 2 deletions src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ TestDF_bandwidth::run(std::shared_ptr<xrt_core::device> dev)
logger(ptree, "Details", boost::str(boost::format("No. of iterations: %f") % itr_count));
}

int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
auto start = std::chrono::high_resolution_clock::now();
for (int i = 0; i < itr_count; i++) {
try {
Expand Down
6 changes: 3 additions & 3 deletions src/runtime_src/core/tools/common/tests/TestGemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ TestGemm::run(std::shared_ptr<xrt_core::device> dev)
// Create 128KB Debug BO to capture TOPS data
xrt::bo bo_result = xrt_core::bo_int::create_debug_bo(hwctx, 0x20000);

// wait until clock reaches the max frequency
int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
// wait until clock reaches the max frequency. The performance metrics for a test
// are valid only when the clock reaches the max frequency.
uint64_t ipu_hclock = XBValidateUtils::wait_for_max_clock(dev);

try {
//run kernel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ boost::property_tree::ptree TestSpatialSharingOvd::run(std::shared_ptr<xrt_core:
}
}

int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
// Measure the latency for running the test cases in parallel
auto start = std::chrono::high_resolution_clock::now();

Expand Down
2 changes: 0 additions & 2 deletions src/runtime_src/core/tools/common/tests/TestTCTAllColumn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ TestTCTAllColumn::run(std::shared_ptr<xrt_core::device> dev)
logger(ptree, "Details", boost::str(boost::format("No. of iterations: %f") % itr_count));
}

int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
auto start = std::chrono::high_resolution_clock::now();
try {
auto run = kernel(host_app, bo_ifm, NULL, bo_ofm, NULL, bo_instr, instr_size, NULL);
Expand Down
2 changes: 0 additions & 2 deletions src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ TestTCTOneColumn::run(std::shared_ptr<xrt_core::device> dev)
logger(ptree, "Details", boost::str(boost::format("No. of iterations: %f") % itr_count));
}

int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
auto start = std::chrono::high_resolution_clock::now();
try {
auto run = kernel(host_app, bo_ifm, NULL, bo_ofm, NULL, bo_instr, instr_size, NULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ TestTemporalSharingOvd::run(std::shared_ptr<xrt_core::device> dev) {
}
};

int ipu_hclock = 0;
XBValidateUtils::wait_for_max_clock(ipu_hclock, dev);
// Measure the latency for running the test cases in parallel
auto start = std::chrono::high_resolution_clock::now();
// Create two threads to run the test cases
Expand Down
18 changes: 14 additions & 4 deletions src/runtime_src/core/tools/common/tests/TestValidateUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,22 @@ get_instr_size(const std::string& dpu_file) {
return size;
}

void
wait_for_max_clock(int& ipu_hclock, std::shared_ptr<xrt_core::device> dev) {
/**
* @brief Waits for the IPU clock frequency to reach the target maximum clock frequency.
*
* This function queries the device for the target maximum clock frequency and then
* continuously checks the current IPU clock frequency until it reaches the target.
*
* @param dev A shared pointer to the xrt_core::device.
* @return The IPU clock frequency when it reaches the target maximum clock frequency.
*/
uint64_t
wait_for_max_clock(std::shared_ptr<xrt_core::device> dev) {
uint64_t target_h_clock_freq = 0;
uint64_t ipu_hclock = 0;
auto res_info = xrt_core::device_query<xrt_core::query::xrt_resource_raw>(dev);
if (res_info.empty())
return;
return ipu_hclock;

for (auto &res : res_info)
{
Expand All @@ -158,6 +168,6 @@ wait_for_max_clock(int& ipu_hclock, std::shared_ptr<xrt_core::device> dev) {
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
return ipu_hclock;
}

}// end of namespace XBValidateUtils
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace XBValidateUtils{

void init_instr_buf(xrt::bo &bo_instr, const std::string& dpu_file);
size_t get_instr_size(const std::string& dpu_file);
void wait_for_max_clock(int&, std::shared_ptr<xrt_core::device>);
uint64_t wait_for_max_clock(std::shared_ptr<xrt_core::device>);

} //End of namespace XBValidateUtils
#endif

0 comments on commit d7c8282

Please sign in to comment.