summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJin Wang <[email protected]>2016-07-06 05:18:44 -0400
committerJin Wang <[email protected]>2016-07-06 05:18:44 -0400
commit2af85e353bccad8c8536c1d5f039361884b96872 (patch)
tree9e84ba2452ddd0d8e76dbf38318312b9c8d715a4
parent9f958e424f2fc952970794efc7647ceae1674d97 (diff)
ADD: add knob to enable CDP in gpgpusim config
-rw-r--r--libcuda/cuda_runtime_api.cc14
-rw-r--r--src/abstract_hardware_model.cc3
-rw-r--r--src/cuda-sim/ptx_loader.cc6
-rw-r--r--src/gpgpu-sim/gpu-sim.cc4
4 files changed, 24 insertions, 3 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index 30bf823..aa9a3eb 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -1336,7 +1336,11 @@ void extract_code_using_cuobjdump(){
system(command);
// Running cuobjdump using dynamic link to current process
// Needs the option '-all' to extract PTX from CDP-enabled binary
- snprintf(command,1000,"$CUDA_INSTALL_PATH/bin/cuobjdump -ptx -elf -sass -all %s > %s", app_binary.c_str(), fname);
+ extern bool g_cdp_enabled;
+ if(!g_cdp_enabled)
+ snprintf(command,1000,"$CUDA_INSTALL_PATH/bin/cuobjdump -ptx -elf -sass %s > %s", app_binary.c_str(), fname);
+ else
+ snprintf(command,1000,"$CUDA_INSTALL_PATH/bin/cuobjdump -ptx -elf -sass -all %s > %s", app_binary.c_str(), fname);
bool parse_output = true;
int result = system(command);
if(result) {
@@ -1545,6 +1549,14 @@ cuobjdumpPTXSection* findPTXSectionInList(std::list<cuobjdumpSection*> sectionli
if((ptxsection=dynamic_cast<cuobjdumpPTXSection*>(*iter)) != NULL){
if(ptxsection->getIdentifier() == identifier)
return ptxsection;
+ else {
+ extern bool g_cdp_enabled;
+ if(g_cdp_enabled) {
+ printf("Warning: __cudaRegisterFatBinary needs %s, but find PTX section with %s\n",
+ identifier.c_str(), ptxsection->getIdentifier().c_str());
+ return ptxsection;
+ }
+ }
}
}
return NULL;
diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc
index 819ad35..fe6f8ab 100644
--- a/src/abstract_hardware_model.cc
+++ b/src/abstract_hardware_model.cc
@@ -550,7 +550,8 @@ void warp_inst_t::completed( unsigned long long cycle ) const
ptx_file_line_stats_add_latency(pc, latency * active_count());
}
-//Jin: kernel launch latency
+//Jin: CDP support
+bool g_cdp_enabled;
unsigned g_kernel_launch_latency;
unsigned kernel_info_t::m_next_uid = 1;
diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc
index f7bf70e..a646408 100644
--- a/src/cuda-sim/ptx_loader.cc
+++ b/src/cuda-sim/ptx_loader.cc
@@ -217,7 +217,11 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num
#if CUDART_VERSION >= 3000
if (sm_version == 0) sm_version = 20;
- snprintf(extra_flags,1024,"--gpu-name=sm_%u",sm_version);
+ extern bool g_cdp_enabled;
+ if(!g_cdp_enabled)
+ snprintf(extra_flags,1024,"--gpu-name=sm_%u",sm_version);
+ else
+ snprintf(extra_flags,1024,"--compile-only --gpu-name=sm_%u",sm_version);
#endif
snprintf(commandline,1024,"$CUDA_INSTALL_PATH/bin/ptxas %s -v %s --output-file /dev/null 2> %s",
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index 02c9c09..0b4b2f6 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -449,6 +449,10 @@ void gpgpu_sim_config::reg_options(option_parser_t opp)
option_parser_register(opp, "-gpgpu_kernel_launch_latency", OPT_INT32,
&g_kernel_launch_latency, "Kernel launch latency in cycles. Default: 0",
"0");
+ extern bool g_cdp_enabled;
+ option_parser_register(opp, "-gpgpu_cdp_enabled", OPT_BOOL,
+ &g_cdp_enabled, "Turn on CDP",
+ "0");
}
/////////////////////////////////////////////////////////////////////////////