Skip to content

Commit

Permalink
Creating initial support for NPU3 no-op tests throughput and latency
Browse files Browse the repository at this point in the history
Signed-off-by: Hayden Laccabue <[email protected]>
  • Loading branch information
hlaccabu committed Sep 14, 2024
1 parent 652e16a commit f58df36
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 13 deletions.
5 changes: 4 additions & 1 deletion src/runtime_src/core/common/query_requests.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ struct sequence_name : request
tct_one_column,
tct_all_column,
gemm_int8,
aie_reconfig_overhead
aie_reconfig_overhead,
nop
};

static std::string
Expand All @@ -585,6 +586,8 @@ struct sequence_name : request
return "gemm_int8";
case type::aie_reconfig_overhead:
return "aie_reconfig_overhead";
case type::nop:
return "nop";
}
return "unknown";
}
Expand Down
48 changes: 42 additions & 6 deletions src/runtime_src/core/tools/common/tests/TestNPULatency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include "xrt/xrt_device.h"
#include "xrt/xrt_hw_context.h"
#include "xrt/xrt_kernel.h"
#include "experimental/xrt_elf.h"
#include "experimental/xrt_ext.h"
#include "experimental/xrt_module.h"
namespace XBU = XBUtilities;
namespace xq = xrt_core::query;

#include <filesystem>

Expand Down Expand Up @@ -70,14 +74,46 @@ TestNPULatency::run(std::shared_ptr<xrt_core::device> dev)

xrt::hw_context hwctx;
xrt::kernel testker;
try {
if(xrt_core::device_query<xq::rom_vbnv>(dev).find("umq") != std::string::npos) {
//Elf flow
const auto elf_name = xrt_core::device_query<xrt_core::query::sequence_name>(dev, xrt_core::query::sequence_name::type::nop);
auto elf_path = findPlatformFile(elf_name, ptree);
if (!std::filesystem::exists(elf_path))
return ptree;

logger(ptree, "Elf", elf_path);

xrt::elf elf;
try {
elf = xrt::elf(elf_path);
}
catch (const std::runtime_error& ex) {
logger(ptree, "Error", ex.what());
ptree.put("status", test_token_failed);
return ptree;
}

xrt::module mod{elf};
try{
hwctx = xrt::hw_context{working_dev, xclbin.get_uuid()};
testker = xrt::ext::kernel{hwctx, mod, kernelName};
}
catch (const std::exception& ex){
logger(ptree, "Error", ex.what());
ptree.put("status", test_token_failed);
return ptree;
}
}
else {
try {
hwctx = xrt::hw_context(working_dev, xclbin.get_uuid());
testker = xrt::kernel(hwctx, kernelName);
}
catch (const std::exception& ex){
logger(ptree, "Error", ex.what());
ptree.put("status", test_token_failed);
return ptree;
}
catch (const std::exception& ex){
logger(ptree, "Error", ex.what());
ptree.put("status", test_token_failed);
return ptree;
}
}

//Create BOs, the values are not initialized as they are not really used by this special test running on the device
Expand Down
48 changes: 42 additions & 6 deletions src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include "xrt/xrt_device.h"
#include "xrt/xrt_hw_context.h"
#include "xrt/xrt_kernel.h"
#include "experimental/xrt_elf.h"
#include "experimental/xrt_ext.h"
#include "experimental/xrt_module.h"
namespace XBU = XBUtilities;
namespace xq = xrt_core::query;

#include <filesystem>

Expand Down Expand Up @@ -69,14 +73,46 @@ TestNPUThroughput::run(std::shared_ptr<xrt_core::device> dev)

xrt::hw_context hwctx;
xrt::kernel testker;
try {
if(xrt_core::device_query<xq::rom_vbnv>(dev).find("umq") != std::string::npos) {
//Elf flow
const auto elf_name = xrt_core::device_query<xrt_core::query::sequence_name>(dev, xrt_core::query::sequence_name::type::nop);
auto elf_path = findPlatformFile(elf_name, ptree);
if (!std::filesystem::exists(elf_path))
return ptree;

logger(ptree, "Elf", elf_path);

xrt::elf elf;
try {
elf = xrt::elf(elf_path);
}
catch (const std::runtime_error& ex) {
logger(ptree, "Error", ex.what());
ptree.put("status", test_token_failed);
return ptree;
}

xrt::module mod{elf};
try{
hwctx = xrt::hw_context{working_dev, xclbin.get_uuid()};
testker = xrt::ext::kernel{hwctx, mod, kernelName};
}
catch (const std::exception& ex){
logger(ptree, "Error", ex.what());
ptree.put("status", test_token_failed);
return ptree;
}
}
else {
try {
hwctx = xrt::hw_context(working_dev, xclbin.get_uuid());
testker = xrt::kernel(hwctx, kernelName);
}
catch (const std::exception& ex){
logger(ptree, "Error", ex.what());
ptree.put("status", test_token_failed);
return ptree;
}
catch (const std::exception& ex){
logger(ptree, "Error", ex.what());
ptree.put("status", test_token_failed);
return ptree;
}
}

//Create BOs, the values are not initialized as they are not really used by this special test running on the device
Expand Down

0 comments on commit f58df36

Please sign in to comment.