Skip to content

Commit

Permalink
#8379: fixed tt_assert_message
Browse files Browse the repository at this point in the history
  • Loading branch information
arakhmati committed May 10, 2024
1 parent a1f4578 commit 5aadcc0
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions tt_metal/common/assert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,27 @@ inline std::string backtrace_to_string(int size = 64, int skip = 2, const std::s
return ss.str();
}

inline void tt_assert_message(std::ostream& os) {}
template <typename... Ts>
void tt_assert_message(std::ostream& os, Ts const&... ts) {
std::string fmt;
for (int i = 0; i < sizeof...(ts); i++) {
fmt += "{} ";
}
log_fatal(fmt.c_str(), ts...);
os << fmt::format(fmt, ts...);
os << std::endl;
}

template <typename T, typename... Ts>
void tt_assert_message(std::ostream& os, T const& t, Ts const&... ts) {
os << fmt::format("{}", t) << std::endl;
tt_assert_message(os, ts...);
template <typename... Ts>
void tt_assert_message(std::ostream& os, const char* t, Ts const&... ts) {
os << fmt::format(t, ts...);
os << std::endl;
}

template <typename... Ts>
void tt_assert_message(std::ostream& os, const std::string& t, Ts const&... ts) {
os << fmt::format(t, ts...);
os << std::endl;
}

template <typename... Ts>
Expand Down

0 comments on commit 5aadcc0

Please sign in to comment.