diff --git a/include/ck/host_utility/kernel_launch.hpp b/include/ck/host_utility/kernel_launch.hpp index f48d3df1f9..67c046ace6 100755 --- a/include/ck/host_utility/kernel_launch.hpp +++ b/include/ck/host_utility/kernel_launch.hpp @@ -45,9 +45,10 @@ float launch_and_time_kernel(const StreamConfig& stream_config, float total_time = 0; hip_check_error(hipEventElapsedTime(&total_time, start, stop)); - total_time /= 10; + total_time /= stream_config.nrepeat_; stream_config.cold_niters_ = - (1000.0 / total_time); // we need longer runtime to ramp up the clk on MI300s + (stream_config.time_limit_ms / + total_time); // we need longer runtime to ramp up the clk on MI300s stream_config.nrepeat_ = stream_config.cold_niters_; } #endif @@ -148,9 +149,10 @@ float launch_and_time_kernel_with_preprocess(const StreamConfig& stream_config, float total_time = 0; hip_check_error(hipEventElapsedTime(&total_time, start, stop)); - total_time /= 10; + total_time /= stream_config.nrepeat_; stream_config.cold_niters_ = - (1000.0 / total_time); // we need longer runtime to ramp up the clk on MI300s + (stream_config.nrepeat_ / + total_time); // we need longer runtime to ramp up the clk on MI300s stream_config.nrepeat_ = stream_config.cold_niters_; } #endif diff --git a/include/ck/stream_config.hpp b/include/ck/stream_config.hpp index 7e3069a2d0..821cee9bc2 100755 --- a/include/ck/stream_config.hpp +++ b/include/ck/stream_config.hpp @@ -8,9 +8,10 @@ struct StreamConfig { - hipStream_t stream_id_ = nullptr; - bool time_kernel_ = false; - int log_level_ = 0; - mutable int cold_niters_ = 5; - mutable int nrepeat_ = 50; + hipStream_t stream_id_ = nullptr; + bool time_kernel_ = false; + int log_level_ = 0; + mutable int cold_niters_ = 5; + mutable int nrepeat_ = 50; + mutable int time_limit_ms = 1000; // for timing MI300 runs };