diff --git a/nvbench/detail/measure_cupti.cu b/nvbench/detail/measure_cupti.cu index 24028f2..85b2755 100644 --- a/nvbench/detail/measure_cupti.cu +++ b/nvbench/detail/measure_cupti.cu @@ -61,9 +61,9 @@ struct metric_traits static constexpr double divider = 100.0; - static bool is_collected(nvbench::state &m_state) + static bool get_collected(nvbench::state &m_state) { - return m_state.is_dram_throughput_collected(); + return m_state.get_collect_dram_throughput(); }; }; @@ -82,9 +82,9 @@ struct metric_traits static constexpr double divider = 100.0; - static bool is_collected(nvbench::state &m_state) + static bool get_collected(nvbench::state &m_state) { - return m_state.is_loads_efficiency_collected(); + return m_state.get_collect_loads_efficiency(); }; }; @@ -103,9 +103,9 @@ struct metric_traits static constexpr double divider = 100.0; - static bool is_collected(nvbench::state &m_state) + static bool get_collected(nvbench::state &m_state) { - return m_state.is_stores_efficiency_collected(); + return m_state.get_collect_stores_efficiency(); }; }; @@ -118,7 +118,7 @@ struct metric_traits static constexpr const char *description = "Hit rate at L1 cache."; static constexpr double divider = 100.0; - static bool is_collected(nvbench::state &m_state) { return m_state.is_l1_hit_rate_collected(); }; + static bool get_collected(nvbench::state &m_state) { return m_state.get_collect_l1_hit_rates(); }; }; template <> @@ -130,13 +130,13 @@ struct metric_traits static constexpr const char *description = "Hit rate at L2 cache."; static constexpr double divider = 100.0; - static bool is_collected(nvbench::state &m_state) { return m_state.is_l2_hit_rate_collected(); }; + static bool get_collected(nvbench::state &m_state) { return m_state.get_collect_l2_hit_rates(); }; }; template void add_metrics_impl(nvbench::state &state, std::vector &metrics) { - if (metric_traits::is_collected(state)) + if (metric_traits::get_collected(state)) { metrics.emplace_back(metric_traits::metric_name); } @@ -200,7 +200,7 @@ void gen_summary(std::size_t result_id, nvbench::state &m_state, const std::vect { using metric = metric_traits; - if (metric::is_collected(m_state)) + if (metric::get_collected(m_state)) { auto &summ = m_state.add_summary(fmt::format("nv/cupti/{}", metric::metric_name)); summ.set_string("name", metric::name); diff --git a/nvbench/state.cuh b/nvbench/state.cuh index 61fd840..90878ab 100644 --- a/nvbench/state.cuh +++ b/nvbench/state.cuh @@ -245,20 +245,46 @@ struct state collect_dram_throughput(); } - [[nodiscard]] bool is_l1_hit_rate_collected() const { return m_collect_l1_hit_rates; } - [[nodiscard]] bool is_l2_hit_rate_collected() const { return m_collect_l2_hit_rates; } - [[nodiscard]] bool is_stores_efficiency_collected() const { return m_collect_stores_efficiency; } - [[nodiscard]] bool is_loads_efficiency_collected() const { return m_collect_loads_efficiency; } - [[nodiscard]] bool is_dram_throughput_collected() const { return m_collect_dram_throughput; } + [[deprecated("Use get_collect_l1_hit_rates()")]] [[nodiscard]] bool + is_l1_hit_rate_collected() const + { + return m_collect_l1_hit_rates; + } + [[deprecated("Use get_collect_l2_hit_rates()")]] [[nodiscard]] bool + is_l2_hit_rate_collected() const + { + return m_collect_l2_hit_rates; + } + [[deprecated("Use get_collect_stores_efficiency()")]] [[nodiscard]] bool + is_stores_efficiency_collected() const + { + return m_collect_stores_efficiency; + } + [[deprecated("Use get_collect_loads_efficiency()")]] [[nodiscard]] bool + is_loads_efficiency_collected() const + { + return m_collect_loads_efficiency; + } + [[deprecated("Use get_collect_dram_throughput()")]] [[nodiscard]] bool + is_dram_throughput_collected() const + { + return m_collect_dram_throughput; + } + + [[nodiscard]] bool get_collect_l1_hit_rates() const { return m_collect_l1_hit_rates; } + [[nodiscard]] bool get_collect_l2_hit_rates() const { return m_collect_l2_hit_rates; } + [[nodiscard]] bool get_collect_stores_efficiency() const { return m_collect_stores_efficiency; } + [[nodiscard]] bool get_collect_loads_efficiency() const { return m_collect_loads_efficiency; } + [[nodiscard]] bool get_collect_dram_throughput() const { return m_collect_dram_throughput; } [[nodiscard]] bool is_cupti_required() const { // clang-format off - return is_l2_hit_rate_collected() || - is_l1_hit_rate_collected() || - is_stores_efficiency_collected() || - is_loads_efficiency_collected() || - is_dram_throughput_collected(); + return get_collect_l1_hit_rates() || + get_collect_l2_hit_rates() || + get_collect_stores_efficiency() || + get_collect_loads_efficiency() || + get_collect_dram_throughput(); // clang-format on }