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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions nvbench/detail/measure_cupti.cu
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ struct metric_traits<metric_id::dram_peak_sustained_throughput>

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();
};
};

Expand All @@ -82,9 +82,9 @@ struct metric_traits<metric_id::global_load_efficiency>

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();
};
};

Expand All @@ -103,9 +103,9 @@ struct metric_traits<metric_id::global_store_efficiency>

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();
};
};

Expand All @@ -118,7 +118,7 @@ struct metric_traits<metric_id::l1_hit_rate>
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 <>
Expand All @@ -130,13 +130,13 @@ struct metric_traits<metric_id::l2_hit_rate>
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 <metric_id id = metric_id::dram_peak_sustained_throughput>
void add_metrics_impl(nvbench::state &state, std::vector<std::string> &metrics)
{
if (metric_traits<id>::is_collected(state))
if (metric_traits<id>::get_collected(state))
{
metrics.emplace_back(metric_traits<id>::metric_name);
}
Expand Down Expand Up @@ -200,7 +200,7 @@ void gen_summary(std::size_t result_id, nvbench::state &m_state, const std::vect
{
using metric = metric_traits<id>;

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);
Expand Down
46 changes: 36 additions & 10 deletions nvbench/state.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down