Skip to content

Commit

Permalink
[Feature](mlu-ops): remove error throw in mluops library. (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanieeelLiu authored Aug 5, 2024
1 parent 791e37c commit 2cd5bc6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions core/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ void mluOpCheck(mluOpStatus_t result, char const *const func,
std::string error = "\"" + std::string(mluOpGetErrorString(result)) +
" in " + std::string(func) + "\"";
LOG(ERROR) << error;
// TODO(liuduanhui): Remove error throwing in c library in future.
// MLUOP_CHECK should not be used in host side code.
// And now it is only used in gtest code.
throw std::runtime_error(error);
}
}
1 change: 0 additions & 1 deletion kernels/utils/cnnl_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ void mluOpCnnlCheck(mluOpStatus_t result, char const *const func,
" in " + std::string(func) + " at " + std::string(file) +
" line: " + std::to_string(line) + "\"";
LOG(ERROR) << error;
throw std::runtime_error(error);
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ for i in ${filenames} ; do
check_dir=$(echo $i | grep -E "^core\/|^kernels\/")
#not_in_tools=$(echo $i | sed -r "s/^tools.*//")
if [[ -n "${include_mlu}" ]] && [[ -n "${check_dir}" ]]; then
printf_log=$(sed -n -e '/\<printf\>/=' -e ' \
/\<__bang_printf\>/=' -e '/\<std::cout\>/=' -e '/assert(/=' $i)
printf_log=$(sed -n -e '/\<printf\>/=' -e \
'/\<__bang_printf\>/=' -e '/\<std::cout\>/=' -e '/assert(/=' $i)
for line in ${printf_log};
do
echo $i +${line}
Expand Down

0 comments on commit 2cd5bc6

Please sign in to comment.