Skip to content

Commit

Permalink
tests: benchdnn: graph: add fpmath mode print in result
Browse files Browse the repository at this point in the history
  • Loading branch information
wzt1997 authored and TaoLv committed Apr 28, 2024
1 parent 6a4a583 commit bb89a7a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/benchdnn/graph/bench_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ void check_correctness(const settings_t &s) {
BENCHDNN_PRINT(7, "[INFO] Graph dump:\n%s\n", dg.get_string().c_str());

const prb_t prb(dg);
const auto &cpp_pstr
= case_to_str(s.json_file, i_in_shapes, i_op_attrs, i_mb);
const auto &cpp_pstr = case_to_str(
s.json_file, i_in_shapes, i_op_attrs, i_fpmath_mode, i_mb);
const char *pstr = cpp_pstr.c_str();
BENCHDNN_PRINT(1, "run: %s\n", pstr);
res_t res {};
Expand Down
7 changes: 6 additions & 1 deletion tests/benchdnn/graph/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ using namespace dnnl::graph;

std::string case_to_str(const std::string &json_file,
const std::map<size_t, std::string> &in_shapes,
const std::map<size_t, std::string> &op_attrs, const int64_t mb) {
const std::map<size_t, std::string> &op_attrs,
const std::string &fpmath_mode, const int64_t mb) {
std::stringstream s;
dump_global_params(s);

Expand Down Expand Up @@ -369,6 +370,10 @@ std::string case_to_str(const std::string &json_file,
s << " ";
}

if (strcmp(fpmath_mode.c_str(), "default") != 0) {
s << "--attr-fpmath=" << fpmath_mode << " ";
}

s << "--case=" << json_file;
return s.str();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/benchdnn/graph/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ struct prb_t {

std::string case_to_str(const std::string &json_file,
const std::map<size_t, std::string> &in_shapes,
const std::map<size_t, std::string> &op_attrs, const int64_t mb);
const std::map<size_t, std::string> &op_attrs,
const std::string &fpmath_mode, const int64_t mb);

struct perf_report_t : public base_perf_report_t {
perf_report_t(const std::string case_str, const char *perf_template)
Expand Down

0 comments on commit bb89a7a

Please sign in to comment.