summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/abstract_hardware_model.h6
-rw-r--r--src/cuda-sim/cuda_device_runtime.cc2
-rw-r--r--src/gpgpu-sim/gpu-sim.cc2
-rw-r--r--src/stream_manager.cc9
4 files changed, 17 insertions, 2 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index 45334b6..e6ef521 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -284,6 +284,7 @@ public:
bool cta_has_stream(dim3 ctaid, CUstream_st* stream);
void destroy_cta_streams();
void print_parent_info();
+ kernel_info_t * get_parent() { return m_parent_kernel; }
private:
kernel_info_t * m_parent_kernel;
@@ -292,6 +293,11 @@ private:
std::list<kernel_info_t *> m_child_kernels; //child kernel launched
std::map< dim3, std::list<CUstream_st *>, dim3comp > m_cta_streams; //streams created in each CTA
+//Jin: kernel timing
+public:
+ unsigned long long launch_cycle;
+ unsigned long long start_cycle;
+ unsigned long long end_cycle;
};
struct core_config {
diff --git a/src/cuda-sim/cuda_device_runtime.cc b/src/cuda-sim/cuda_device_runtime.cc
index df2653e..1b8c8d9 100644
--- a/src/cuda-sim/cuda_device_runtime.cc
+++ b/src/cuda-sim/cuda_device_runtime.cc
@@ -176,6 +176,7 @@ void gpgpusim_cuda_launchDeviceV2(const ptx_instruction * pI, ptx_thread_info *
//create child kernel_info_t and index it with parameter_buffer address
device_grid = new kernel_info_t(config.grid_dim, config.block_dim, device_kernel_entry);
+ device_grid->launch_cycle = gpu_sim_cycle;
kernel_info_t & parent_grid = thread->get_kernel();
DEV_RUNTIME_REPORT("child kernel launched by " << parent_grid.name() << ", cta (" <<
thread->get_ctaid().x << ", " << thread->get_ctaid().y << ", " << thread->get_ctaid().z <<
@@ -184,7 +185,6 @@ void gpgpusim_cuda_launchDeviceV2(const ptx_instruction * pI, ptx_thread_info *
device_grid->set_parent(&parent_grid, thread->get_ctaid(), thread->get_tid());
device_launch_op = device_launch_operation_t(device_grid, NULL);
device_kernel_param_mem = device_grid->get_param_memory(); //kernel param
-
size_t param_start_address = 0;
//copy in word
for(unsigned n = 0; n < device_kernel_arg_size; n += 4) {
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index 81c9c9a..27362cf 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -531,6 +531,7 @@ kernel_info_t *gpgpu_sim::select_kernel()
unsigned idx = (n+m_last_issued_kernel+1)%m_config.max_concurrent_kernel;
if( kernel_more_cta_left(m_running_kernels[idx]) ){
m_last_issued_kernel=idx;
+ m_running_kernels[idx]->start_cycle = gpu_sim_cycle;
// record this kernel for stat print if it is the first time this kernel is selected for execution
unsigned launch_uid = m_running_kernels[idx]->get_uid();
if (std::find(m_executed_kernel_uids.begin(), m_executed_kernel_uids.end(), launch_uid) == m_executed_kernel_uids.end()) {
@@ -560,6 +561,7 @@ void gpgpu_sim::set_kernel_done( kernel_info_t *kernel )
std::vector<kernel_info_t*>::iterator k;
for( k=m_running_kernels.begin(); k!=m_running_kernels.end(); k++ ) {
if( *k == kernel ) {
+ kernel->end_cycle = gpu_sim_cycle;
*k = NULL;
break;
}
diff --git a/src/stream_manager.cc b/src/stream_manager.cc
index f90d9be..5bd7737 100644
--- a/src/stream_manager.cc
+++ b/src/stream_manager.cc
@@ -254,7 +254,14 @@ bool stream_manager::register_finished_kernel(unsigned grid_uid)
//Jin: should check children kernels for CDP
if(kernel->is_finished()) {
- printf("kernel %d finishes, retires from stream %d\n", grid_uid, stream->get_uid());
+// std::ofstream kernel_stat("kernel_stat.txt", std::ofstream::out | std::ofstream::app);
+// kernel_stat<< " kernel " << grid_uid;
+// if(kernel->get_parent())
+// kernel_stat << ", parent " << kernel->get_parent()->get_uid() <<
+// ", launch " << kernel->launch_cycle;
+// kernel_stat<< ", start " << kernel->start_cycle <<
+// ", end " << kernel->end_cycle << ", retire " << gpu_sim_cycle << "\n";
+// printf("kernel %d finishes, retires from stream %d\n", grid_uid, stream->get_uid());
stream->record_next_done();
m_grid_id_to_stream.erase(grid_uid);
kernel->notify_parent_finished();