summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cuda-sim/cuda-sim.cc2
-rw-r--r--src/cuda-sim/cuda_device_runtime.cc10
-rw-r--r--src/cuda-sim/cuda_device_runtime.h3
-rw-r--r--src/cuda-sim/instructions.cc2
-rw-r--r--src/gpgpu-sim/gpu-sim.cc2
-rw-r--r--src/gpgpu-sim/shader.cc2
6 files changed, 16 insertions, 5 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 3f5af7e..ec51779 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -1792,7 +1792,9 @@ void gpgpu_cuda_ptx_sim_main_func( kernel_info_t &kernel, bool openCL )
);
cta.execute();
+#if (CUDART_VERSION >= 5000)
launch_all_device_kernels();
+#endif
}
//registering this kernel as done
diff --git a/src/cuda-sim/cuda_device_runtime.cc b/src/cuda-sim/cuda_device_runtime.cc
index 12c83d2..4a8ffe5 100644
--- a/src/cuda-sim/cuda_device_runtime.cc
+++ b/src/cuda-sim/cuda_device_runtime.cc
@@ -1,9 +1,15 @@
//Jin: cuda_device_runtime.cc
//Defines CUDA device runtime APIs for CDP support
+
#include <iostream>
#include <map>
+unsigned long long g_total_param_size = 0;
+unsigned long long g_max_total_param_size = 0;
+
+
+#if (CUDART_VERSION >= 5000)
#define __CUDA_RUNTIME_API_H__
#include <builtin_types.h>
@@ -59,8 +65,6 @@ public:
std::map<void *, device_launch_config_t> g_cuda_device_launch_param_map;
std::list<device_launch_operation_t> g_cuda_device_launch_op;
extern stream_manager *g_stream_manager;
-unsigned long long g_total_param_size = 0;
-unsigned long long g_max_total_param_size = 0;
//Handling device runtime api:
//void * cudaGetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize)
@@ -313,4 +317,4 @@ void launch_all_device_kernels() {
launch_one_device_kernel();
}
}
-
+#endif
diff --git a/src/cuda-sim/cuda_device_runtime.h b/src/cuda-sim/cuda_device_runtime.h
index 385d605..6dbcd71 100644
--- a/src/cuda-sim/cuda_device_runtime.h
+++ b/src/cuda-sim/cuda_device_runtime.h
@@ -1,6 +1,6 @@
//Jin: cuda_device_runtime.h
//Defines CUDA device runtime APIs for CDP support
-
+#if (CUDART_VERSION >= 5000)
#pragma once
void gpgpusim_cuda_getParameterBufferV2(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func);
@@ -8,3 +8,4 @@ void gpgpusim_cuda_launchDeviceV2(const ptx_instruction * pI, ptx_thread_info *
void gpgpusim_cuda_streamCreateWithFlags(const ptx_instruction * pI, ptx_thread_info * thread, const function_info * target_func);
void launch_all_device_kernels();
void launch_one_device_kernel();
+#endif
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index 5d909d3..e68f9fd 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -1414,6 +1414,7 @@ void call_impl( const ptx_instruction *pI, ptx_thread_info *thread )
return;
}
+#if (CUDART_VERSION >= 5000)
//Jin: handle device runtime apis for CDP
else if(fname == "cudaGetParameterBufferV2") {
gpgpusim_cuda_getParameterBufferV2(pI, thread, target_func);
@@ -1427,6 +1428,7 @@ void call_impl( const ptx_instruction *pI, ptx_thread_info *thread )
gpgpusim_cuda_streamCreateWithFlags(pI, thread, target_func);
return;
}
+#endif
// read source arguements into register specified in declaration of function
arg_buffer_list_t arg_values;
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index 0b4b2f6..363fe5a 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -1513,8 +1513,10 @@ void gpgpu_sim::cycle()
try_snap_shot(gpu_sim_cycle);
spill_log_to_file (stdout, 0, gpu_sim_cycle);
+#if (CUDART_VERSION >= 5000)
//launch device kernel
launch_one_device_kernel();
+#endif
}
}
diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc
index b9caf18..59a2d8b 100644
--- a/src/gpgpu-sim/shader.cc
+++ b/src/gpgpu-sim/shader.cc
@@ -846,7 +846,7 @@ void scheduler_unit::cycle()
while( !warp(warp_id).waiting() && !warp(warp_id).ibuffer_empty() && (checked < max_issue) && (checked <= issued) && (issued < max_issue) ) {
const warp_inst_t *pI = warp(warp_id).ibuffer_next_inst();
//Jin: handle cdp latency;
- if(pI->m_is_cdp && warp(warp_id).m_cdp_latency > 0) {
+ if(pI && pI->m_is_cdp && warp(warp_id).m_cdp_latency > 0) {
assert(warp(warp_id).m_cdp_dummy);
warp(warp_id).m_cdp_latency--;
break;