From d394d2b865e4f6f9b488c329e143ff2cbc8f9bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Eyraud?= Date: Wed, 22 Oct 2025 13:54:41 -0400 Subject: [PATCH 1/2] Renaming Cupti methods for consistency --- nvbench/detail/measure_cupti.cu | 20 ++++++++++---------- nvbench/state.cuh | 26 ++++++++++++++++---------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/nvbench/detail/measure_cupti.cu b/nvbench/detail/measure_cupti.cu index 24028f2c..85b2755b 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 61fd8406..3bee369f 100644 --- a/nvbench/state.cuh +++ b/nvbench/state.cuh @@ -245,20 +245,26 @@ 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 } From 3494502f2e48ce3044081335928ea8078ad75e71 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 18:17:31 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto code formatting --- nvbench/state.cuh | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/nvbench/state.cuh b/nvbench/state.cuh index 3bee369f..90878ab5 100644 --- a/nvbench/state.cuh +++ b/nvbench/state.cuh @@ -245,11 +245,31 @@ struct state 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; } + [[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; }