From 0355a58cc569e89ae9a20b304fc695f62e279c91 Mon Sep 17 00:00:00 2001 From: aacostadiaz <127198532+aacostadiaz@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:07:09 +0100 Subject: [PATCH] Standardize benchmark names (#437) This PR moves the get_name function in the benchmarks to a common location, ensuring that different backends can obtain uniform benchmark names. --------- Co-authored-by: Alejandro Acosta --- benchmark/cublas/blas1/asum.cpp | 16 +- benchmark/cublas/blas1/axpy.cpp | 20 +- benchmark/cublas/blas1/dot.cpp | 16 +- benchmark/cublas/blas1/iamax.cpp | 16 +- benchmark/cublas/blas1/iamin.cpp | 16 +- benchmark/cublas/blas1/nrm2.cpp | 16 +- benchmark/cublas/blas1/rotg.cpp | 15 +- benchmark/cublas/blas1/rotm.cpp | 16 +- benchmark/cublas/blas1/rotmg.cpp | 16 +- benchmark/cublas/blas1/scal.cpp | 16 +- benchmark/cublas/blas2/gbmv.cpp | 17 +- benchmark/cublas/blas2/gemv.cpp | 17 +- benchmark/cublas/blas2/ger.cpp | 16 +- benchmark/cublas/blas2/sbmv.cpp | 17 +- benchmark/cublas/blas2/spmv.cpp | 15 +- benchmark/cublas/blas2/spr.cpp | 15 +- benchmark/cublas/blas2/spr2.cpp | 15 +- benchmark/cublas/blas2/symv.cpp | 15 +- benchmark/cublas/blas2/syr.cpp | 17 +- benchmark/cublas/blas2/syr2.cpp | 17 +- benchmark/cublas/blas2/tbmv.cpp | 16 +- benchmark/cublas/blas2/tbsv.cpp | 16 +- benchmark/cublas/blas2/tpmv.cpp | 15 +- benchmark/cublas/blas2/tpsv.cpp | 15 +- benchmark/cublas/blas2/trmv.cpp | 15 +- benchmark/cublas/blas2/trsv.cpp | 15 +- benchmark/cublas/blas3/gemm.cpp | 17 +- benchmark/cublas/blas3/gemm_batched.cpp | 17 +- .../cublas/blas3/gemm_batched_strided.cpp | 19 +- benchmark/cublas/blas3/symm.cpp | 24 +- benchmark/cublas/blas3/syr2k.cpp | 24 +- benchmark/cublas/blas3/syrk.cpp | 24 +- benchmark/cublas/blas3/trmm.cpp | 14 +- benchmark/cublas/blas3/trsm.cpp | 18 +- benchmark/cublas/blas3/trsm_batched.cpp | 17 +- benchmark/rocblas/blas1/asum.cpp | 20 +- benchmark/rocblas/blas1/axpy.cpp | 16 +- benchmark/rocblas/blas1/dot.cpp | 16 +- benchmark/rocblas/blas1/iamax.cpp | 17 +- benchmark/rocblas/blas1/iamin.cpp | 17 +- benchmark/rocblas/blas1/nrm2.cpp | 16 +- benchmark/rocblas/blas1/rotg.cpp | 15 +- benchmark/rocblas/blas1/rotm.cpp | 16 +- benchmark/rocblas/blas1/rotmg.cpp | 16 +- benchmark/rocblas/blas1/scal.cpp | 16 +- benchmark/rocblas/blas2/gbmv.cpp | 17 +- benchmark/rocblas/blas2/gemv.cpp | 17 +- benchmark/rocblas/blas2/ger.cpp | 16 +- benchmark/rocblas/blas2/sbmv.cpp | 17 +- benchmark/rocblas/blas2/spmv.cpp | 17 +- benchmark/rocblas/blas2/spr.cpp | 15 +- benchmark/rocblas/blas2/spr2.cpp | 16 +- benchmark/rocblas/blas2/symv.cpp | 17 +- benchmark/rocblas/blas2/syr.cpp | 16 +- benchmark/rocblas/blas2/syr2.cpp | 16 +- benchmark/rocblas/blas2/tbmv.cpp | 16 +- benchmark/rocblas/blas2/tbsv.cpp | 16 +- benchmark/rocblas/blas2/tpmv.cpp | 17 +- benchmark/rocblas/blas2/tpsv.cpp | 17 +- benchmark/rocblas/blas2/trmv.cpp | 15 +- benchmark/rocblas/blas2/trsv.cpp | 15 +- benchmark/rocblas/blas3/gemm.cpp | 17 +- benchmark/rocblas/blas3/gemm_batched.cpp | 17 +- .../rocblas/blas3/gemm_batched_strided.cpp | 19 +- benchmark/rocblas/blas3/symm.cpp | 22 +- benchmark/rocblas/blas3/syr2k.cpp | 22 +- benchmark/rocblas/blas3/syrk.cpp | 22 +- benchmark/rocblas/blas3/trmm.cpp | 15 +- benchmark/rocblas/blas3/trsm.cpp | 17 +- benchmark/rocblas/blas3/trsm_batched.cpp | 18 +- benchmark/syclblas/blas1/asum.cpp | 20 +- benchmark/syclblas/blas1/axpy.cpp | 20 +- benchmark/syclblas/blas1/copy.cpp | 17 +- benchmark/syclblas/blas1/dot.cpp | 16 +- benchmark/syclblas/blas1/iamax.cpp | 16 +- benchmark/syclblas/blas1/iamin.cpp | 16 +- benchmark/syclblas/blas1/nrm2.cpp | 16 +- benchmark/syclblas/blas1/rotg.cpp | 15 +- benchmark/syclblas/blas1/rotm.cpp | 16 +- benchmark/syclblas/blas1/rotmg.cpp | 16 +- benchmark/syclblas/blas1/scal.cpp | 16 +- benchmark/syclblas/blas1/sdsdot.cpp | 17 +- benchmark/syclblas/blas2/gbmv.cpp | 17 +- benchmark/syclblas/blas2/gemv.cpp | 17 +- benchmark/syclblas/blas2/ger.cpp | 16 +- benchmark/syclblas/blas2/sbmv.cpp | 17 +- benchmark/syclblas/blas2/spmv.cpp | 15 +- benchmark/syclblas/blas2/spr.cpp | 17 +- benchmark/syclblas/blas2/spr2.cpp | 17 +- benchmark/syclblas/blas2/symv.cpp | 15 +- benchmark/syclblas/blas2/syr.cpp | 17 +- benchmark/syclblas/blas2/syr2.cpp | 17 +- benchmark/syclblas/blas2/tbmv.cpp | 16 +- benchmark/syclblas/blas2/tbsv.cpp | 16 +- benchmark/syclblas/blas2/tpmv.cpp | 15 +- benchmark/syclblas/blas2/tpsv.cpp | 20 +- benchmark/syclblas/blas2/trmv.cpp | 15 +- benchmark/syclblas/blas2/trsv.cpp | 16 +- benchmark/syclblas/blas3/gemm.cpp | 17 +- benchmark/syclblas/blas3/gemm_batched.cpp | 19 +- .../syclblas/blas3/gemm_batched_strided.cpp | 18 +- benchmark/syclblas/blas3/symm.cpp | 26 +- benchmark/syclblas/blas3/trsm.cpp | 18 +- benchmark/syclblas/extension/reduction.cpp | 18 +- .../include/common/benchmark_identifier.hpp | 182 +++++++++++++ common/include/common/benchmark_names.hpp | 254 ++++++++++++++++++ .../include/common/blas1_state_counters.hpp | 16 +- .../include/common/blas2_state_counters.hpp | 21 +- .../include/common/blas3_state_counters.hpp | 14 +- common/include/common/common_utils.hpp | 5 + 110 files changed, 1176 insertions(+), 1080 deletions(-) create mode 100644 common/include/common/benchmark_identifier.hpp create mode 100644 common/include/common/benchmark_names.hpp diff --git a/benchmark/cublas/blas1/asum.cpp b/benchmark/cublas/blas1/asum.cpp index fb9a1964d..2523560f0 100644 --- a/benchmark/cublas/blas1/asum.cpp +++ b/benchmark/cublas/blas1/asum.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Asum<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::asum; template static inline void cublas_routine(args_t&&... args) { @@ -140,8 +135,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, cuda_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - cuda_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas1/axpy.cpp b/benchmark/cublas/blas1/axpy.cpp index 680873ab1..170bc9b69 100644 --- a/benchmark/cublas/blas1/axpy.cpp +++ b/benchmark/cublas/blas1/axpy.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Axpy<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::axpy; template static inline void cublas_routine(args_t&&... args) { @@ -50,8 +45,8 @@ void run(benchmark::State& state, cublasHandle_t* cuda_handle_ptr, index_t size, blas_benchmark::utils::set_benchmark_label(state); // init Google-benchmark counters. - blas_benchmark::utils::init_level_1_counters< - blas_benchmark::utils::Level1Op::axpy, scalar_t>(state, size); + blas_benchmark::utils::init_level_1_counters(state, + size); cublasHandle_t& cuda_handle = *cuda_handle_ptr; @@ -139,8 +134,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, cuda_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - cuda_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas1/dot.cpp b/benchmark/cublas/blas1/dot.cpp index 411753dd9..0475de2ad 100644 --- a/benchmark/cublas/blas1/dot.cpp +++ b/benchmark/cublas/blas1/dot.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Dot<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::dot; template static inline void cublas_routine(args_t&&... args) { @@ -141,8 +136,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, cuda_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - cuda_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas1/iamax.cpp b/benchmark/cublas/blas1/iamax.cpp index 981ec9c0e..d67a4e8bd 100644 --- a/benchmark/cublas/blas1/iamax.cpp +++ b/benchmark/cublas/blas1/iamax.cpp @@ -26,13 +26,8 @@ #include "../utils.hpp" #include "common/common_utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Iamax<" << blas_benchmark::utils::get_type_name(); - str << ">/" << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::iamax; template static inline void cublas_routine(args_t&&... args) { @@ -147,8 +142,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, cuda_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - cuda_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas1/iamin.cpp b/benchmark/cublas/blas1/iamin.cpp index 10c2105c5..3a87a094d 100644 --- a/benchmark/cublas/blas1/iamin.cpp +++ b/benchmark/cublas/blas1/iamin.cpp @@ -26,13 +26,8 @@ #include "../utils.hpp" #include "common/common_utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Iamin<" << blas_benchmark::utils::get_type_name(); - str << ">/" << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::iamin; template static inline void cublas_routine(args_t&&... args) { @@ -146,8 +141,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, cuda_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - cuda_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas1/nrm2.cpp b/benchmark/cublas/blas1/nrm2.cpp index c9b02a887..5a16bc4d2 100644 --- a/benchmark/cublas/blas1/nrm2.cpp +++ b/benchmark/cublas/blas1/nrm2.cpp @@ -26,13 +26,8 @@ #include "../utils.hpp" #include -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Nrm2<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::nrm2; template static inline void cublas_routine(args_t&&... args) { @@ -141,8 +136,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, cuda_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - cuda_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas1/rotg.cpp b/benchmark/cublas/blas1/rotg.cpp index 1addbf9ae..08f0f9a7c 100644 --- a/benchmark/cublas/blas1/rotg.cpp +++ b/benchmark/cublas/blas1/rotg.cpp @@ -25,12 +25,8 @@ #include "../utils.hpp" -template -std::string get_name() { - std::ostringstream str{}; - str << "BM_Rotg<" << blas_benchmark::utils::get_type_name() << ">/"; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotg; template static inline void cublas_routine(args_t&&... args) { @@ -158,8 +154,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, cuda_handle_ptr, success); }; - benchmark::RegisterBenchmark(get_name().c_str(), BM_lambda, - cuda_handle_ptr, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, success) ->UseRealTime(); } diff --git a/benchmark/cublas/blas1/rotm.cpp b/benchmark/cublas/blas1/rotm.cpp index 3ee085907..cbb49a169 100644 --- a/benchmark/cublas/blas1/rotm.cpp +++ b/benchmark/cublas/blas1/rotm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Rotm<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotm; template static inline void cublas_routine(args_t&&... args) { @@ -160,8 +155,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, cuda_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - cuda_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas1/rotmg.cpp b/benchmark/cublas/blas1/rotmg.cpp index de94c89cc..aa0bf310c 100644 --- a/benchmark/cublas/blas1/rotmg.cpp +++ b/benchmark/cublas/blas1/rotmg.cpp @@ -26,13 +26,8 @@ #include "../utils.hpp" #include "common/float_comparison.hpp" -template -std::string get_name() { - std::ostringstream str{}; - str << "BM_Rotmg<" << blas_benchmark::utils::get_type_name() - << ">/"; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotmg; template static inline void cublas_routine(args_t&&... args) { @@ -164,8 +159,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, cuda_handle_ptr, success); }; - benchmark::RegisterBenchmark(get_name().c_str(), BM_lambda, - cuda_handle_ptr, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, success) ->UseRealTime(); } diff --git a/benchmark/cublas/blas1/scal.cpp b/benchmark/cublas/blas1/scal.cpp index ceeb29781..0f07aa591 100644 --- a/benchmark/cublas/blas1/scal.cpp +++ b/benchmark/cublas/blas1/scal.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Scal<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::scal; template static inline void cublas_routine(args_t&&... args) { @@ -138,8 +133,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, cuda_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - cuda_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/gbmv.cpp b/benchmark/cublas/blas2/gbmv.cpp index a8319c6ad..fa04767e7 100644 --- a/benchmark/cublas/blas2/gbmv.cpp +++ b/benchmark/cublas/blas2/gbmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t, int m, int n, int kl, int ku) { - std::ostringstream str{}; - str << "BM_Gbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << t << "/" << m << "/" << n << "/" << kl << "/" << ku; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::gbmv; template static inline void cublas_routine(args_t&&... args) { @@ -166,9 +161,11 @@ void register_benchmark(blas_benchmark::Args& args, scalar_t alpha, scalar_t beta, bool* success) { run(st, cuda_handle_ptr, t, m, n, kl, ku, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(ts, m, n, kl, ku).c_str(), - BM_lambda, cuda_handle_ptr, t, m, n, kl, ku, - alpha, beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + ts, m, n, kl, ku, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, t, m, n, kl, ku, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/gemv.cpp b/benchmark/cublas/blas2/gemv.cpp index b76dcc88f..58e66d1e1 100644 --- a/benchmark/cublas/blas2/gemv.cpp +++ b/benchmark/cublas/blas2/gemv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t, int m, int n) { - std::ostringstream str{}; - str << "BM_Gemv<" << blas_benchmark::utils::get_type_name() << ">/" - << t << "/" << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::gemv; template static inline void cublas_routine(args_t&&... args) { @@ -164,9 +159,11 @@ void register_benchmark(blas_benchmark::Args& args, scalar_t beta, bool* success) { run(st, cuda_handle_ptr, t, m, n, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(ts, m, n).c_str(), - BM_lambda, cuda_handle_ptr, t, m, n, alpha, - beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + ts, m, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, t, m, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/ger.cpp b/benchmark/cublas/blas2/ger.cpp index f1b75a6eb..8c21b92ab 100644 --- a/benchmark/cublas/blas2/ger.cpp +++ b/benchmark/cublas/blas2/ger.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int m, int n) { - std::ostringstream str{}; - str << "BM_Ger<" << blas_benchmark::utils::get_type_name() << ">/" - << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::ger; template static inline void cublas_routine(args_t&&... args) { @@ -158,8 +153,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t m, index_t n, scalar_t alpha, bool* success) { run(st, cuda_handle_ptr, m, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(m, n).c_str(), BM_lambda, - cuda_handle_ptr, m, n, alpha, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + m, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, m, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/sbmv.cpp b/benchmark/cublas/blas2/sbmv.cpp index 0177fb374..51d333fda 100644 --- a/benchmark/cublas/blas2/sbmv.cpp +++ b/benchmark/cublas/blas2/sbmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, int k) { - std::ostringstream str{}; - str << "BM_Sbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::sbmv; template static inline void cublas_routine(args_t&&... args) { @@ -164,9 +159,11 @@ void register_benchmark(blas_benchmark::Args& args, scalar_t alpha, scalar_t beta, bool* success) { run(st, cuda_handle_ptr, uplos, n, k, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(uplos, n, k).c_str(), - BM_lambda, cuda_handle_ptr, uplos, n, k, alpha, - beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplos, n, k, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, n, k, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/spmv.cpp b/benchmark/cublas/blas2/spmv.cpp index 6d8abafbe..a1bd717ad 100644 --- a/benchmark/cublas/blas2/spmv.cpp +++ b/benchmark/cublas/blas2/spmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, scalar_t alpha, scalar_t beta) { - std::ostringstream str{}; - str << "BM_Spmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha << "/" << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spmv; template static inline void cublas_routine(args_t&&... args) { @@ -163,8 +158,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplos, n, alpha, beta, success); }; benchmark::RegisterBenchmark( - get_name(uplos, n, alpha, beta).c_str(), BM_lambda, - cuda_handle_ptr, uplos, n, alpha, beta, success) + blas_benchmark::utils::get_name( + uplos, n, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/spr.cpp b/benchmark/cublas/blas2/spr.cpp index 6492c9029..e8df09fa4 100644 --- a/benchmark/cublas/blas2/spr.cpp +++ b/benchmark/cublas/blas2/spr.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, int n, scalar_t alpha, int incX) { - std::ostringstream str{}; - str << "BM_Spr<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha << "/" << incX; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spr; template static inline void cublas_routine(args_t&&... args) { @@ -157,8 +152,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplo, n, alpha, incX, success); }; benchmark::RegisterBenchmark( - get_name(uplo_c, n, alpha, incX).c_str(), BM_lambda_col, - cuda_handle_ptr, uplo_c, n, alpha, incX, success) + blas_benchmark::utils::get_name( + uplo, n, alpha, incX, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda_col, cuda_handle_ptr, uplo_c, n, alpha, incX, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/spr2.cpp b/benchmark/cublas/blas2/spr2.cpp index 9309de182..a5fbf1518 100644 --- a/benchmark/cublas/blas2/spr2.cpp +++ b/benchmark/cublas/blas2/spr2.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, int size, scalar_t alpha, int incX, int incY) { - std::ostringstream str{}; - str << "BM_Spr2<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << size << "/" << alpha << "/" << incX << "/" << incY; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spr2; template static inline void cublas_routine(args_t&&... args) { @@ -160,8 +155,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplo, n, alpha, incX, incY, success); }; benchmark::RegisterBenchmark( - get_name(uplo_c, n, alpha, incX, incY).c_str(), BM_lambda_col, - cuda_handle_ptr, uplo_c, n, alpha, incX, incY, success) + blas_benchmark::utils::get_name( + uplo, n, alpha, incX, incY, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda_col, cuda_handle_ptr, uplo_c, n, alpha, incX, incY, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/symv.cpp b/benchmark/cublas/blas2/symv.cpp index a45db1a87..0e5c1eb80 100644 --- a/benchmark/cublas/blas2/symv.cpp +++ b/benchmark/cublas/blas2/symv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, scalar_t alpha, scalar_t beta) { - std::ostringstream str{}; - str << "BM_Symv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha << "/" << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::symv; template static inline void cublas_routine(args_t&&... args) { @@ -165,8 +160,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplos, n, alpha, beta, success); }; benchmark::RegisterBenchmark( - get_name(uplos, n, alpha, beta).c_str(), BM_lambda, - cuda_handle_ptr, uplos, n, alpha, beta, success) + blas_benchmark::utils::get_name( + uplos, n, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/syr.cpp b/benchmark/cublas/blas2/syr.cpp index e291d1a47..5ec8b8f52 100644 --- a/benchmark/cublas/blas2/syr.cpp +++ b/benchmark/cublas/blas2/syr.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, scalar_t alpha) { - std::ostringstream str{}; - str << "BM_Syr<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::syr; template static inline void cublas_routine(args_t&&... args) { @@ -156,9 +151,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, cuda_handle_ptr, uplo, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(uplo, n, alpha).c_str(), - BM_lambda, cuda_handle_ptr, uplo, n, alpha, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, n, alpha, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplo, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/syr2.cpp b/benchmark/cublas/blas2/syr2.cpp index bbd4b6b98..1f1f4d26e 100644 --- a/benchmark/cublas/blas2/syr2.cpp +++ b/benchmark/cublas/blas2/syr2.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, scalar_t alpha) { - std::ostringstream str{}; - str << "BM_Syr2<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::syr2; template static inline void cublas_routine(args_t&&... args) { @@ -165,9 +160,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, cuda_handle_ptr, uplo, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(uplo, n, alpha).c_str(), - BM_lambda, cuda_handle_ptr, uplo, n, alpha, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, n, alpha, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplo, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/tbmv.cpp b/benchmark/cublas/blas2/tbmv.cpp index 2fd7f7622..41aed9b4a 100644 --- a/benchmark/cublas/blas2/tbmv.cpp +++ b/benchmark/cublas/blas2/tbmv.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n, - int k) { - std::ostringstream str{}; - str << "BM_Tbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tbmv; template static inline void cublas_routine(args_t&&... args) { @@ -167,8 +161,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplos, ts, diags, n, k, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n, k).c_str(), BM_lambda, - cuda_handle_ptr, uplos, ts, diags, n, k, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, k, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, ts, diags, n, k, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/tbsv.cpp b/benchmark/cublas/blas2/tbsv.cpp index 8fb28c015..0110163d1 100644 --- a/benchmark/cublas/blas2/tbsv.cpp +++ b/benchmark/cublas/blas2/tbsv.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, - const int n, const int k) { - std::ostringstream str{}; - str << "BM_Tbsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tbsv; template static inline void cublas_routine(args_t&&... args) { @@ -177,8 +171,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplos, ts, diags, n, k, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n, k).c_str(), BM_lambda, - cuda_handle_ptr, uplos, ts, diags, n, k, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, k, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, ts, diags, n, k, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/tpmv.cpp b/benchmark/cublas/blas2/tpmv.cpp index 06e93d070..dfc87374b 100644 --- a/benchmark/cublas/blas2/tpmv.cpp +++ b/benchmark/cublas/blas2/tpmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Tpmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tpmv; template static inline void cublas_routine(args_t&&... args) { @@ -164,8 +159,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, - cuda_handle_ptr, uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/tpsv.cpp b/benchmark/cublas/blas2/tpsv.cpp index 4768698f8..b0c84adfd 100644 --- a/benchmark/cublas/blas2/tpsv.cpp +++ b/benchmark/cublas/blas2/tpsv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Tpsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tpsv; template static inline void cublas_routine(args_t&&... args) { @@ -175,8 +170,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, - cuda_handle_ptr, uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/trmv.cpp b/benchmark/cublas/blas2/trmv.cpp index cdca79ec5..6d2a7a053 100644 --- a/benchmark/cublas/blas2/trmv.cpp +++ b/benchmark/cublas/blas2/trmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Trmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::trmv; template static inline void cublas_routine(args_t&&... args) { @@ -177,8 +172,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, - cuda_handle_ptr, uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas2/trsv.cpp b/benchmark/cublas/blas2/trsv.cpp index 33fb8e4e5..b82dae4d7 100644 --- a/benchmark/cublas/blas2/trsv.cpp +++ b/benchmark/cublas/blas2/trsv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Trsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::trsv; template static inline void cublas_routine(args_t&&... args) { @@ -173,8 +168,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, cuda_handle_ptr, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, - cuda_handle_ptr, uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas3/gemm.cpp b/benchmark/cublas/blas3/gemm.cpp index 8e0c7e0a5..8e442bbe4 100644 --- a/benchmark/cublas/blas3/gemm.cpp +++ b/benchmark/cublas/blas3/gemm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t1, std::string t2, int m, int k, int n) { - std::ostringstream str{}; - str << "BM_Gemm<" << blas_benchmark::utils::get_type_name() << ">/" - << t1 << "/" << t2 << "/" << m << "/" << k << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm; template static inline void cublas_routine(args_t&&... args) { @@ -164,9 +159,11 @@ void register_benchmark(blas_benchmark::Args& args, scalar_t alpha, scalar_t beta, bool* success) { run(st, cuda_handle_ptr, t1, t2, m, k, n, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(t1s, t2s, m, k, n).c_str(), - BM_lambda, cuda_handle_ptr, t1, t2, m, k, n, - alpha, beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + t1s, t2s, m, k, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, t1, t2, m, k, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas3/gemm_batched.cpp b/benchmark/cublas/blas3/gemm_batched.cpp index e8359fe39..e575e18c5 100644 --- a/benchmark/cublas/blas3/gemm_batched.cpp +++ b/benchmark/cublas/blas3/gemm_batched.cpp @@ -25,16 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t1, std::string t2, int m, int k, int n, - int batch_count, int batch_type) { - std::ostringstream str{}; - str << "BM_GemmBatched<" << blas_benchmark::utils::get_type_name() - << ">/" << t1 << "/" << t2 << "/" << m << "/" << k << "/" << n << "/" - << batch_count << "/" - << blas_benchmark::utils::batch_type_to_str(batch_type); - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm_batched; template static inline void cublas_routine(args_t&&... args) { @@ -207,7 +199,10 @@ void register_benchmark(blas_benchmark::Args& args, batch_count, batch_type, success); }; benchmark::RegisterBenchmark( - get_name(t1s, t2s, m, k, n, batch_count, batch_type).c_str(), + blas_benchmark::utils::get_name( + t1s, t2s, m, k, n, batch_count, batch_type, + blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), BM_lambda, cuda_handle_ptr, t1, t2, m, k, n, alpha, beta, batch_count, batch_type, success) ->UseRealTime(); diff --git a/benchmark/cublas/blas3/gemm_batched_strided.cpp b/benchmark/cublas/blas3/gemm_batched_strided.cpp index bbc61b319..52cefc411 100644 --- a/benchmark/cublas/blas3/gemm_batched_strided.cpp +++ b/benchmark/cublas/blas3/gemm_batched_strided.cpp @@ -25,18 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t1, std::string t2, int m, int k, int n, - int batch_size, int stride_a_mul, int stride_b_mul, - int stride_c_mul) { - std::ostringstream str{}; - str << "BM_GemmBatchedStrided<" - << blas_benchmark::utils::get_type_name() << ">/" << t1 << "/" - << t2 << "/" << m << "/" << k << "/" << n << "/" << batch_size << "/" - << stride_a_mul << "/" << stride_b_mul << "/" << stride_c_mul; - - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm_batched_strided; template static inline void cublas_routine(args_t&&... args) { @@ -208,8 +198,9 @@ void register_benchmark(blas_benchmark::Args& args, batch_size, strd_a_mul, strd_b_mul, strd_c_mul, success); }; benchmark::RegisterBenchmark( - get_name(t1s, t2s, m, k, n, batch_size, stride_a_mul, - stride_b_mul, stride_c_mul) + blas_benchmark::utils::get_name( + t1s, t2s, m, k, n, batch_size, stride_a_mul, stride_b_mul, + stride_c_mul, blas_benchmark::utils::MEM_TYPE_USM) .c_str(), BM_lambda, cuda_handle_ptr, t1, t2, m, k, n, alpha, beta, batch_size, stride_a_mul, stride_b_mul, stride_c_mul, success) diff --git a/benchmark/cublas/blas3/symm.cpp b/benchmark/cublas/blas3/symm.cpp index 4a2e0a5b6..a1c119f53 100644 --- a/benchmark/cublas/blas3/symm.cpp +++ b/benchmark/cublas/blas3/symm.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char side, char uplo, int m, int n, scalar_t alpha, - scalar_t beta) { - std::ostringstream str{}; - str << "BM_Symm<" << blas_benchmark::utils::get_type_name() << ">/" - << side << "/" << uplo << "/" << m << "/" << n << "/" << alpha << "/" - << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::symm; template static inline void cublas_routine(args_t&&... args) { @@ -152,10 +145,13 @@ void register_benchmark(blas_benchmark::Args& args, auto symm_params = blas_benchmark::utils::get_symm_params(args); for (auto p : symm_params) { - char s_side, s_uplo; + std::string side, uplo; index_t m, n; scalar_t alpha, beta; - std::tie(s_side, s_uplo, m, n, alpha, beta) = p; + std::tie(side, uplo, m, n, alpha, beta) = p; + + char side_c = side[0]; + char uplo_c = uplo[0]; auto BM_lambda = [&](benchmark::State& st, cublasHandle_t* cuda_handle_ptr, char side, char uplo, index_t m, index_t n, @@ -164,8 +160,10 @@ void register_benchmark(blas_benchmark::Args& args, success); }; benchmark::RegisterBenchmark( - get_name(s_side, s_uplo, m, n, alpha, beta).c_str(), - BM_lambda, cuda_handle_ptr, s_side, s_uplo, m, n, alpha, beta, success) + blas_benchmark::utils::get_name( + side, uplo, m, n, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, side_c, uplo_c, m, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas3/syr2k.cpp b/benchmark/cublas/blas3/syr2k.cpp index 1e2e9e80c..79247fae5 100644 --- a/benchmark/cublas/blas3/syr2k.cpp +++ b/benchmark/cublas/blas3/syr2k.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, char trans, int n, int k, scalar_t alpha, - scalar_t beta) { - std::ostringstream str{}; - str << "BM_Syr2k<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << trans << "/" << n << "/" << k << "/" << alpha << "/" - << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::syr2k; template static inline void cublas_routine(args_t&&... args) { @@ -151,10 +144,13 @@ void register_benchmark(blas_benchmark::Args& args, auto syr2k_params = blas_benchmark::utils::get_syrk_params(args); for (auto p : syr2k_params) { - char s_uplo, s_trans; + std::string uplo, trans; index_t n, k; scalar_t alpha, beta; - std::tie(s_uplo, s_trans, n, k, alpha, beta) = p; + std::tie(uplo, trans, n, k, alpha, beta) = p; + + char uplo_c = uplo[0]; + char trans_c = trans[0]; auto BM_lambda = [&](benchmark::State& st, cublasHandle_t* cuda_handle_ptr, char uplo, char trans, index_t n, index_t k, @@ -163,8 +159,10 @@ void register_benchmark(blas_benchmark::Args& args, success); }; benchmark::RegisterBenchmark( - get_name(s_uplo, s_trans, n, k, alpha, beta).c_str(), - BM_lambda, cuda_handle_ptr, s_uplo, s_trans, n, k, alpha, beta, success) + blas_benchmark::utils::get_name( + uplo, trans, n, k, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplo_c, trans_c, n, k, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas3/syrk.cpp b/benchmark/cublas/blas3/syrk.cpp index 3c2326e17..4555655d2 100644 --- a/benchmark/cublas/blas3/syrk.cpp +++ b/benchmark/cublas/blas3/syrk.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, char trans, int n, int k, scalar_t alpha, - scalar_t beta) { - std::ostringstream str{}; - str << "BM_Syrk<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << trans << "/" << n << "/" << k << "/" << alpha << "/" - << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::syrk; template static inline void cublas_routine(args_t&&... args) { @@ -147,10 +140,13 @@ void register_benchmark(blas_benchmark::Args& args, auto syrk_params = blas_benchmark::utils::get_syrk_params(args); for (auto p : syrk_params) { - char s_uplo, s_trans; + std::string uplo, trans; index_t n, k; scalar_t alpha, beta; - std::tie(s_uplo, s_trans, n, k, alpha, beta) = p; + std::tie(uplo, trans, n, k, alpha, beta) = p; + + char uplo_c = uplo[0]; + char trans_c = trans[0]; auto BM_lambda = [&](benchmark::State& st, cublasHandle_t* cuda_handle_ptr, char uplo, char trans, index_t n, index_t k, @@ -159,8 +155,10 @@ void register_benchmark(blas_benchmark::Args& args, success); }; benchmark::RegisterBenchmark( - get_name(s_uplo, s_trans, n, k, alpha, beta).c_str(), - BM_lambda, cuda_handle_ptr, s_uplo, s_trans, n, k, alpha, beta, success) + blas_benchmark::utils::get_name( + uplo, trans, n, k, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, uplo_c, trans_c, n, k, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas3/trmm.cpp b/benchmark/cublas/blas3/trmm.cpp index b25370d10..47bfb36e7 100644 --- a/benchmark/cublas/blas3/trmm.cpp +++ b/benchmark/cublas/blas3/trmm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char side, char uplo, char t, char diag, int m, int n) { - std::ostringstream str{}; - str << "BM_Trmm<" << blas_benchmark::utils::get_type_name() << ">/" - << side << "/" << uplo << "/" << t << "/" << diag << "/" << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::trmm; template static inline void cublas_routine(args_t&&... args) { @@ -176,7 +171,10 @@ void register_benchmark(blas_benchmark::Args& args, success); }; benchmark::RegisterBenchmark( - get_name(s_side, s_uplo, s_t, s_diag, m, n).c_str(), + blas_benchmark::utils::get_name( + s_side, s_uplo, s_t, s_diag, m, n, + blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), BM_lambda, cuda_handle_ptr, s_side, s_uplo, s_t, s_diag, m, n, alpha, success) ->UseRealTime(); diff --git a/benchmark/cublas/blas3/trsm.cpp b/benchmark/cublas/blas3/trsm.cpp index d5721214a..4d39b712f 100644 --- a/benchmark/cublas/blas3/trsm.cpp +++ b/benchmark/cublas/blas3/trsm.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char side, char uplo, char trans, char diag, index_t m, - index_t n) { - std::ostringstream str{}; - str << "BM_Trsm<" << blas_benchmark::utils::get_type_name() << ">/" - << side << "/" << uplo << "/" << trans << "/" << diag << "/" << m << "/" - << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::trsm; template static inline void cublas_routine(args_t&&... args) { @@ -178,8 +171,11 @@ void register_benchmark(blas_benchmark::Args& args, success); }; benchmark::RegisterBenchmark( - get_name(side, uplo, trans, diag, m, n).c_str(), BM_lambda, - cuda_handle_ptr, side, uplo, trans, diag, m, n, alpha, success) + blas_benchmark::utils::get_name( + side, uplo, trans, diag, m, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, cuda_handle_ptr, side, uplo, trans, diag, m, n, alpha, + success) ->UseRealTime(); } } diff --git a/benchmark/cublas/blas3/trsm_batched.cpp b/benchmark/cublas/blas3/trsm_batched.cpp index 6bb97f170..6bdb6bffc 100644 --- a/benchmark/cublas/blas3/trsm_batched.cpp +++ b/benchmark/cublas/blas3/trsm_batched.cpp @@ -25,16 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(const char side, const char uplo, const char t, - const char diag, int m, int n, int batch_count, - int stride_a_mul, int stride_b_mul) { - std::ostringstream str{}; - str << "BM_TrsmBatched<" << blas_benchmark::utils::get_type_name() - << ">/" << side << "/" << uplo << "/" << t << "/" << diag << "/" << m - << "/" << n << "/" << batch_count; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::trsm_batched; template static inline void cublas_routine(args_t&&... args) { @@ -216,8 +208,9 @@ void register_benchmark(blas_benchmark::Args& args, batch_count, strd_a_mul, strd_b_mul, success); }; benchmark::RegisterBenchmark( - get_name(s_side, s_uplo, s_t, s_diag, m, n, batch_count, - stride_a_mul, stride_b_mul) + blas_benchmark::utils::get_name( + s_side, s_uplo, s_t, s_diag, m, n, batch_count, stride_a_mul, + stride_b_mul, blas_benchmark::utils::MEM_TYPE_USM) .c_str(), BM_lambda, cuda_handle_ptr, s_side, s_uplo, s_t, s_diag, m, n, alpha, batch_count, stride_a_mul, stride_b_mul, success) diff --git a/benchmark/rocblas/blas1/asum.cpp b/benchmark/rocblas/blas1/asum.cpp index 5bdc1438b..550bb7006 100644 --- a/benchmark/rocblas/blas1/asum.cpp +++ b/benchmark/rocblas/blas1/asum.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Asum<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::asum; template static inline void rocblas_asum_f(args_t&&... args) { @@ -50,8 +45,8 @@ void run(benchmark::State& state, rocblas_handle& rb_handle, index_t size, blas_benchmark::utils::set_benchmark_label(state); // Google-benchmark counters are double. - blas_benchmark::utils::init_level_1_counters< - blas_benchmark::utils::Level1Op::asum, scalar_t>(state, size); + blas_benchmark::utils::init_level_1_counters(state, + size); using data_t = scalar_t; @@ -140,8 +135,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t size, bool* success) { run(st, rb_handle, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - rb_handle, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, size, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas1/axpy.cpp b/benchmark/rocblas/blas1/axpy.cpp index f6774bbe2..5c34fa83d 100644 --- a/benchmark/rocblas/blas1/axpy.cpp +++ b/benchmark/rocblas/blas1/axpy.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Axpy" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::axpy; template static inline void rocblas_saxpy_f(args_t&&... args) { @@ -143,8 +138,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t size, bool* success) { run(st, rb_handle, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - rb_handle, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, size, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas1/dot.cpp b/benchmark/rocblas/blas1/dot.cpp index 7e622f096..9a4c3dbc5 100644 --- a/benchmark/rocblas/blas1/dot.cpp +++ b/benchmark/rocblas/blas1/dot.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Dot<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::dot; template static inline void rocblas_dot_f(args_t&&... args) { @@ -140,8 +135,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t size, bool* success) { run(st, rb_handle, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - rb_handle, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, size, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas1/iamax.cpp b/benchmark/rocblas/blas1/iamax.cpp index 5db81b946..bb99e15e2 100644 --- a/benchmark/rocblas/blas1/iamax.cpp +++ b/benchmark/rocblas/blas1/iamax.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Iamax<" << blas_benchmark::utils::get_type_name() - << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::iamax; template static inline void rocblas_iamax_f(args_t&&... args) { @@ -144,8 +138,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t size, bool* success) { run(st, rb_handle, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - rb_handle, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, size, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas1/iamin.cpp b/benchmark/rocblas/blas1/iamin.cpp index cea9b0f49..83a280b8c 100644 --- a/benchmark/rocblas/blas1/iamin.cpp +++ b/benchmark/rocblas/blas1/iamin.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Iamin<" << blas_benchmark::utils::get_type_name() - << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::iamin; template static inline void rocblas_iamin_f(args_t&&... args) { @@ -144,8 +138,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t size, bool* success) { run(st, rb_handle, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - rb_handle, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, size, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas1/nrm2.cpp b/benchmark/rocblas/blas1/nrm2.cpp index 265cd7041..66a9f2f2b 100644 --- a/benchmark/rocblas/blas1/nrm2.cpp +++ b/benchmark/rocblas/blas1/nrm2.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Nrm2<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::nrm2; template static inline void rocblas_nrm2_f(args_t&&... args) { @@ -138,8 +133,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t size, bool* success) { run(st, rb_handle, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - rb_handle, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, size, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas1/rotg.cpp b/benchmark/rocblas/blas1/rotg.cpp index 65feca509..5cdff1b88 100644 --- a/benchmark/rocblas/blas1/rotg.cpp +++ b/benchmark/rocblas/blas1/rotg.cpp @@ -25,12 +25,8 @@ #include "../utils.hpp" -template -std::string get_name() { - std::ostringstream str{}; - str << "BM_Rotg<" << blas_benchmark::utils::get_type_name() << ">/"; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotg; template static inline void rocblas_rotg_f(args_t&&... args) { @@ -159,8 +155,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, bool* success) { run(st, rb_handle, success); }; - benchmark::RegisterBenchmark(get_name().c_str(), BM_lambda, - rb_handle, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, success) ->UseRealTime(); } diff --git a/benchmark/rocblas/blas1/rotm.cpp b/benchmark/rocblas/blas1/rotm.cpp index e104b013f..4d00ff1ee 100644 --- a/benchmark/rocblas/blas1/rotm.cpp +++ b/benchmark/rocblas/blas1/rotm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Rotm<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotm; template static inline void rocblas_rotm_f(args_t&&... args) { @@ -163,8 +158,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t size, bool* success) { run(st, rb_handle, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - rb_handle, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, size, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas1/rotmg.cpp b/benchmark/rocblas/blas1/rotmg.cpp index c0e9e5e2c..521ad8f36 100644 --- a/benchmark/rocblas/blas1/rotmg.cpp +++ b/benchmark/rocblas/blas1/rotmg.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name() { - std::ostringstream str{}; - str << "BM_Rotmg<" << blas_benchmark::utils::get_type_name() - << ">/"; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotmg; template static inline void rocblas_rotmg_f(args_t&&... args) { @@ -166,8 +161,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, bool* success) { run(st, rb_handle, success); }; - benchmark::RegisterBenchmark(get_name().c_str(), BM_lambda, - rb_handle, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, success) ->UseRealTime(); } diff --git a/benchmark/rocblas/blas1/scal.cpp b/benchmark/rocblas/blas1/scal.cpp index 88e5f0873..dcb030003 100644 --- a/benchmark/rocblas/blas1/scal.cpp +++ b/benchmark/rocblas/blas1/scal.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Scal<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::scal; template static inline void rocblas_scal_f(args_t&&... args) { @@ -140,8 +135,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t size, bool* success) { run(st, rb_handle, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - rb_handle, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, size, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/gbmv.cpp b/benchmark/rocblas/blas2/gbmv.cpp index 1d523f89e..86a928bee 100644 --- a/benchmark/rocblas/blas2/gbmv.cpp +++ b/benchmark/rocblas/blas2/gbmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t, int m, int n, int kl, int ku) { - std::ostringstream str{}; - str << "BM_Gbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << t << "/" << m << "/" << n << "/" << kl << "/" << ku; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::gbmv; template static inline void rocblas_gbmv_f(args_t&&... args) { @@ -180,9 +175,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, scalar_t alpha, scalar_t beta, bool* success) { run(st, rb_handle, t, m, n, kl, ku, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(ts, m, n, kl, ku).c_str(), - BM_lambda, rb_handle, t, m, n, kl, ku, alpha, - beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + ts, m, n, kl, ku, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, t, m, n, kl, ku, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/gemv.cpp b/benchmark/rocblas/blas2/gemv.cpp index c096de97a..891715dd9 100644 --- a/benchmark/rocblas/blas2/gemv.cpp +++ b/benchmark/rocblas/blas2/gemv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t, int m, int n) { - std::ostringstream str{}; - str << "BM_Gemv<" << blas_benchmark::utils::get_type_name() << ">/" - << t << "/" << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::gemv; template static inline void rocblas_gemv_f(args_t&&... args) { @@ -179,9 +174,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, bool* success) { run(st, rb_handle, t, m, n, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(ts, m, n).c_str(), - BM_lambda, rb_handle, t, m, n, alpha, beta, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + ts, m, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, t, m, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/ger.cpp b/benchmark/rocblas/blas2/ger.cpp index a482dd4b3..1e1605db1 100644 --- a/benchmark/rocblas/blas2/ger.cpp +++ b/benchmark/rocblas/blas2/ger.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int m, int n) { - std::ostringstream str{}; - str << "BM_Ger<" << blas_benchmark::utils::get_type_name() << ">/" - << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::ger; template static inline void rocblas_ger_f(args_t&&... args) { @@ -167,8 +162,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t m, index_t n, scalar_t alpha, bool* success) { run(st, rb_handle, m, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(m, n).c_str(), BM_lambda, - rb_handle, m, n, alpha, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + m, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, m, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/sbmv.cpp b/benchmark/rocblas/blas2/sbmv.cpp index 63c2e642a..1822208bb 100644 --- a/benchmark/rocblas/blas2/sbmv.cpp +++ b/benchmark/rocblas/blas2/sbmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, int k) { - std::ostringstream str{}; - str << "BM_Sbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::sbmv; template static inline void rocblas_sbmv_f(args_t&&... args) { @@ -176,9 +171,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, scalar_t beta, bool* success) { run(st, rb_handle, uplo, n, k, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(uplo, n, k).c_str(), - BM_lambda, rb_handle, uplo, n, k, alpha, beta, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, n, k, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo, n, k, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/spmv.cpp b/benchmark/rocblas/blas2/spmv.cpp index 131e28e5d..a7b3defc1 100644 --- a/benchmark/rocblas/blas2/spmv.cpp +++ b/benchmark/rocblas/blas2/spmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n) { - std::ostringstream str{}; - str << "BM_Spmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spmv; template static inline void rocblas_spmv_f(args_t&&... args) { @@ -173,9 +168,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, scalar_t beta, bool* success) { run(st, rb_handle, uplos, n, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(uplos, n).c_str(), - BM_lambda, rb_handle, uplos, n, alpha, beta, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplos, n, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplos, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/spr.cpp b/benchmark/rocblas/blas2/spr.cpp index 3d119d51c..886b126d0 100644 --- a/benchmark/rocblas/blas2/spr.cpp +++ b/benchmark/rocblas/blas2/spr.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, int n, scalar_t alpha, int incX) { - std::ostringstream str{}; - str << "BM_Spr<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha << "/" << incX; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spr; template static inline void rocblas_spr_f(args_t&&... args) { @@ -165,8 +160,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, run(st, rb_handle, uplo, n, alpha, incX, success); }; benchmark::RegisterBenchmark( - get_name(uplo_str, n, alpha, incX).c_str(), BM_lambda_col, - rb_handle, uplo_str, n, alpha, incX, success) + blas_benchmark::utils::get_name( + uplo, n, alpha, incX, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda_col, rb_handle, uplo_str, n, alpha, incX, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/spr2.cpp b/benchmark/rocblas/blas2/spr2.cpp index e62fbeab8..e68ec2818 100644 --- a/benchmark/rocblas/blas2/spr2.cpp +++ b/benchmark/rocblas/blas2/spr2.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, int size, scalar_t alpha, index_t incX, - index_t incY) { - std::ostringstream str{}; - str << "BM_Spr2<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << size << "/" << alpha << "/" << incX << "/" << incY; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spr2; template static inline void rocblas_spr2_f(args_t&&... args) { @@ -174,8 +168,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, run(st, rb_handle, uplo, n, alpha, incX, incY, success); }; benchmark::RegisterBenchmark( - get_name(uplo_c, n, alpha, incX, incY).c_str(), BM_lambda, - rb_handle, uplo_c, n, alpha, incX, incY, success) + blas_benchmark::utils::get_name( + uplo, n, alpha, incX, incY, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo_c, n, alpha, incX, incY, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/symv.cpp b/benchmark/rocblas/blas2/symv.cpp index 578dc778f..0625fcbc5 100644 --- a/benchmark/rocblas/blas2/symv.cpp +++ b/benchmark/rocblas/blas2/symv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n) { - std::ostringstream str{}; - str << "BM_Symv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::symv; template static inline void rocblas_symv_f(args_t&&... args) { @@ -176,9 +171,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, scalar_t beta, bool* success) { run(st, rb_handle, uplos, n, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(uplos, n).c_str(), - BM_lambda, rb_handle, uplos, n, alpha, beta, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplos, n, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplos, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/syr.cpp b/benchmark/rocblas/blas2/syr.cpp index a6f6bf4c9..ecc51691d 100644 --- a/benchmark/rocblas/blas2/syr.cpp +++ b/benchmark/rocblas/blas2/syr.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n) { - std::ostringstream str{}; - str << "BM_Syr<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::syr; template static inline void rocblas_syr_f(args_t&&... args) { @@ -169,8 +164,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, bool* success) { run(st, rb_handle, uplo, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(uplo, n).c_str(), BM_lambda, - rb_handle, uplo, n, alpha, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, n, alpha, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/syr2.cpp b/benchmark/rocblas/blas2/syr2.cpp index 7d25e6378..731d62f4b 100644 --- a/benchmark/rocblas/blas2/syr2.cpp +++ b/benchmark/rocblas/blas2/syr2.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n) { - std::ostringstream str{}; - str << "BM_Syr2<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::syr2; template static inline void rocblas_syr2_f(args_t&&... args) { @@ -175,8 +170,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, bool* success) { run(st, rb_handle, uplo, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(uplo, n).c_str(), BM_lambda, - rb_handle, uplo, n, alpha, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, n, alpha, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/tbmv.cpp b/benchmark/rocblas/blas2/tbmv.cpp index fdb7e3612..d35b930ce 100644 --- a/benchmark/rocblas/blas2/tbmv.cpp +++ b/benchmark/rocblas/blas2/tbmv.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n, - int k) { - std::ostringstream str{}; - str << "BM_Tbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tbmv; template static inline void rocblas_tbmv_f(args_t&&... args) { @@ -175,8 +169,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, run(st, rb_handle, uplos, ts, diags, n, k, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n, k).c_str(), BM_lambda, - rb_handle, uplos, ts, diags, n, k, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, k, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplos, ts, diags, n, k, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/tbsv.cpp b/benchmark/rocblas/blas2/tbsv.cpp index b9e1b6cf2..4b22c2986 100644 --- a/benchmark/rocblas/blas2/tbsv.cpp +++ b/benchmark/rocblas/blas2/tbsv.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n, - int k) { - std::ostringstream str{}; - str << "BM_Tbsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tbsv; template static inline void rocblas_tbsv_f(args_t&&... args) { @@ -185,8 +179,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, run(st, rb_handle, uplo, ts, diags, n, k, success); }; benchmark::RegisterBenchmark( - get_name(uplo, ts, diags, n, k).c_str(), BM_lambda, rb_handle, - uplo, ts, diags, n, k, success) + blas_benchmark::utils::get_name( + uplo, ts, diags, n, k, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo, ts, diags, n, k, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/tpmv.cpp b/benchmark/rocblas/blas2/tpmv.cpp index e572a9c3b..93ca8fb6c 100644 --- a/benchmark/rocblas/blas2/tpmv.cpp +++ b/benchmark/rocblas/blas2/tpmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Tpmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tpmv; template static inline void rocblas_tpmv_f(args_t&&... args) { @@ -171,9 +166,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t n, bool* success) { run(st, rb_handle, uplo, ts, diags, n, success); }; - benchmark::RegisterBenchmark(get_name(uplo, ts, diags, n).c_str(), - BM_lambda, rb_handle, uplo, ts, diags, n, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, ts, diags, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/tpsv.cpp b/benchmark/rocblas/blas2/tpsv.cpp index df9b6c652..9203832ef 100644 --- a/benchmark/rocblas/blas2/tpsv.cpp +++ b/benchmark/rocblas/blas2/tpsv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Tpsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tpsv; template static inline void rocblas_tpsv_f(args_t&&... args) { @@ -181,9 +176,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, index_t n, bool* success) { run(st, rb_handle, uplo, ts, diags, n, success); }; - benchmark::RegisterBenchmark(get_name(uplo, ts, diags, n).c_str(), - BM_lambda, rb_handle, uplo, ts, diags, n, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, ts, diags, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/trmv.cpp b/benchmark/rocblas/blas2/trmv.cpp index d0c4ba896..a780f46ba 100644 --- a/benchmark/rocblas/blas2/trmv.cpp +++ b/benchmark/rocblas/blas2/trmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Trmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::trmv; template static inline void rocblas_trmv_f(args_t&&... args) { @@ -173,8 +168,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, run(st, rb_handle, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, rb_handle, - uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas2/trsv.cpp b/benchmark/rocblas/blas2/trsv.cpp index 4c962851a..d3a5cf11f 100644 --- a/benchmark/rocblas/blas2/trsv.cpp +++ b/benchmark/rocblas/blas2/trsv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Trsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::trsv; template static inline void rocblas_trsv_f(args_t&&... args) { @@ -181,8 +176,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, run(st, rb_handle, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, rb_handle, - uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas3/gemm.cpp b/benchmark/rocblas/blas3/gemm.cpp index e858d5bf5..c254ff377 100644 --- a/benchmark/rocblas/blas3/gemm.cpp +++ b/benchmark/rocblas/blas3/gemm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t_a, std::string t_b, int m, int k, int n) { - std::ostringstream str{}; - str << "BM_Gemm<" << blas_benchmark::utils::get_type_name() << ">/" - << t_a << "/" << t_b << "/" << m << "/" << k << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm; template static inline void rocblas_gemm_f(args_t&&... args) { @@ -179,9 +174,11 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, scalar_t alpha, scalar_t beta, bool* success) { run(st, rb_handle, t1i, t2i, m, k, n, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(t_a, t_b, m, k, n).c_str(), - BM_lambda, rb_handle, t_a_i, t_b_i, m, k, n, - alpha, beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + t_a, t_b, m, k, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, t_a_i, t_b_i, m, k, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas3/gemm_batched.cpp b/benchmark/rocblas/blas3/gemm_batched.cpp index d0a2ee019..62b1cbced 100644 --- a/benchmark/rocblas/blas3/gemm_batched.cpp +++ b/benchmark/rocblas/blas3/gemm_batched.cpp @@ -25,16 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t1, std::string t2, int m, int k, int n, - int batch_size, int batch_type) { - std::ostringstream str{}; - str << "BM_GemmBatched<" << blas_benchmark::utils::get_type_name() - << ">/" << t1 << "/" << t2 << "/" << m << "/" << k << "/" << n << "/" - << batch_size << "/" - << blas_benchmark::utils::batch_type_to_str(batch_type); - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm_batched; template static inline void rocblas_gemm_batched_f(args_t&&... args) { @@ -207,7 +199,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, batch_size, batch_type, success); }; benchmark::RegisterBenchmark( - get_name(t_a, t_b, m, k, n, batch_size, batch_type).c_str(), + blas_benchmark::utils::get_name( + t_a, t_b, m, k, n, batch_size, batch_type, + blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), BM_lambda, rb_handle, t_a_i, t_b_i, m, k, n, alpha, beta, batch_size, batch_type, success) ->UseRealTime(); diff --git a/benchmark/rocblas/blas3/gemm_batched_strided.cpp b/benchmark/rocblas/blas3/gemm_batched_strided.cpp index dbe9fe7e8..cdac699ca 100644 --- a/benchmark/rocblas/blas3/gemm_batched_strided.cpp +++ b/benchmark/rocblas/blas3/gemm_batched_strided.cpp @@ -25,18 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t1, std::string t2, int m, int k, int n, - int batch_size, int stride_a_mul, int stride_b_mul, - int stride_c_mul) { - std::ostringstream str{}; - str << "BM_GemmBatchedStrided<" - << blas_benchmark::utils::get_type_name() << ">/" << t1 << "/" - << t2 << "/" << m << "/" << k << "/" << n << "/" << batch_size << "/" - << stride_a_mul << "/" << stride_b_mul << "/" << stride_c_mul; - - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm_batched_strided; template static inline void rocblas_gemm_strided_batched(args_t&&... args) { @@ -219,8 +209,9 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, strd_a_mul, strd_b_mul, strd_c_mul, success); }; benchmark::RegisterBenchmark( - get_name(t_a, t_b, m, k, n, batch_size, stride_a_mul, - stride_b_mul, stride_c_mul) + blas_benchmark::utils::get_name( + t_a, t_b, m, k, n, batch_size, stride_a_mul, stride_b_mul, + stride_c_mul, blas_benchmark::utils::MEM_TYPE_USM) .c_str(), BM_lambda, rb_handle, t_a_i, t_b_i, m, k, n, alpha, beta, batch_size, stride_a_mul, stride_b_mul, stride_c_mul, success) diff --git a/benchmark/rocblas/blas3/symm.cpp b/benchmark/rocblas/blas3/symm.cpp index 52e595e90..c2fee6d52 100644 --- a/benchmark/rocblas/blas3/symm.cpp +++ b/benchmark/rocblas/blas3/symm.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char side, char uplo, int m, int n, scalar_t alpha, - scalar_t beta) { - std::ostringstream str{}; - str << "BM_Symm<" << blas_benchmark::utils::get_type_name() << ">/" - << side << "/" << uplo << "/" << m << "/" << n << "/" << alpha << "/" - << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::symm; template static inline void rocblas_symm_f(args_t&&... args) { @@ -161,19 +154,24 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, auto symm_params = blas_benchmark::utils::get_symm_params(args); for (auto p : symm_params) { - char side, uplo; + std::string side, uplo; index_t m, n; scalar_t alpha, beta; std::tie(side, uplo, m, n, alpha, beta) = p; + char side_c = side[0]; + char uplo_c = uplo[0]; + auto BM_lambda = [&](benchmark::State& st, rocblas_handle rb_handle, char side, char uplo, index_t m, index_t n, scalar_t alpha, scalar_t beta, bool* success) { run(st, rb_handle, side, uplo, m, n, alpha, beta, success); }; benchmark::RegisterBenchmark( - get_name(side, uplo, m, n, alpha, beta).c_str(), BM_lambda, - rb_handle, side, uplo, m, n, alpha, beta, success) + blas_benchmark::utils::get_name( + side, uplo, m, n, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, side_c, uplo_c, m, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas3/syr2k.cpp b/benchmark/rocblas/blas3/syr2k.cpp index d7cfa1cb8..fb2dee110 100644 --- a/benchmark/rocblas/blas3/syr2k.cpp +++ b/benchmark/rocblas/blas3/syr2k.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, char trans, int n, int k, scalar_t alpha, - scalar_t beta) { - std::ostringstream str{}; - str << "BM_Syr2k<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << trans << "/" << n << "/" << k << "/" << alpha << "/" - << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::syr2k; template static inline void rocblas_syr2k_f(args_t&&... args) { @@ -158,19 +151,24 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, auto syr2k_params = blas_benchmark::utils::get_syrk_params(args); for (auto p : syr2k_params) { - char uplo, trans; + std::string uplo, trans; index_t n, k; scalar_t alpha, beta; std::tie(uplo, trans, n, k, alpha, beta) = p; + char uplo_c = uplo[0]; + char trans_c = trans[0]; + auto BM_lambda = [&](benchmark::State& st, rocblas_handle rb_handle, char uplo, char trans, index_t n, index_t k, scalar_t alpha, scalar_t beta, bool* success) { run(st, rb_handle, uplo, trans, n, k, alpha, beta, success); }; benchmark::RegisterBenchmark( - get_name(uplo, trans, n, k, alpha, beta).c_str(), BM_lambda, - rb_handle, uplo, trans, n, k, alpha, beta, success) + blas_benchmark::utils::get_name( + uplo, trans, n, k, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo_c, trans_c, n, k, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas3/syrk.cpp b/benchmark/rocblas/blas3/syrk.cpp index 04b86684a..4cb909e4b 100644 --- a/benchmark/rocblas/blas3/syrk.cpp +++ b/benchmark/rocblas/blas3/syrk.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, char trans, int n, int k, scalar_t alpha, - scalar_t beta) { - std::ostringstream str{}; - str << "BM_Syrk<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << trans << "/" << n << "/" << k << "/" << alpha << "/" - << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::syrk; template static inline void rocblas_syrk_f(args_t&&... args) { @@ -155,19 +148,24 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, auto syrk_params = blas_benchmark::utils::get_syrk_params(args); for (auto p : syrk_params) { - char uplo, trans; + std::string uplo, trans; index_t n, k; scalar_t alpha, beta; std::tie(uplo, trans, n, k, alpha, beta) = p; + char uplo_c = uplo[0]; + char trans_c = trans[0]; + auto BM_lambda = [&](benchmark::State& st, rocblas_handle rb_handle, char uplo, char trans, index_t n, index_t k, scalar_t alpha, scalar_t beta, bool* success) { run(st, rb_handle, uplo, trans, n, k, alpha, beta, success); }; benchmark::RegisterBenchmark( - get_name(uplo, trans, n, k, alpha, beta).c_str(), BM_lambda, - rb_handle, uplo, trans, n, k, alpha, beta, success) + blas_benchmark::utils::get_name( + uplo, trans, n, k, alpha, beta, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, uplo_c, trans_c, n, k, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas3/trmm.cpp b/benchmark/rocblas/blas3/trmm.cpp index 5e50f39db..09e1d4933 100644 --- a/benchmark/rocblas/blas3/trmm.cpp +++ b/benchmark/rocblas/blas3/trmm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char side, char uplo, char t, char diag, int m, int n) { - std::ostringstream str{}; - str << "BM_Trmm<" << blas_benchmark::utils::get_type_name() << ">/" - << side << "/" << uplo << "/" << t << "/" << diag << "/" << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::trmm; template static inline void rocblas_trmm_f(args_t&&... args) { @@ -177,8 +172,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, run(st, rb_handle, side, uplo, t, diag, m, n, alpha, success); }; benchmark::RegisterBenchmark( - get_name(side, uplo, trans, diag, m, n).c_str(), BM_lambda, - rb_handle, side, uplo, trans, diag, m, n, alpha, success) + blas_benchmark::utils::get_name( + side, uplo, trans, diag, m, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, side, uplo, trans, diag, m, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas3/trsm.cpp b/benchmark/rocblas/blas3/trsm.cpp index 1353e2251..dbf72bf3e 100644 --- a/benchmark/rocblas/blas3/trsm.cpp +++ b/benchmark/rocblas/blas3/trsm.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char side, char uplo, char trans, char diag, index_t m, - index_t n) { - std::ostringstream str{}; - str << "BM_Trsm<" << blas_benchmark::utils::get_type_name() << ">/" - << side << "/" << uplo << "/" << trans << "/" << diag << "/" << m << "/" - << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::trsm; template static inline void rocblas_trsm_f(args_t&&... args) { @@ -181,8 +174,10 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, success); }; benchmark::RegisterBenchmark( - get_name(side, uplo, trans, diag, m, n).c_str(), BM_lambda, - rb_handle, side, uplo, trans, diag, m, n, alpha, success) + blas_benchmark::utils::get_name( + side, uplo, trans, diag, m, n, blas_benchmark::utils::MEM_TYPE_USM) + .c_str(), + BM_lambda, rb_handle, side, uplo, trans, diag, m, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/rocblas/blas3/trsm_batched.cpp b/benchmark/rocblas/blas3/trsm_batched.cpp index 989e6e17d..e6d9d89f8 100644 --- a/benchmark/rocblas/blas3/trsm_batched.cpp +++ b/benchmark/rocblas/blas3/trsm_batched.cpp @@ -25,17 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(const char side, const char uplo, const char t, - const char diag, int m, int n, int batch_size, - int stride_a_mul, int stride_b_mul) { - std::ostringstream str{}; - str << "BM_TrsmBatched<" << blas_benchmark::utils::get_type_name() - << ">/" << side << "/" << uplo << "/" << t << "/" << diag << "/" << m - << "/" << n << "/" << batch_size << "/" << stride_a_mul << "/" - << stride_b_mul << "/"; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::trsm_batched; template static inline void rocblas_trsm_batched_f(args_t&&... args) { @@ -215,8 +206,9 @@ void register_benchmark(blas_benchmark::Args& args, rocblas_handle& rb_handle, strd_a_mul, strd_b_mul, success); }; benchmark::RegisterBenchmark( - get_name(s_side, s_uplo, s_t, s_diag, m, n, batch_size, - stride_a_mul, stride_b_mul) + blas_benchmark::utils::get_name( + s_side, s_uplo, s_t, s_diag, m, n, batch_size, stride_a_mul, + stride_b_mul, blas_benchmark::utils::MEM_TYPE_USM) .c_str(), BM_lambda, rb_handle, s_side, s_uplo, s_t, s_diag, m, n, alpha, batch_size, stride_a_mul, stride_b_mul, success) diff --git a/benchmark/syclblas/blas1/asum.cpp b/benchmark/syclblas/blas1/asum.cpp index 1d35de266..f42502c2e 100644 --- a/benchmark/syclblas/blas1/asum.cpp +++ b/benchmark/syclblas/blas1/asum.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Asum<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::asum; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -41,8 +36,8 @@ void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, state, sb_handle_ptr->get_queue()); // Google-benchmark counters are double. - blas_benchmark::utils::init_level_1_counters< - blas_benchmark::utils::Level1Op::asum, scalar_t>(state, size); + blas_benchmark::utils::init_level_1_counters(state, + size); blas::SB_Handle& sb_handle = *sb_handle_ptr; @@ -117,8 +112,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/axpy.cpp b/benchmark/syclblas/blas1/axpy.cpp index 213ab50ac..db29313d5 100644 --- a/benchmark/syclblas/blas1/axpy.cpp +++ b/benchmark/syclblas/blas1/axpy.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Axpy<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::axpy; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -41,8 +36,8 @@ void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, state, sb_handle_ptr->get_queue()); // Google-benchmark counters are double. - blas_benchmark::utils::init_level_1_counters< - blas_benchmark::utils::Level1Op::axpy, scalar_t>(state, size); + blas_benchmark::utils::init_level_1_counters(state, + size); blas::SB_Handle& sb_handle = *sb_handle_ptr; @@ -114,8 +109,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/copy.cpp b/benchmark/syclblas/blas1/copy.cpp index d620f505d..af5657066 100644 --- a/benchmark/syclblas/blas1/copy.cpp +++ b/benchmark/syclblas/blas1/copy.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size, int incx, int incy) { - std::ostringstream str{}; - str << "BM_Copy<" << blas_benchmark::utils::get_type_name() << ">/" - << size << "/" << incx << "/" << incy; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::copy; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -119,9 +114,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, sb_handle_ptr, size, incx, incy, success); }; - benchmark::RegisterBenchmark(get_name(size, incx, incy).c_str(), - BM_lambda, sb_handle_ptr, size, incx, incy, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, incx, incy, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, incx, incy, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/dot.cpp b/benchmark/syclblas/blas1/dot.cpp index 80db6ab64..b3d516454 100644 --- a/benchmark/syclblas/blas1/dot.cpp +++ b/benchmark/syclblas/blas1/dot.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Dot<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::dot; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -118,8 +113,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/iamax.cpp b/benchmark/syclblas/blas1/iamax.cpp index 769954391..35e920d9f 100644 --- a/benchmark/syclblas/blas1/iamax.cpp +++ b/benchmark/syclblas/blas1/iamax.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Iamax<" << blas_benchmark::utils::get_type_name(); - str << ">/" << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::iamax; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -122,8 +117,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/iamin.cpp b/benchmark/syclblas/blas1/iamin.cpp index 9f002fe71..14facae00 100644 --- a/benchmark/syclblas/blas1/iamin.cpp +++ b/benchmark/syclblas/blas1/iamin.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Iamin<" << blas_benchmark::utils::get_type_name(); - str << ">/" << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::iamin; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -121,8 +116,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/nrm2.cpp b/benchmark/syclblas/blas1/nrm2.cpp index d96a49a06..9f7d40243 100644 --- a/benchmark/syclblas/blas1/nrm2.cpp +++ b/benchmark/syclblas/blas1/nrm2.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Nrm2<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::nrm2; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -115,8 +110,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/rotg.cpp b/benchmark/syclblas/blas1/rotg.cpp index 104f3513b..33075ddb7 100644 --- a/benchmark/syclblas/blas1/rotg.cpp +++ b/benchmark/syclblas/blas1/rotg.cpp @@ -25,12 +25,8 @@ #include "../utils.hpp" -template -std::string get_name() { - std::ostringstream str{}; - str << "BM_Rotg<" << blas_benchmark::utils::get_type_name() << ">/"; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotg; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -139,8 +135,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, sb_handle_ptr, success); }; - benchmark::RegisterBenchmark(get_name().c_str(), BM_lambda, - sb_handle_ptr, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, success) ->UseRealTime(); } diff --git a/benchmark/syclblas/blas1/rotm.cpp b/benchmark/syclblas/blas1/rotm.cpp index 1a74b79de..414a2a31e 100644 --- a/benchmark/syclblas/blas1/rotm.cpp +++ b/benchmark/syclblas/blas1/rotm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Rotm<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotm; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -135,8 +130,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/rotmg.cpp b/benchmark/syclblas/blas1/rotmg.cpp index 8bafbec59..b89072afd 100644 --- a/benchmark/syclblas/blas1/rotmg.cpp +++ b/benchmark/syclblas/blas1/rotmg.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name() { - std::ostringstream str{}; - str << "BM_Rotmg<" << blas_benchmark::utils::get_type_name() - << ">/"; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::rotmg; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -146,8 +141,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, sb_handle_ptr, success); }; - benchmark::RegisterBenchmark(get_name().c_str(), BM_lambda, - sb_handle_ptr, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, success) ->UseRealTime(); } diff --git a/benchmark/syclblas/blas1/scal.cpp b/benchmark/syclblas/blas1/scal.cpp index 1a75e8eaa..3fcf6dbf9 100644 --- a/benchmark/syclblas/blas1/scal.cpp +++ b/benchmark/syclblas/blas1/scal.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Scal<" << blas_benchmark::utils::get_type_name() << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::scal; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -111,8 +106,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas1/sdsdot.cpp b/benchmark/syclblas/blas1/sdsdot.cpp index 96b28d33b..649f422ca 100644 --- a/benchmark/syclblas/blas1/sdsdot.cpp +++ b/benchmark/syclblas/blas1/sdsdot.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int size) { - std::ostringstream str{}; - str << "BM_Sdsdot<" << blas_benchmark::utils::get_type_name() - << ">/"; - str << size; - return str.str(); -} +constexpr blas_benchmark::utils::Level1Op benchmark_op = + blas_benchmark::utils::Level1Op::sdsdot; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t size, @@ -119,8 +113,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p index_t size, bool* success) { run(st, sb_handle_ptr, size, success); }; - benchmark::RegisterBenchmark(get_name(size).c_str(), BM_lambda, - sb_handle_ptr, size, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + size, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, size, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/gbmv.cpp b/benchmark/syclblas/blas2/gbmv.cpp index de02e72db..1c4fc0cc7 100644 --- a/benchmark/syclblas/blas2/gbmv.cpp +++ b/benchmark/syclblas/blas2/gbmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t, int m, int n, int kl, int ku) { - std::ostringstream str{}; - str << "BM_Gbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << t << "/" << m << "/" << n << "/" << kl << "/" << ku; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::gbmv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, int ti, @@ -140,9 +135,11 @@ void register_benchmark(blas_benchmark::Args& args, scalar_t alpha, scalar_t beta, bool* success) { run(st, sb_handle_ptr, t, m, n, kl, ku, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(ts, m, n, kl, ku).c_str(), - BM_lambda, sb_handle_ptr, t, m, n, kl, ku, - alpha, beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + ts, m, n, kl, ku, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, t, m, n, kl, ku, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/gemv.cpp b/benchmark/syclblas/blas2/gemv.cpp index 77cf1c53c..2d2f5e822 100644 --- a/benchmark/syclblas/blas2/gemv.cpp +++ b/benchmark/syclblas/blas2/gemv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t, int m, int n) { - std::ostringstream str{}; - str << "BM_Gemv<" << blas_benchmark::utils::get_type_name() << ">/" - << t << "/" << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::gemv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, int ti, @@ -139,9 +134,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p bool* success) { run(st, sb_handle_ptr, t, m, n, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(ts, m, n).c_str(), - BM_lambda, sb_handle_ptr, t, m, n, alpha, beta, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + ts, m, n, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, t, m, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/ger.cpp b/benchmark/syclblas/blas2/ger.cpp index dcb338b74..1968f1b55 100644 --- a/benchmark/syclblas/blas2/ger.cpp +++ b/benchmark/syclblas/blas2/ger.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(int m, int n) { - std::ostringstream str{}; - str << "BM_Ger<" << blas_benchmark::utils::get_type_name() << ">/" - << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::ger; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t m, @@ -134,8 +129,11 @@ void register_benchmark(blas_benchmark::Args& args, index_t m, index_t n, scalar_t alpha, bool* success) { run(st, sb_handle_ptr, m, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(m, n).c_str(), BM_lambda, - sb_handle_ptr, m, n, alpha, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + m, n, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, m, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/sbmv.cpp b/benchmark/syclblas/blas2/sbmv.cpp index 0554e8028..7ae2ff4e5 100644 --- a/benchmark/syclblas/blas2/sbmv.cpp +++ b/benchmark/syclblas/blas2/sbmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, int k) { - std::ostringstream str{}; - str << "BM_Sbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::sbmv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -137,9 +132,11 @@ void register_benchmark(blas_benchmark::Args& args, scalar_t alpha, scalar_t beta, bool* success) { run(st, sb_handle_ptr, uplos, n, k, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(uplos, n, k).c_str(), - BM_lambda, sb_handle_ptr, uplos, n, k, alpha, - beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplos, n, k, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, n, k, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/spmv.cpp b/benchmark/syclblas/blas2/spmv.cpp index 0254ccd7e..b003acce7 100644 --- a/benchmark/syclblas/blas2/spmv.cpp +++ b/benchmark/syclblas/blas2/spmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, scalar_t alpha, scalar_t beta) { - std::ostringstream str{}; - str << "BM_Spmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha << "/" << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spmv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -136,8 +131,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplos, n, alpha, beta, success); }; benchmark::RegisterBenchmark( - get_name(uplos, n, alpha, beta).c_str(), BM_lambda, - sb_handle_ptr, uplos, n, alpha, beta, success) + blas_benchmark::utils::get_name( + uplos, n, alpha, beta, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/spr.cpp b/benchmark/syclblas/blas2/spr.cpp index f4134a26e..ee7f2ebd0 100644 --- a/benchmark/syclblas/blas2/spr.cpp +++ b/benchmark/syclblas/blas2/spr.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, int size, scalar_t alpha, int incX) { - std::ostringstream str{}; - str << "BM_Spr<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << size << "/" << alpha << "/" << incX; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spr; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, char uplo, @@ -120,7 +115,7 @@ void register_benchmark(blas_benchmark::Args& args, auto spr_params = blas_benchmark::utils::get_spr_params(args); for (auto p : spr_params) { - int n, incX; + index_t n, incX; std::string uplo; scalar_t alpha; std::tie(uplo, n, alpha, incX) = p; @@ -133,8 +128,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplo, size, alpha, incX, success); }; benchmark::RegisterBenchmark( - get_name(uplo_c, n, alpha, incX).c_str(), BM_lambda_col, - sb_handle_ptr, uplo_c, n, alpha, incX, success) + blas_benchmark::utils::get_name( + uplo, n, alpha, incX, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda_col, sb_handle_ptr, uplo_c, n, alpha, incX, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/spr2.cpp b/benchmark/syclblas/blas2/spr2.cpp index 01677ffe2..8a1b3f324 100644 --- a/benchmark/syclblas/blas2/spr2.cpp +++ b/benchmark/syclblas/blas2/spr2.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char uplo, int size, scalar_t alpha, int incX, int incY) { - std::ostringstream str{}; - str << "BM_Spr2<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << size << "/" << alpha << "/" << incX << "/" << incY; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::spr2; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, char uplo, @@ -123,7 +118,7 @@ void register_benchmark(blas_benchmark::Args& args, auto spr2_params = blas_benchmark::utils::get_spr2_params(args); for (auto p : spr2_params) { - int n, incX, incY; + index_t n, incX, incY; std::string uplo; scalar_t alpha; std::tie(uplo, n, alpha, incX, incY) = p; @@ -136,8 +131,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplo, n, alpha, incX, incY, success); }; benchmark::RegisterBenchmark( - get_name(uplo_c, n, alpha, incX, incY).c_str(), BM_lambda_col, - sb_handle_ptr, uplo_c, n, alpha, incX, incY, success) + blas_benchmark::utils::get_name( + uplo, n, alpha, incX, incY, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda_col, sb_handle_ptr, uplo_c, n, alpha, incX, incY, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/symv.cpp b/benchmark/syclblas/blas2/symv.cpp index d6a2cf564..fc4eedfb3 100644 --- a/benchmark/syclblas/blas2/symv.cpp +++ b/benchmark/syclblas/blas2/symv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, scalar_t alpha, scalar_t beta) { - std::ostringstream str{}; - str << "BM_Symv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha << "/" << beta; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::symv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -137,8 +132,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplos, n, alpha, beta, success); }; benchmark::RegisterBenchmark( - get_name(uplos, n, alpha, beta).c_str(), BM_lambda, - sb_handle_ptr, uplos, n, alpha, beta, success) + blas_benchmark::utils::get_name( + uplos, n, alpha, beta, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/syr.cpp b/benchmark/syclblas/blas2/syr.cpp index ffdec5462..d7d3ec30a 100644 --- a/benchmark/syclblas/blas2/syr.cpp +++ b/benchmark/syclblas/blas2/syr.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, scalar_t alpha) { - std::ostringstream str{}; - str << "BM_Syr<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::syr; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -129,9 +124,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, sb_handle_ptr, uplo, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(uplo, n, alpha).c_str(), - BM_lambda, sb_handle_ptr, uplo, n, alpha, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, n, alpha, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplo, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/syr2.cpp b/benchmark/syclblas/blas2/syr2.cpp index 73bd18e0f..cad0f537b 100644 --- a/benchmark/syclblas/blas2/syr2.cpp +++ b/benchmark/syclblas/blas2/syr2.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, int n, scalar_t alpha) { - std::ostringstream str{}; - str << "BM_Syr2<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << n << "/" << alpha; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::syr2; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -138,9 +133,11 @@ void register_benchmark(blas_benchmark::Args& args, bool* success) { run(st, sb_handle_ptr, uplo, n, alpha, success); }; - benchmark::RegisterBenchmark(get_name(uplo, n, alpha).c_str(), - BM_lambda, sb_handle_ptr, uplo, n, alpha, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + uplo, n, alpha, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplo, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/tbmv.cpp b/benchmark/syclblas/blas2/tbmv.cpp index af3859674..bf4880414 100644 --- a/benchmark/syclblas/blas2/tbmv.cpp +++ b/benchmark/syclblas/blas2/tbmv.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n, - int k) { - std::ostringstream str{}; - str << "BM_Tbmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tbmv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -136,8 +130,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplos, ts, diags, n, k, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n, k).c_str(), BM_lambda, - sb_handle_ptr, uplos, ts, diags, n, k, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, k, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, ts, diags, n, k, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/tbsv.cpp b/benchmark/syclblas/blas2/tbsv.cpp index 1221d5d1c..7b8cdeffc 100644 --- a/benchmark/syclblas/blas2/tbsv.cpp +++ b/benchmark/syclblas/blas2/tbsv.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, - const int n, const int k) { - std::ostringstream str{}; - str << "BM_Tbsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n << "/" << k; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tbsv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -146,8 +140,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplos, ts, diags, n, k, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n, k).c_str(), BM_lambda, - sb_handle_ptr, uplos, ts, diags, n, k, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, k, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, ts, diags, n, k, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/tpmv.cpp b/benchmark/syclblas/blas2/tpmv.cpp index e3d8fc8a1..fab71fac4 100644 --- a/benchmark/syclblas/blas2/tpmv.cpp +++ b/benchmark/syclblas/blas2/tpmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Tpmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tpmv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -130,8 +125,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, - sb_handle_ptr, uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/tpsv.cpp b/benchmark/syclblas/blas2/tpsv.cpp index 251610410..c9039a4b3 100644 --- a/benchmark/syclblas/blas2/tpsv.cpp +++ b/benchmark/syclblas/blas2/tpsv.cpp @@ -25,14 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, - const int n) { - std::ostringstream str{}; - str << "BM_Tpsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::tpsv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -50,8 +44,8 @@ void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t incX = 1; index_t xlen = 1 + (n - 1) * incX; - blas_benchmark::utils::init_level_2_counters< - blas_benchmark::utils::Level2Op::tpsv, scalar_t>(state, "n", 0, 0, n); + blas_benchmark::utils::init_level_2_counters( + state, "n", 0, 0, n); blas::SB_Handle& sb_handle = *sb_handle_ptr; @@ -146,8 +140,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, - sb_handle_ptr, uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/trmv.cpp b/benchmark/syclblas/blas2/trmv.cpp index 86701aa47..c4a95d975 100644 --- a/benchmark/syclblas/blas2/trmv.cpp +++ b/benchmark/syclblas/blas2/trmv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Trmv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::trmv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -135,8 +130,10 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, - sb_handle_ptr, uplos, ts, diags, n, success) + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, ts, diags, n, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas2/trsv.cpp b/benchmark/syclblas/blas2/trsv.cpp index c648b619e..a5e9f143b 100644 --- a/benchmark/syclblas/blas2/trsv.cpp +++ b/benchmark/syclblas/blas2/trsv.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string uplo, std::string t, std::string diag, int n) { - std::ostringstream str{}; - str << "BM_Trsv<" << blas_benchmark::utils::get_type_name() << ">/" - << uplo << "/" << t << "/" << diag << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level2Op benchmark_op = + blas_benchmark::utils::Level2Op::trsv; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, @@ -142,8 +137,11 @@ void register_benchmark(blas_benchmark::Args& args, run(st, sb_handle_ptr, uplos, ts, diags, n, success); }; benchmark::RegisterBenchmark( - get_name(uplos, ts, diags, n).c_str(), BM_lambda, - sb_handle_ptr, uplos, ts, diags, n, success)->UseRealTime(); + blas_benchmark::utils::get_name( + uplos, ts, diags, n, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, uplos, ts, diags, n, success) + ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas3/gemm.cpp b/benchmark/syclblas/blas3/gemm.cpp index 26fe3aa06..a87c10559 100644 --- a/benchmark/syclblas/blas3/gemm.cpp +++ b/benchmark/syclblas/blas3/gemm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t1, std::string t2, int m, int k, int n) { - std::ostringstream str{}; - str << "BM_Gemm<" << blas_benchmark::utils::get_type_name() << ">/" - << t1 << "/" << t2 << "/" << m << "/" << k << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, int t1, int t2, @@ -137,9 +132,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p scalar_t alpha, scalar_t beta, bool* success) { run(st, sb_handle_ptr, t1, t2, m, k, n, alpha, beta, success); }; - benchmark::RegisterBenchmark(get_name(t1s, t2s, m, k, n).c_str(), - BM_lambda, sb_handle_ptr, t1, t2, m, k, n, alpha, beta, - success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + t1s, t2s, m, k, n, blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, t1, t2, m, k, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas3/gemm_batched.cpp b/benchmark/syclblas/blas3/gemm_batched.cpp index 8ad3e25a0..64c928d3b 100644 --- a/benchmark/syclblas/blas3/gemm_batched.cpp +++ b/benchmark/syclblas/blas3/gemm_batched.cpp @@ -25,6 +25,9 @@ #include "../utils.hpp" +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm_batched; + // Convert batch_type=strided to interleaved on the host template std::vector strided_to_interleaved(const std::vector& input, @@ -59,17 +62,6 @@ std::vector interleaved_to_strided(const std::vector& input, return output; } -template -std::string get_name(std::string t1, std::string t2, int m, int k, int n, - int batch_size, int batch_type) { - std::ostringstream str{}; - str << "BM_GemmBatched<" << blas_benchmark::utils::get_type_name() - << ">/" << t1 << "/" << t2 << "/" << m << "/" << k << "/" << n << "/" - << batch_size << "/" - << blas_benchmark::utils::batch_type_to_str(batch_type); - return str.str(); -} - template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, int t1, int t2, index_t m, index_t k, index_t n, scalar_t alpha, scalar_t beta, @@ -209,7 +201,10 @@ void register_benchmark(blas_benchmark::Args& args, batch_type, success); }; benchmark::RegisterBenchmark( - get_name(t1s, t2s, m, k, n, batch_size, batch_type).c_str(), + blas_benchmark::utils::get_name( + t1s, t2s, m, k, n, batch_size, batch_type, + blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), BM_lambda, sb_handle_ptr, t1, t2, m, k, n, alpha, beta, batch_size, batch_type, success) ->UseRealTime(); diff --git a/benchmark/syclblas/blas3/gemm_batched_strided.cpp b/benchmark/syclblas/blas3/gemm_batched_strided.cpp index 212a6e37f..c47ab55ad 100644 --- a/benchmark/syclblas/blas3/gemm_batched_strided.cpp +++ b/benchmark/syclblas/blas3/gemm_batched_strided.cpp @@ -25,17 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(std::string t1, std::string t2, int m, int k, int n, - int batch_size, int stride_a_mul, int stride_b_mul, - int stride_c_mul) { - std::ostringstream str{}; - str << "BM_GemmBatchedStrided<" - << blas_benchmark::utils::get_type_name() << ">/" << t1 << "/" - << t2 << "/" << m << "/" << k << "/" << n << "/" << batch_size << "/" - << stride_a_mul << "/" << stride_b_mul << "/" << stride_c_mul; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::gemm_batched_strided; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, int t1, @@ -182,8 +173,9 @@ void register_benchmark(blas_benchmark::Args& args, strd_a_mul, strd_b_mul, strd_c_mul, success); }; benchmark::RegisterBenchmark( - get_name(t1s, t2s, m, k, n, batch_size, stride_a_mul, - stride_b_mul, stride_c_mul) + blas_benchmark::utils::get_name( + t1s, t2s, m, k, n, batch_size, stride_a_mul, stride_b_mul, + stride_c_mul, blas_benchmark::utils::MEM_TYPE_BUFFER) .c_str(), BM_lambda, sb_handle_ptr, t1, t2, m, k, n, alpha, beta, batch_size, stride_a_mul, stride_b_mul, stride_c_mul, success) diff --git a/benchmark/syclblas/blas3/symm.cpp b/benchmark/syclblas/blas3/symm.cpp index 7b82da743..1448ab7d4 100644 --- a/benchmark/syclblas/blas3/symm.cpp +++ b/benchmark/syclblas/blas3/symm.cpp @@ -25,13 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char side, char uplo, int m, int n) { - std::ostringstream str{}; - str << "BM_Symm<" << blas_benchmark::utils::get_type_name() << ">/" - << side << "/" << uplo << "/" << m << "/" << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::symm; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, char side, @@ -122,19 +117,26 @@ void register_benchmark(blas_benchmark::Args& args, auto symm_params = blas_benchmark::utils::get_symm_params(args); for (auto p : symm_params) { - char side, uplo; + std::string side, uplo; index_t m, n; scalar_t alpha, beta; std::tie(side, uplo, m, n, alpha, beta) = p; + char side_c = side[0]; + char uplo_c = uplo[0]; + auto BM_lambda = [&](benchmark::State& st, blas::SB_Handle* sb_handle_ptr, char side, char uplo, index_t m, index_t n, scalar_t alpha, scalar_t beta, bool* success) { - run(st, sb_handle_ptr, side, uplo, m, n, alpha, beta, success); + run(st, sb_handle_ptr, side_c, uplo_c, m, n, alpha, beta, + success); }; - benchmark::RegisterBenchmark(get_name(side, uplo, m, n).c_str(), - BM_lambda, sb_handle_ptr, side, uplo, m, n, - alpha, beta, success) + benchmark::RegisterBenchmark( + blas_benchmark::utils::get_name( + side, uplo, m, n, alpha, beta, + blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, side_c, uplo_c, m, n, alpha, beta, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/blas3/trsm.cpp b/benchmark/syclblas/blas3/trsm.cpp index 844d6da67..bdafd4558 100644 --- a/benchmark/syclblas/blas3/trsm.cpp +++ b/benchmark/syclblas/blas3/trsm.cpp @@ -25,15 +25,8 @@ #include "../utils.hpp" -template -std::string get_name(char side, char uplo, char trans, char diag, index_t m, - index_t n) { - std::ostringstream str{}; - str << "BM_Trsm<" << blas_benchmark::utils::get_type_name() << ">/" - << side << "/" << uplo << "/" << trans << "/" << diag << "/" << m << "/" - << n; - return str.str(); -} +constexpr blas_benchmark::utils::Level3Op benchmark_op = + blas_benchmark::utils::Level3Op::trsm; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, char side, @@ -174,8 +167,11 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p run(st, sb_handle_ptr, side, uplo, trans, diag, m, n, alpha, success); }; benchmark::RegisterBenchmark( - get_name(side, uplo, trans, diag, m, n).c_str(), BM_lambda, - sb_handle_ptr, side, uplo, trans, diag, m, n, alpha, success) + blas_benchmark::utils::get_name( + side, uplo, trans, diag, m, n, + blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), + BM_lambda, sb_handle_ptr, side, uplo, trans, diag, m, n, alpha, success) ->UseRealTime(); } } diff --git a/benchmark/syclblas/extension/reduction.cpp b/benchmark/syclblas/extension/reduction.cpp index 2fbbec2a9..78bba15b1 100644 --- a/benchmark/syclblas/extension/reduction.cpp +++ b/benchmark/syclblas/extension/reduction.cpp @@ -27,14 +27,8 @@ using namespace blas; -template -std::string get_name(int rows, int cols, reduction_dim_t reduction_dim) { - std::ostringstream str{}; - str << "BM_Reduction<" << blas_benchmark::utils::get_type_name() - << ">/" << rows << "/" << cols << "/" - << (reduction_dim == reduction_dim_t::inner ? "inner" : "outer"); - return str.str(); -} +constexpr blas_benchmark::utils::ExtensionOp benchmark_op = + blas_benchmark::utils::ExtensionOp::reduction; template void run(benchmark::State& state, blas::SB_Handle* sb_handle_ptr, index_t rows, @@ -147,10 +141,14 @@ void register_benchmark(blas_benchmark::Args& args, blas::SB_Handle* sb_handle_p run(st, sb_handle_ptr, rows, cols, dim, success); }; benchmark::RegisterBenchmark( - get_name(rows, cols, reduction_dim_t::inner).c_str(), + blas_benchmark::utils::get_name( + rows, cols, "inner", blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), BM_lambda, sb_handle_ptr, rows, cols, reduction_dim_t::inner, success); benchmark::RegisterBenchmark( - get_name(rows, cols, reduction_dim_t::outer).c_str(), + blas_benchmark::utils::get_name( + rows, cols, "outer", blas_benchmark::utils::MEM_TYPE_BUFFER) + .c_str(), BM_lambda, sb_handle_ptr, rows, cols, reduction_dim_t::outer, success); } } diff --git a/common/include/common/benchmark_identifier.hpp b/common/include/common/benchmark_identifier.hpp new file mode 100644 index 000000000..4f111adf6 --- /dev/null +++ b/common/include/common/benchmark_identifier.hpp @@ -0,0 +1,182 @@ +/* + * @license + * Copyright (C) Codeplay Software Limited + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * For your convenience, a copy of the License has been included in this + * repository. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SYCL-BLAS: BLAS implementation using SYCL + * + * @filename benchmark_identifier.hpp + * + */ + +#ifndef SYCL_BLAS_BENCHMARK_IDENTIFIER_HPP +#define SYCL_BLAS_BENCHMARK_IDENTIFIER_HPP + +namespace blas_benchmark { +namespace utils { + +enum class Level1Op : int { + asum = 0, + axpy = 1, + dot = 2, + iamax = 3, + iamin = 4, + nrm2 = 5, + rotm = 6, + rotmg = 7, + scal = 8, + sdsdot = 9, + copy = 10, + rotg = 11 +}; + +enum class Level2Op : int { + gbmv = 0, + gemv = 1, + ger = 2, + sbmv = 3, + spmv = 4, + spr = 5, + spr2 = 6, + symv = 7, + syr = 8, + syr2 = 9, + tbmv = 10, + tbsv = 11, + tpmv = 12, + tpsv = 13, + trmv = 14, + trsv = 15 +}; + +enum class Level3Op : int { + gemm_batched_strided = 0, + gemm_batched = 1, + gemm = 2, + symm = 3, + syr2k = 4, + syrk = 5, + trmm = 6, + trsm_batched = 7, + trsm = 8 +}; + +enum class ExtensionOp : int { reduction = 0 }; + +template +std::string get_operator_name() { + if constexpr (op == Level1Op::asum) + return "Asum"; + else if constexpr (op == Level1Op::axpy) + return "Axpy"; + else if constexpr (op == Level1Op::dot) + return "Dot"; + else if constexpr (op == Level1Op::iamax) + return "Iamax"; + else if constexpr (op == Level1Op::iamin) + return "Iamin"; + else if constexpr (op == Level1Op::nrm2) + return "Nrm2"; + else if constexpr (op == Level1Op::rotm) + return "Rotm"; + else if constexpr (op == Level1Op::rotmg) + return "Rotmg"; + else if constexpr (op == Level1Op::scal) + return "Scal"; + else if constexpr (op == Level1Op::sdsdot) + return "Sdsdot"; + else if constexpr (op == Level1Op::copy) + return "Copy"; + else if constexpr (op == Level1Op::rotg) + return "Rotg"; + else + throw std::runtime_error("Unknown BLAS 1 operator"); +} + +template +std::string get_operator_name() { + if constexpr (op == Level2Op::gbmv) + return "Gbmv"; + else if constexpr (op == Level2Op::gemv) + return "Gemv"; + else if constexpr (op == Level2Op::ger) + return "Ger"; + else if constexpr (op == Level2Op::sbmv) + return "Sbmv"; + else if constexpr (op == Level2Op::spmv) + return "Spmv"; + else if constexpr (op == Level2Op::spr) + return "Spr"; + else if constexpr (op == Level2Op::spr2) + return "Spr2"; + else if constexpr (op == Level2Op::symv) + return "Symv"; + else if constexpr (op == Level2Op::syr) + return "Syr"; + else if constexpr (op == Level2Op::syr2) + return "Syr2"; + else if constexpr (op == Level2Op::tbmv) + return "Tbmv"; + else if constexpr (op == Level2Op::tbsv) + return "Tbsv"; + else if constexpr (op == Level2Op::tpmv) + return "Tpmv"; + else if constexpr (op == Level2Op::tpsv) + return "Tpsv"; + else if constexpr (op == Level2Op::trmv) + return "Trmv"; + else if constexpr (op == Level2Op::trsv) + return "Trsv"; + else + throw std::runtime_error("Unknown BLAS 2 operator"); +} + +template +std::string get_operator_name() { + if constexpr (op == Level3Op::gemm_batched_strided) + return "Gemm_batched_strided"; + else if constexpr (op == Level3Op::gemm_batched) + return "Gemm_batched"; + else if constexpr (op == Level3Op::gemm) + return "Gemm"; + else if constexpr (op == Level3Op::symm) + return "Symm"; + else if constexpr (op == Level3Op::syr2k) + return "Syr2k"; + else if constexpr (op == Level3Op::syrk) + return "Syrk"; + else if constexpr (op == Level3Op::trmm) + return "Trmm"; + else if constexpr (op == Level3Op::trsm_batched) + return "Trsm_batched"; + else if constexpr (op == Level3Op::trsm) + return "Trsm"; + else + throw std::runtime_error("Unknown BLAS 3 operator"); +} + +template +std::string get_operator_name() { + if constexpr (op == ExtensionOp::reduction) + return "Reduction"; + else + throw std::runtime_error("Unknown BLAS extension operator"); +} + +} // namespace utils +} // namespace blas_benchmark + +#endif // SYCL_BLAS_BENCHMARK_IDENTIFIER_HPP diff --git a/common/include/common/benchmark_names.hpp b/common/include/common/benchmark_names.hpp new file mode 100644 index 000000000..260f84642 --- /dev/null +++ b/common/include/common/benchmark_names.hpp @@ -0,0 +1,254 @@ +/* + * @license + * Copyright (C) Codeplay Software Limited + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * For your convenience, a copy of the License has been included in this + * repository. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SYCL-BLAS: BLAS implementation using SYCL + * + * @filename benchmark_names.hpp + * + */ + +#ifndef SYCL_BLAS_BENCHMARK_NAMES_HPP +#define SYCL_BLAS_BENCHMARK_NAMES_HPP + +#include + +namespace blas_benchmark { +namespace utils { + +template +static inline std::string get_type_name(); +inline std::string batch_type_to_str(int batch_type); + +namespace internal { + +template +std::string get_parameters_as_string(T arg) { + std::ostringstream str{}; + str << arg; + return str.str(); +} + +template +std::string get_parameters_as_string(T arg, Args... args) { + std::ostringstream str{}; + str << arg << "/" << get_parameters_as_string(args...); + return str.str(); +} + +template +inline std::string get_benchmark_name(const std::string &operator_name) { + std::ostringstream str{}; + str << "BM_" << operator_name << "<" << get_type_name() << ">"; + return str.str(); +} + +template +inline std::string get_name() { + return get_benchmark_name(get_operator_name()); +} + +template +inline std::string get_name(Args... args) { + std::ostringstream str{}; + str << get_name() << "/"; + str << get_parameters_as_string(args...); + return str.str(); +} + +template +inline std::string get_name(Args... args) { + std::ostringstream str{}; + str << get_benchmark_name(get_operator_name()) << "/"; + str << get_parameters_as_string(args...); + return str.str(); +} + +template +inline std::string get_name(Args... args) { + std::ostringstream str{}; + str << get_benchmark_name(get_operator_name()) << "/"; + str << get_parameters_as_string(args...); + return str.str(); +} + +template +inline std::string get_name(Args... args) { + std::ostringstream str{}; + str << get_benchmark_name(get_operator_name()) << "/"; + str << get_parameters_as_string(args...); + return str.str(); +} + +} // namespace internal + +template +inline typename std::enable_if::type +get_name(std::string mem_type) { + return internal::get_name(mem_type); +} + +template +inline + typename std::enable_if::type + get_name(index_t size, std::string mem_type) { + return internal::get_name(size, mem_type); +} + +template +inline typename std::enable_if::type +get_name(index_t size, index_t incx, index_t incy, std::string mem_type) { + return internal::get_name(size, incx, incy, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string t, index_t m, index_t n, index_t kl, index_t ku, + std::string mem_type) { + return internal::get_name(t, m, n, kl, ku, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string t, index_t m, index_t n, std::string mem_type) { + return internal::get_name(t, m, n, mem_type); +} + +template +inline typename std::enable_if::type get_name( + index_t m, index_t n, std::string mem_type) { + return internal::get_name(m, n, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string uplo, index_t n, scalar_t alpha, std::string mem_type) { + return internal::get_name(uplo, n, alpha, mem_type); +} + +template +inline typename std::enable_if::type get_name( + std::string uplo, index_t n, scalar_t alpha, index_t incx, + std::string mem_type) { + return internal::get_name(uplo, n, alpha, incx, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string uplo, index_t n, scalar_t alpha, scalar_t beta, + std::string mem_type) { + return internal::get_name(uplo, n, alpha, beta, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string uplo, index_t n, scalar_t alpha, index_t incx, + index_t incy, std::string mem_type) { + return internal::get_name(uplo, n, alpha, incx, incy, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string uplo, std::string t, std::string diag, index_t n, + index_t k, std::string mem_type) { + return internal::get_name(uplo, t, diag, n, k, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string uplo, std::string t, std::string diag, index_t n, + std::string mem_type) { + return internal::get_name(uplo, t, diag, n, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string t1, std::string t2, index_t m, index_t k, index_t n, + std::string mem_type) { + return internal::get_name(t1, t2, m, k, n, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string t1, std::string t2, index_t m, index_t k, index_t n, + index_t batch_size, int batch_type, std::string mem_type) { + return internal::get_name( + t1, t2, m, k, n, batch_size, batch_type_to_str(batch_type), mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string t1, std::string t2, index_t m, index_t k, index_t n, + index_t batch_size, index_t stride_a_mul, index_t stride_b_mul, + index_t stride_c_mul, std::string mem_type) { + return internal::get_name(t1, t2, m, k, n, batch_size, + stride_a_mul, stride_b_mul, + stride_c_mul, mem_type); +} + +template +inline typename std::enable_if::type +get_name(std::string s1, std::string s2, index_t m, index_t n, scalar_t alpha, + scalar_t beta, std::string mem_type) { + return internal::get_name(s1, s2, m, n, alpha, beta, mem_type); +} + +template +inline typename std::enable_if::type +get_name(char side, char uplo, char trans, char diag, index_t m, index_t n, + std::string mem_type) { + return internal::get_name(side, uplo, trans, diag, m, n, + mem_type); +} + +template +inline typename std::enable_if::type +get_name(char side, char uplo, char trans, char diag, index_t m, index_t n, + index_t batch_size, index_t stride_a_mul, index_t stride_b_mul, + std::string mem_type) { + return internal::get_name(side, uplo, trans, diag, m, n, + batch_size, stride_a_mul, + stride_b_mul, mem_type); +} + +template +inline typename std::enable_if::type +get_name(index_t rows, index_t cols, std::string reduction_dim, + std::string mem_type) { + return internal::get_name(rows, cols, reduction_dim, mem_type); +} + +} // namespace utils +} // namespace blas_benchmark + +#endif // SYCL_BLAS_BENCHMARK_NAMES_HPP diff --git a/common/include/common/blas1_state_counters.hpp b/common/include/common/blas1_state_counters.hpp index 497065e9c..57e4d593f 100644 --- a/common/include/common/blas1_state_counters.hpp +++ b/common/include/common/blas1_state_counters.hpp @@ -26,23 +26,11 @@ #ifndef COMMON_BLAS1_STATE_COUNTERS #define COMMON_BLAS1_STATE_COUNTERS +#include "benchmark_identifier.hpp" + namespace blas_benchmark { namespace utils { -enum class Level1Op : int { - asum = 0, - axpy = 1, - dot = 2, - iamax = 3, - iamin = 4, - nrm2 = 5, - rotm = 6, - rotmg = 7, - scal = 8, - sdsdot = 9, - copy = 10 -}; - template inline typename std::enable_if::type diff --git a/common/include/common/blas2_state_counters.hpp b/common/include/common/blas2_state_counters.hpp index 038b4e463..2dc191010 100644 --- a/common/include/common/blas2_state_counters.hpp +++ b/common/include/common/blas2_state_counters.hpp @@ -26,28 +26,11 @@ #ifndef COMMON_BLAS2_STATE_COUNTERS #define COMMON_BLAS2_STATE_COUNTERS +#include "benchmark_identifier.hpp" + namespace blas_benchmark { namespace utils { -enum class Level2Op : int { - gbmv = 0, - gemv = 1, - ger = 2, - sbmv = 3, - spmv = 4, - spr = 5, - spr2 = 6, - symv = 7, - syr = 8, - syr2 = 9, - tbmv = 10, - tbsv = 11, - tpmv = 12, - tpsv = 13, - trmv = 14, - trsv = 15 -}; - template inline typename std::enable_if::type init_level_2_counters(benchmark::State& state, const char* t_str, diff --git a/common/include/common/blas3_state_counters.hpp b/common/include/common/blas3_state_counters.hpp index eb00d289e..5840553cf 100644 --- a/common/include/common/blas3_state_counters.hpp +++ b/common/include/common/blas3_state_counters.hpp @@ -26,21 +26,11 @@ #ifndef COMMON_BLAS3_STATE_COUNTERS #define COMMON_BLAS3_STATE_COUNTERS +#include "benchmark_identifier.hpp" + namespace blas_benchmark { namespace utils { -enum class Level3Op : int { - gemm_batched_strided = 0, - gemm_batched = 1, - gemm = 2, - symm = 3, - syr2k = 4, - syrk = 5, - trmm = 6, - trsm_batched = 7, - trsm = 8 -}; - template inline typename std::enable_if +#include #include #include #include @@ -102,6 +104,9 @@ namespace blas_benchmark { namespace utils { +inline constexpr char MEM_TYPE_BUFFER[] = "buffer"; +inline constexpr char MEM_TYPE_USM[] = "usm"; + /** * @brief Print the explanatory string of an exception. * If the exception is nested, recurse to print the explanatory of the