diff options
| -rw-r--r-- | src/abstract_hardware_model.cc | 4 | ||||
| -rw-r--r-- | src/abstract_hardware_model.h | 4 | ||||
| -rw-r--r-- | src/cuda-sim/cuda_device_runtime.h | 1 | ||||
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.cc | 19 | ||||
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.h | 1 |
5 files changed, 26 insertions, 3 deletions
diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc index 758ec00..fa5bca2 100644 --- a/src/abstract_hardware_model.cc +++ b/src/abstract_hardware_model.cc @@ -729,6 +729,8 @@ kernel_info_t::kernel_info_t( dim3 gridDim, dim3 blockDim, class function_info * //Jin: launch latency management m_launch_latency = entry->gpgpu_ctx->device_runtime->g_kernel_launch_latency; + m_kernel_TB_latency = entry->gpgpu_ctx->device_runtime->g_kernel_launch_latency + num_blocks() * entry->gpgpu_ctx->device_runtime->g_TB_launch_latency; + cache_config_set=false; } @@ -754,6 +756,8 @@ kernel_info_t::kernel_info_t( dim3 gridDim, dim3 blockDim, class function_info * //Jin: launch latency management m_launch_latency = entry->gpgpu_ctx->device_runtime->g_kernel_launch_latency; + m_kernel_TB_latency = entry->gpgpu_ctx->device_runtime->g_kernel_launch_latency + num_blocks() * entry->gpgpu_ctx->device_runtime->g_TB_launch_latency; + cache_config_set=false; m_NameToCudaArray = nameToCudaArray; m_NameToTextureInfo = nameToTextureInfo; diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h index a267d38..135b03b 100644 --- a/src/abstract_hardware_model.h +++ b/src/abstract_hardware_model.h @@ -348,9 +348,11 @@ public: unsigned long long launch_cycle; unsigned long long start_cycle; unsigned long long end_cycle; - unsigned m_launch_latency; + unsigned m_launch_latency; //this used for CDP kernel latency mutable bool cache_config_set; + + unsigned m_kernel_TB_latency; //this used for any CPU-GPU kernel latency and counted in the gpu_cycle }; class core_config { diff --git a/src/cuda-sim/cuda_device_runtime.h b/src/cuda-sim/cuda_device_runtime.h index 7f7a0ca..9647730 100644 --- a/src/cuda-sim/cuda_device_runtime.h +++ b/src/cuda-sim/cuda_device_runtime.h @@ -50,6 +50,7 @@ class cuda_device_runtime { std::map<void *, device_launch_config_t> g_cuda_device_launch_param_map; std::list<device_launch_operation_t> g_cuda_device_launch_op; unsigned g_kernel_launch_latency; + unsigned g_TB_launch_latency; unsigned long long g_max_total_param_size; bool g_cdp_enabled; diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index ed96d42..a9462f5 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -562,6 +562,10 @@ void gpgpu_sim_config::reg_options(option_parser_t opp) &(gpgpu_ctx->device_runtime->g_cdp_enabled), "Turn on CDP", "0"); + option_parser_register(opp, "-gpgpu_TB_launch_latency", OPT_INT32, + &(gpgpu_ctx->device_runtime->g_TB_launch_latency), "thread block launch latency in cycles. Default: 0", + "0"); + //Trace driven mode parameters option_parser_register(opp, "-trace_driven_mode", OPT_BOOL, &trace_driven_mode, "Turn on trace_driven_mode", @@ -648,10 +652,19 @@ bool gpgpu_sim::get_more_cta_left() const return false; } +void gpgpu_sim::decrement_kernel_latency() +{ + for(unsigned n=0; n < m_running_kernels.size(); n++ ) { + if( m_running_kernels[n] && m_running_kernels[n]->m_kernel_TB_latency ) + m_running_kernels[n]->m_kernel_TB_latency--; + } +} + kernel_info_t *gpgpu_sim::select_kernel() { if(m_running_kernels[m_last_issued_kernel] && - !m_running_kernels[m_last_issued_kernel]->no_more_ctas_to_run()) { + !m_running_kernels[m_last_issued_kernel]->no_more_ctas_to_run() && + !m_running_kernels[m_last_issued_kernel]->m_kernel_TB_latency) { unsigned launch_uid = m_running_kernels[m_last_issued_kernel]->get_uid(); if(std::find(m_executed_kernel_uids.begin(), m_executed_kernel_uids.end(), launch_uid) == m_executed_kernel_uids.end()) { m_running_kernels[m_last_issued_kernel]->start_cycle = gpu_sim_cycle + gpu_tot_sim_cycle; @@ -663,7 +676,8 @@ kernel_info_t *gpgpu_sim::select_kernel() for(unsigned n=0; n < m_running_kernels.size(); n++ ) { unsigned idx = (n+m_last_issued_kernel+1)%m_config.max_concurrent_kernel; - if( kernel_more_cta_left(m_running_kernels[idx]) ){ + if( kernel_more_cta_left(m_running_kernels[idx]) && + !m_running_kernels[idx]->m_kernel_TB_latency){ m_last_issued_kernel=idx; m_running_kernels[idx]->start_cycle = gpu_sim_cycle + gpu_tot_sim_cycle; // record this kernel for stat print if it is the first time this kernel is selected for execution @@ -1693,6 +1707,7 @@ void gpgpu_sim::cycle() #endif issue_block2core(); + decrement_kernel_latency(); // Depending on configuration, invalidate the caches once all of threads are completed. int all_threads_complete = 1; diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h index 86d6206..9fb928a 100644 --- a/src/gpgpu-sim/gpu-sim.h +++ b/src/gpgpu-sim/gpu-sim.h @@ -502,6 +502,7 @@ public: bool kernel_more_cta_left(kernel_info_t *kernel) const; bool hit_max_cta_count() const; kernel_info_t *select_kernel(); + void decrement_kernel_latency(); const gpgpu_sim_config &get_config() const { return m_config; } void gpu_print_stat(); |
