6 #include <hip/hip_runtime.h>
12 template <
typename... Args,
typename F>
25 printf(
"%s: grid_dim {%u, %u, %u}, block_dim {%u, %u, %u} \n",
34 printf(
"Warm up %d times\n", stream_config.
cold_niters_);
39 kernel<<<grid_dim, block_dim, lds_byte, stream_config.
stream_id_>>>(args...);
43 const int nrepeat = stream_config.
nrepeat_;
46 printf(
"Start running %d times...\n", nrepeat);
48 hipEvent_t start, stop;
56 for(
int i = 0; i < nrepeat; ++i)
58 kernel<<<grid_dim, block_dim, lds_byte, stream_config.
stream_id_>>>(args...);
72 return total_time / nrepeat;
76 kernel<<<grid_dim, block_dim, lds_byte, stream_config.
stream_id_>>>(args...);
82 kernel<<<grid_dim, block_dim, lds_byte, stream_config.
stream_id_>>>(args...);
89 template <
typename... Args,
typename F,
typename PreProcessFunc>
91 PreProcessFunc preprocess,
103 printf(
"%s: grid_dim {%u, %u, %u}, block_dim {%u, %u, %u} \n",
112 printf(
"Warm up %d times\n", stream_config.
cold_niters_);
118 kernel<<<grid_dim, block_dim, lds_byte, stream_config.
stream_id_>>>(args...);
122 const int nrepeat = stream_config.
nrepeat_;
125 printf(
"Start running %d times...\n", nrepeat);
127 hipEvent_t start, stop;
135 for(
int i = 0; i < nrepeat; ++i)
138 kernel<<<grid_dim, block_dim, lds_byte, stream_config.
stream_id_>>>(args...);
145 float total_time = 0;
152 return total_time / nrepeat;
157 kernel<<<grid_dim, block_dim, lds_byte, stream_config.
stream_id_>>>(args...);
163 kernel<<<grid_dim, block_dim, lds_byte, stream_config.
stream_id_>>>(args...);
#define CK_ENV(name)
Definition: env.hpp:128
void hip_check_error(hipError_t x)
Definition: hip_check_error.hpp:10
float launch_and_time_kernel(const StreamConfig &stream_config, F kernel, dim3 grid_dim, dim3 block_dim, std::size_t lds_byte, Args... args)
Definition: kernel_launch.hpp:13
float launch_and_time_kernel_with_preprocess(const StreamConfig &stream_config, PreProcessFunc preprocess, F kernel, dim3 grid_dim, dim3 block_dim, std::size_t lds_byte, Args... args)
Definition: kernel_launch.hpp:90
bool EnvIsEnabled(EnvVar)
Definition: env.hpp:139
Definition: stream_config.hpp:10
int cold_niters_
Definition: stream_config.hpp:14
bool time_kernel_
Definition: stream_config.hpp:12
int nrepeat_
Definition: stream_config.hpp:15
hipStream_t stream_id_
Definition: stream_config.hpp:11