Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/benchdnn/bnorm/bnorm.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2017 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -234,6 +235,10 @@ struct perf_report_t : public base_perf_report_t {
<< p_->iw << ',' << p_->eps;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "mb,ic,id,ih,iw,eps";
}

void dump_flags(std::ostream &s) const override {
s << flags2str(p_->flags);
}
Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/conv/conv.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2017 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -230,6 +231,10 @@ struct perf_report_t : public base_perf_report_t {
<< p_->dd << ',' << p_->dh << ',' << p_->dw;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "g,mb,ic,id,ih,iw,oc,od,oh,ow,kd,kh,kw,sd,sh,sw,pd,ph,pw,dd,dh,dw";
}

double ops() const override { return p_->ops; }
const std::vector<dnnl_data_type_t> *sdt() const override {
return &p_->dt;
Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/deconv/deconv.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2022 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -228,6 +229,10 @@ struct perf_report_t : public base_perf_report_t {
<< p_->dd << ',' << p_->dh << ',' << p_->dw;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "g,mb,ic,id,ih,iw,oc,od,oh,ow,kd,kh,kw,sd,sh,sw,pd,ph,pw,dd,dh,dw";
}

double ops() const override { return p_->ops; }
const std::vector<dnnl_data_type_t> *sdt() const override {
return &p_->dt;
Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/gnorm/gnorm.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2023 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -225,6 +226,10 @@ struct perf_report_t : public base_perf_report_t {
<< p_->ih << ',' << p_->iw << ',' << p_->eps;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "g,mb,ic,id,ih,iw,eps";
}

void dump_flags(std::ostream &s) const override {
s << flags2str(p_->flags);
}
Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/ip/ip.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2017 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -164,6 +165,10 @@ struct perf_report_t : public base_perf_report_t {
<< p_->ih << ',' << p_->iw;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "mb,oc,ic,id,ih,iw";
}

double ops() const override { return p_->ops; }
const std::vector<dnnl_data_type_t> *sdt() const override {
return &p_->dt;
Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/lrn/lrn.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2017 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -140,6 +141,10 @@ struct perf_report_t : public base_perf_report_t {
<< ',' << p_->k;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "mb,ic,id,ih,iw,ls,alpha,beta,k";
}

const int64_t *user_mb() const override { return &p_->user_mb; }
const attr_t *attr() const override { return &p_->attr; }
const thr_ctx_t *ctx_init() const override { return &p_->ctx_init; }
Expand Down
3 changes: 3 additions & 0 deletions tests/benchdnn/matmul/matmul.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2019 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -234,6 +235,8 @@ struct perf_report_t : public base_perf_report_t {

void dump_desc_csv(std::ostream &s) const override { dump_desc(s); }

void dump_desc_csv_header(std::ostream &s) const override { s << "desc"; }

double ops() const override { return p_->ops; }
const std::vector<dnnl_data_type_t> *sdt() const override {
return &p_->dt;
Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/pool/pool.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2019 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -207,6 +208,10 @@ struct perf_report_t : public base_perf_report_t {
<< p_->dd << ',' << p_->dh << ',' << p_->dw;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "mb,ic,id,ih,iw,od,oh,ow,kd,kh,kw,sd,sh,sw,pd,ph,pw,dd,dh,dw";
}

const int64_t *user_mb() const override { return &p_->user_mb; }
const std::vector<dnnl_data_type_t> *sdt() const override {
return &p_->dt;
Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/resampling/resampling.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2019 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -155,6 +156,10 @@ struct perf_report_t : public base_perf_report_t {
<< p_->od << ',' << p_->oh << ',' << p_->ow;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "mb,ic,id,ih,iw,od,oh,ow";
}

const int64_t *user_mb() const override { return &p_->user_mb; }
const attr_t *attr() const override { return &p_->attr; }
const thr_ctx_t *ctx_init() const override { return &p_->ctx_init; }
Expand Down
5 changes: 5 additions & 0 deletions tests/benchdnn/rnn/rnn.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2018 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -578,6 +579,10 @@ struct perf_report_t : public base_perf_report_t {
<< "," << p_->slc << "," << p_->dhc << "," << p_->dic;
}

void dump_desc_csv_header(std::ostream &s) const override {
s << "n_layer,n_iter,mb,sic,slc,dhc,dic";
}

void dump_rnn_activation(std::ostream &s) const override {
s << activation2str(p_->activation);
}
Expand Down
52 changes: 52 additions & 0 deletions tests/benchdnn/utils/perf_report.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2021 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,6 +22,7 @@

void base_perf_report_t::report(res_t *res, const char *prb_str) const {
dump_perf_footer();
dump_perf_csv_header();

dnnl::impl::stringstream_t ss;

Expand Down Expand Up @@ -156,3 +158,53 @@ void base_perf_report_t::handle_option(std::ostream &s, const char *&option,
opt_name.c_str());
SAFE_V(FAIL);
}

void base_perf_report_t::dump_perf_csv_header() const {
if (strstr(pt_, "%DESC%") == nullptr) return;

static bool header_printed = false;
if (header_printed) return;

const char *pt = pt_;
char c;
dnnl::impl::stringstream_t ss;
while ((c = *pt++) != '\0') {
if (c != '%') {
ss << c;
continue;
}
handle_csv_header_option(ss, pt);
}

BENCHDNN_PRINT(0, "%s\n", ss.str().c_str());
header_printed = true;
}

void base_perf_report_t::handle_csv_header_option(
std::ostream &s, const char *&option) const {
char c = *option;
if (c == '-' || c == '0' || c == '+') {
switch (c) {
case '-': s << "min_"; break;
case '0': s << "avg_"; break;
case '+': s << "max_"; break;
default: break;
}
++option;
}

const char *option_end = strchr(option, '%');
if (!option_end) {
option += strlen(option);
return;
}

const std::string opt_name(option, option_end);
if (opt_name == "DESC") {
dump_desc_csv_header(s);
} else {
s << opt_name;
}

option = option_end + 1;
}
5 changes: 5 additions & 0 deletions tests/benchdnn/utils/perf_report.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright 2019 Intel Corporation
* Copyright 2026 Arm Ltd. and affiliates
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -65,6 +66,7 @@ struct base_perf_report_t {
virtual void dump_cfg(std::ostream &) const { SAFE_V(FAIL); }
virtual void dump_desc(std::ostream &) const { SAFE_V(FAIL); }
virtual void dump_desc_csv(std::ostream &) const { SAFE_V(FAIL); }
virtual void dump_desc_csv_header(std::ostream &s) const { s << "desc"; }
virtual void dump_flags(std::ostream &) const { SAFE_V(FAIL); }
virtual void dump_rnn_activation(std::ostream &) const { SAFE_V(FAIL); }
virtual void dump_rnn_direction(std::ostream &) const { SAFE_V(FAIL); }
Expand All @@ -83,6 +85,9 @@ struct base_perf_report_t {
}
}

void dump_perf_csv_header() const;
void handle_csv_header_option(std::ostream &s, const char *&option) const;

static timer::timer_t::mode_t modifier2mode(char c) {
if (c == '-') return timer::timer_t::min;
if (c == '0') return timer::timer_t::avg;
Expand Down
Loading