deal with kernel_graph_#_ prefix in tensor name in overflow wp checking

This commit is contained in:
John Tzanakakis 2021-11-26 18:24:33 -05:00
parent 0b236f91b9
commit 64893bf9eb
2 changed files with 18 additions and 1 deletions

View File

@ -1653,8 +1653,11 @@ bool DebugServices::CheckOpOverflow(std::string node_name_to_find, unsigned int
overflow_wp_lock_.unlock();
// remove prefix "kernel_graph_#_" from node_name_to_find before checking it
std::string op_name_to_find = RemoveKernelGraphPrefix(node_name_to_find);
// determine if overflow wp has been triggered for node_name_to_find
if (find(op_names.begin(), op_names.end(), node_name_to_find) != op_names.end()) {
if (find(op_names.begin(), op_names.end(), op_name_to_find) != op_names.end()) {
MS_LOG(INFO) << "Operation overflow watchpoint triggered for " << node_name_to_find;
return true;
}
@ -1662,6 +1665,18 @@ bool DebugServices::CheckOpOverflow(std::string node_name_to_find, unsigned int
return false;
}
std::string DebugServices::RemoveKernelGraphPrefix(std::string node_name_to_find) {
std::string op_name_to_find = node_name_to_find;
const std::string kernel_prefix = "kernel_graph_";
if (node_name_to_find.rfind(kernel_prefix, 0) == 0) {
auto start_of_op_name = node_name_to_find.find("_", kernel_prefix.length());
if (start_of_op_name != std::string::npos) {
op_name_to_find = node_name_to_find.substr(start_of_op_name + 1);
}
}
return op_name_to_find;
}
bool DebugServices::GetAttrsFromAsyncFilename(const std::string &file_name, std::string *const node_name,
uint64_t *task_id, uint64_t *stream_id) {
// get the node_name, task_id, and stream_id from async dump filename

View File

@ -447,6 +447,8 @@ class DebugServices {
bool CheckOpOverflow(std::string node_name_to_find, unsigned int device_id = 0, unsigned int root_graph_id = 0,
unsigned int iteration = 0);
std::string RemoveKernelGraphPrefix(std::string node_name_to_find);
bool GetAttrsFromAsyncFilename(const std::string &file_name, std::string *const node_name, uint64_t *task_id,
uint64_t *stream_id);