From 998ab125ce8dcc6333eebe30d1c812ebdc6b9507 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Fri, 20 Feb 2026 16:34:53 -0600 Subject: [PATCH] Don't override m_check_throttling if throttling threshold is non-positive measure_cold class now directly inherits m_check_throttling from state. This ensures that when `--jsonbin` is specified frequency data corresponding to timing data are available to write out. --- nvbench/detail/measure_cold.cu | 2 +- nvbench/detail/measure_cold.cuh | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/nvbench/detail/measure_cold.cu b/nvbench/detail/measure_cold.cu index e820110..fecff8b 100644 --- a/nvbench/detail/measure_cold.cu +++ b/nvbench/detail/measure_cold.cu @@ -44,7 +44,7 @@ measure_cold_base::measure_cold_base(state &exec_state) exec_state.get_stopping_criterion())} , m_disable_blocking_kernel{exec_state.get_disable_blocking_kernel()} , m_run_once{exec_state.get_run_once()} - , m_check_throttling(!exec_state.get_run_once() && exec_state.get_throttle_threshold() > 0.f) + , m_check_throttling(!exec_state.get_run_once()) , m_min_samples{exec_state.get_min_samples()} , m_skip_time{exec_state.get_skip_time()} , m_timeout{exec_state.get_timeout()} diff --git a/nvbench/detail/measure_cold.cuh b/nvbench/detail/measure_cold.cuh index 3a372d1..edd24fe 100644 --- a/nvbench/detail/measure_cold.cuh +++ b/nvbench/detail/measure_cold.cuh @@ -140,6 +140,13 @@ struct measure_cold_base::kernel_launch_timer , m_check_throttling{measure.m_check_throttling} {} + explicit kernel_launch_timer(measure_cold_base &measure, bool disable_blocking_kernel) + : m_measure{measure} + , m_disable_blocking_kernel{disable_blocking_kernel} + , m_run_once{measure.m_run_once} + , m_check_throttling{measure.m_check_throttling} + {} + explicit kernel_launch_timer(measure_cold_base &measure, bool disable_blocking_kernel, bool run_once, @@ -234,7 +241,7 @@ private: // disable use of blocking kernel for warm-up run // see https://github.com/NVIDIA/nvbench/issues/240 constexpr bool disable_blocking_kernel = true; - kernel_launch_timer timer(*this, disable_blocking_kernel, m_run_once, m_check_throttling); + kernel_launch_timer timer(*this, disable_blocking_kernel); this->launch_kernel(timer); this->check_skip_time(m_cuda_timer.get_duration()); @@ -245,7 +252,7 @@ private: // do not use blocking kernel if benchmark is only run once, e.g., when profiling // ref: https://github.com/NVIDIA/nvbench/issue/242 const bool disable_blocking_kernel = m_run_once || m_disable_blocking_kernel; - kernel_launch_timer timer(*this, disable_blocking_kernel, m_run_once, m_check_throttling); + kernel_launch_timer timer(*this, disable_blocking_kernel); do { this->launch_kernel(timer);