Skip to content

Commit

Permalink
hide extra validate details in verbose (#8210)
Browse files Browse the repository at this point in the history
Signed-off-by: AShivangi <[email protected]>
  • Loading branch information
AShivangi authored Jun 4, 2024
1 parent ac31dcf commit df3676b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 25 deletions.
12 changes: 8 additions & 4 deletions src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ TestDF_bandwidth::run(std::shared_ptr<xrt_core::device> dev)
return ptree;
}
auto kernelName = xkernel.get_name();
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));
if(XBU::getVerbose())
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));

auto working_dev = xrt::device(dev);
working_dev.register_xclbin(xclbin);
Expand Down Expand Up @@ -152,8 +153,10 @@ TestDF_bandwidth::run(std::shared_ptr<xrt_core::device> dev)
bo_ifm.sync(XCL_BO_SYNC_BO_TO_DEVICE);

//Log
logger(ptree, "Details", boost::str(boost::format("Buffer size: '%f'GB") % buffer_size_gb));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count));
if(XBU::getVerbose()) {
logger(ptree, "Details", boost::str(boost::format("Buffer size: '%f'GB") % buffer_size_gb));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count));
}

auto start = std::chrono::high_resolution_clock::now();
for (int i = 0; i < itr_count; i++) {
Expand Down Expand Up @@ -185,7 +188,8 @@ TestDF_bandwidth::run(std::shared_ptr<xrt_core::device> dev)
float elapsedSecs = std::chrono::duration_cast<std::chrono::duration<float>>(end-start).count();
//Data is read and written in parallel hence x2
float bandwidth = (buffer_size_gb*itr_count*2) / elapsedSecs;
logger(ptree, "Details", boost::str(boost::format("Total duration: '%.1f's") % elapsedSecs));
if(XBU::getVerbose())
logger(ptree, "Details", boost::str(boost::format("Total duration: '%.1f's") % elapsedSecs));
logger(ptree, "Details", boost::str(boost::format("Average bandwidth per shim DMA: '%.1f' GB/s") % bandwidth));

ptree.put("status", test_token_passed);
Expand Down
12 changes: 7 additions & 5 deletions src/runtime_src/core/tools/common/tests/TestGemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ TestGemm::run(std::shared_ptr<xrt_core::device> dev)
if (!std::filesystem::exists(dpu_instr))
return ptree;

logger(ptree, "DPU-Sequence", dpu_instr);
if(XBU::getVerbose())
logger(ptree, "DPU-Sequence", dpu_instr);

size_t instr_size = 0;
try {
Expand Down Expand Up @@ -219,10 +220,11 @@ TestGemm::run(std::shared_ptr<xrt_core::device> dev)

//reset the performance mode
xrt_core::device_update<xrt_core::query::performance_mode>(dev.get(), static_cast<xrt_core::query::performance_mode::power_type>(perf_mode));

logger(ptree, "Details", boost::str(boost::format("Total Duration: '%.1f' ns") % (ipu_hclck_period * (total_cycle_count/num_of_cores))));
logger(ptree, "Details", boost::str(boost::format("Average cycle count: '%.1f'") % (total_cycle_count/num_of_cores)));
logger(ptree, "Details", boost::str(boost::format("IPU H-Clock: '%f' MHz") % ipu_hclock));
if(XBU::getVerbose()) {
logger(ptree, "Details", boost::str(boost::format("Total Duration: '%.1f' ns") % (ipu_hclck_period * (total_cycle_count/num_of_cores))));
logger(ptree, "Details", boost::str(boost::format("Average cycle count: '%.1f'") % (total_cycle_count/num_of_cores)));
logger(ptree, "Details", boost::str(boost::format("NPU H-Clock: '%f' MHz") % ipu_hclock));
}
logger(ptree, "Details", boost::str(boost::format("TOPS: '%.1f'") % TOPS));

ptree.put("status", test_token_passed);
Expand Down
9 changes: 6 additions & 3 deletions src/runtime_src/core/tools/common/tests/TestNPULatency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ TestNPULatency::run(std::shared_ptr<xrt_core::device> dev)
return ptree;
}
auto kernelName = xkernel.get_name();
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));
if(XBU::getVerbose())
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));

auto working_dev = xrt::device(dev);
working_dev.register_xclbin(xclbin);
Expand All @@ -87,8 +88,10 @@ TestNPULatency::run(std::shared_ptr<xrt_core::device> dev)
bo_mc.sync(XCL_BO_SYNC_BO_TO_DEVICE);

//Log
logger(ptree, "Details", boost::str(boost::format("Instruction size: '%f' bytes") % buffer_size));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count));
if(XBU::getVerbose()) {
logger(ptree, "Details", boost::str(boost::format("Instruction size: '%f' bytes") % buffer_size));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count));
}

// Run the test to compute latency where we submit one job at a time and wait for its completion before
// we submit the next one
Expand Down
11 changes: 7 additions & 4 deletions src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ TestNPUThroughput::run(std::shared_ptr<xrt_core::device> dev)
return ptree;
}
auto kernelName = xkernel.get_name();
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));
if(XBU::getVerbose())
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));

