Skip to content

Commit

Permalink
benchdnn: add ref run report status
Browse files Browse the repository at this point in the history
  • Loading branch information
dzarukin committed Feb 13, 2025
1 parent 94279b6 commit fb09328
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
23 changes: 14 additions & 9 deletions tests/benchdnn/dnnl_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,12 @@ void check_correctness(const prb_t *prb, const std::vector<data_kind_t> &kinds,
TIME_COMPARE(check_buffer_overwrite(args.dnn_mem(i), args.arg(i), res));
}

// Report prim_ref run status for easier distinguishing between GPU failures
// and ref CPU failures.
if (prim_ref) {
BENCHDNN_PRINT(1, "run ref: %s\n", res->prim_ref_repro.c_str());
}

TIME_REF(compute_ref(prb, ref_args, prim_ref));

for (const auto &kind : kinds) {
Expand Down Expand Up @@ -621,15 +627,6 @@ void check_correctness(const prb_t *prb, const std::vector<data_kind_t> &kinds,
cpu_cache_args.L2_size, cpu_cache_args.L3_size,
benchdnn_get_max_threads(),
query_impl_info(query_pd(prim_ref)).c_str());

// Replace engine kind for repro line from GPU to CPU.
const auto eng_pos = res->prim_ref_repro.find("engine=gpu");
if (eng_pos != std::string::npos)
// Replace `g` in `gpu` with `c`
res->prim_ref_repro[eng_pos + 7] = 'c';

BENCHDNN_PRINT(
0, "[PRIM_REF][REPRO]: %s\n", res->prim_ref_repro.c_str());
}
}

Expand Down Expand Up @@ -1063,7 +1060,15 @@ int init_prim_ref_common(benchdnn_dnnl_wrapper_t<dnnl_primitive_t> &prim_ref,

BENCHDNN_PRINT(5, "CPU reference oneDNN implementation: %s\n",
query_impl_info(pdw).c_str());

res->prim_ref_repro = prb_cpu->str();
// Replace engine kind for repro line from GPU to CPU.
const auto eng_pos = res->prim_ref_repro.find("engine=gpu");
if (eng_pos != std::string::npos) {
// Replace `g` in `gpu` with `c`
res->prim_ref_repro[eng_pos + 7] = 'c';
}

prim_ref.reset(prim_ref_ptr);
return OK;
}
Expand Down
7 changes: 5 additions & 2 deletions tests/benchdnn/utils/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ struct task_t {
, perf_template_(perf_template)
, idx_(idx) {}

int create() {
BENCHDNN_PRINT(1, "create: %s\n", prb_.str());
int create(bool in_parallel) {
// Report creation status for problems only in sequential mode as in
// parallel it's still not clear which one failed.
if (!in_parallel) BENCHDNN_PRINT(1, "create: %s\n", prb_.str());

if (skip_start(&res_, idx_)) return OK;
if (bench_mode == bench_mode_t::list) return res_.state = LISTED, OK;

Expand Down
6 changes: 3 additions & 3 deletions tests/benchdnn/utils/task_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ struct task_executor_t {
// Special case is needed for THREADPOOL RUNTIME. Both `Parallel_nd` and
// `createit` calls activate threadpool which causes undesired behavior.
if (tasks_.size() == 1)
tasks_[0].create();
tasks_[0].create(/* in_parallel = */ false);
else
benchdnn_parallel_nd(
tasks_.size(), [&](int i) { tasks_[i].create(); });
benchdnn_parallel_nd(tasks_.size(),
[&](int i) { tasks_[i].create(/* in_parallel = */ true); });

// Check caches first to avoid filling cache with service reorders.
for (auto &t : tasks_) {
Expand Down

0 comments on commit fb09328

Please sign in to comment.