auto working_dev = xrt::device(dev);
working_dev.register_xclbin(xclbin);
Expand All @@ -86,8 +87,10 @@ TestNPUThroughput::run(std::shared_ptr<xrt_core::device> dev)
bo_mc.sync(XCL_BO_SYNC_BO_TO_DEVICE);

//Log
logger(ptree, "Details", boost::str(boost::format("Instruction size: '%f' bytes") % buffer_size));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count_throughput));
if(XBU::getVerbose()) {
logger(ptree, "Details", boost::str(boost::format("Instruction size: '%f' bytes") % buffer_size));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count_throughput));
}

// Run the test to compute throughput where we saturate NPU with jobs and then wait for all
// completions at the end
Expand All @@ -111,7 +114,7 @@ TestNPUThroughput::run(std::shared_ptr<xrt_core::device> dev)
// Compute the throughput
const double throughput = (elapsedSecs != 0.0) ? runhandles.size() / elapsedSecs : 0.0;

logger(ptree, "Details", boost::str(boost::format("Average throughput: '%.1f' ops/s") % throughput));
logger(ptree, "Details", boost::str(boost::format("Average throughput: '%.1f' ops") % throughput));
ptree.put("status", test_token_passed);
return ptree;
}
12 changes: 8 additions & 4 deletions src/runtime_src/core/tools/common/tests/TestTCTAllColumn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ TestTCTAllColumn::run(std::shared_ptr<xrt_core::device> dev)
return ptree;
}
auto kernelName = xkernel.get_name();
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));
if(XBU::getVerbose())
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));

auto working_dev = xrt::device(dev);
working_dev.register_xclbin(xclbin);
Expand Down Expand Up @@ -148,8 +149,10 @@ TestTCTAllColumn::run(std::shared_ptr<xrt_core::device> dev)
bo_ifm.sync(XCL_BO_SYNC_BO_TO_DEVICE);

//Log
logger(ptree, "Details", boost::str(boost::format("Buffer size: '%f' bytes") % buffer_size));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count));
if(XBU::getVerbose()) {
logger(ptree, "Details", boost::str(boost::format("Buffer size: '%f' bytes") % buffer_size));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count));
}

auto start = std::chrono::high_resolution_clock::now();
try {
Expand Down Expand Up @@ -179,7 +182,8 @@ TestTCTAllColumn::run(std::shared_ptr<xrt_core::device> dev)
float elapsedSecs = std::chrono::duration_cast<std::chrono::duration<float>>(end-start).count();
float throughput = itr_count / elapsedSecs;
float latency = (elapsedSecs / itr_count) * 1000000; //convert s to us
logger(ptree, "Details", boost::str(boost::format("Average time for TCT: '%.1f' us") % latency));
if(XBU::getVerbose())
logger(ptree, "Details", boost::str(boost::format("Average time for TCT: '%.1f' us") % latency));
logger(ptree, "Details", boost::str(boost::format("Average TCT throughput: '%.1f' TCT/s") % throughput));

ptree.put("status", test_token_passed);
Expand Down
13 changes: 8 additions & 5 deletions src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ TestTCTOneColumn::run(std::shared_ptr<xrt_core::device> dev)
return ptree;
}
auto kernelName = xkernel.get_name();
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));
if(XBU::getVerbose())
logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName));

auto working_dev = xrt::device(dev);
working_dev.register_xclbin(xclbin);
Expand Down Expand Up @@ -148,9 +149,10 @@ TestTCTOneColumn::run(std::shared_ptr<xrt_core::device> dev)
bo_ifm.sync(XCL_BO_SYNC_BO_TO_DEVICE);

//Log
logger(ptree, "Details", boost::str(boost::format("Buffer size: '%f'bytes") % buffer_size));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count));

if(XBU::getVerbose()) {
logger(ptree, "Details", boost::str(boost::format("Buffer size: '%f'bytes") % buffer_size));
logger(ptree, "Details", boost::str(boost::format("No. of iterations: '%f'") % itr_count));
}
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 Expand Up @@ -179,7 +181,8 @@ TestTCTOneColumn::run(std::shared_ptr<xrt_core::device> dev)
float elapsedSecs = std::chrono::duration_cast<std::chrono::duration<float>>(end-start).count();
float throughput = itr_count / elapsedSecs;
float latency = (elapsedSecs / itr_count) * 1000000; //convert s to us
logger(ptree, "Details", boost::str(boost::format("Average time for TCT: '%.1f' us") % latency));
if(XBU::getVerbose())
logger(ptree, "Details", boost::str(boost::format("Average time for TCT: '%.1f' us") % latency));
logger(ptree, "Details", boost::str(boost::format("Average TCT throughput: '%.1f' TCT/s") % throughput));

ptree.put("status", test_token_passed);
Expand Down

0 comments on commit df3676b

Please sign in to comment.