aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cuda-sim/cuda-sim.cc2
-rw-r--r--src/cuda-sim/ptx_ir.h2
-rw-r--r--src/cuda-sim/ptx_loader.cc40
-rw-r--r--src/cuda-sim/ptx_loader.h2
-rw-r--r--src/debug.cc2
-rw-r--r--src/debug.h2
-rw-r--r--src/gpgpu-sim/dram.h4
-rw-r--r--src/gpgpu-sim/mem_fetch.cc2
-rw-r--r--src/gpgpu-sim/mem_fetch.h4
-rw-r--r--src/gpgpu-sim/shader.h6
-rw-r--r--src/stream_manager.h6
11 files changed, 41 insertions, 31 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index a34b99b..9f24c69 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -2067,7 +2067,7 @@ struct rec_pts {
int s_num_recon;
};
-struct std::map<function_info*,rec_pts> g_rpts;
+class std::map<function_info*,rec_pts> g_rpts;
struct rec_pts find_reconvergence_points( function_info *finfo )
{
diff --git a/src/cuda-sim/ptx_ir.h b/src/cuda-sim/ptx_ir.h
index 9ad1571..8750187 100644
--- a/src/cuda-sim/ptx_ir.h
+++ b/src/cuda-sim/ptx_ir.h
@@ -105,7 +105,7 @@ private:
int m_is_function;
bool m_is_non_arch_reg;
- friend class type_info_key_compare;
+ friend struct type_info_key_compare;
};
class symbol_table;
diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc
index 6c1b595..11d9013 100644
--- a/src/cuda-sim/ptx_loader.cc
+++ b/src/cuda-sim/ptx_loader.cc
@@ -54,6 +54,7 @@ extern int ptxinfo_debug;
extern FILE *ptxinfo_in;
static bool g_save_embedded_ptx;
+static int g_occupancy_sm_number;
bool g_keep_intermediate_files;
bool m_ptx_save_converted_ptxplus;
@@ -71,6 +72,10 @@ void ptx_reg_options(option_parser_t opp)
&m_ptx_save_converted_ptxplus,
"Saved converted ptxplus to a file",
"0");
+ option_parser_register(opp, "-gpgpu_occupancy_sm_number", OPT_INT32, &g_occupancy_sm_number,
+ "The SM number to pass to ptxas when getting register usage for computing GPU occupancy. "
+ "This parameter is required in the config.",
+ "0");
}
void print_ptx_file( const char *p, unsigned source_num, const char *filename )
@@ -120,7 +125,7 @@ char* gpgpu_ptx_sim_convert_ptx_and_sass_to_ptxplus(const std::string ptxfilenam
fflush(stdout);
printf("GPGPU-Sim PTX: calling cuobjdump_to_ptxplus\ncommandline: %s\n", commandline);
result = system(commandline);
- if(result){printf("GPGPU-Sim PTX: ERROR ** could not execute %s\n", commandline); exit(1);}
+ if(result){fprintf(stderr, "GPGPU-Sim PTX: ERROR ** could not execute %s\n", commandline); exit(1);}
// Get ptxplus from file
@@ -142,7 +147,7 @@ char* gpgpu_ptx_sim_convert_ptx_and_sass_to_ptxplus(const std::string ptxfilenam
printf("GPGPU-Sim PTX: removing temporary files using \"%s\"\n", rm_commandline);
int rm_result = system(rm_commandline);
if( rm_result != 0 ) {
- printf("GPGPU-Sim PTX: ERROR ** while removing temporary files %d\n", rm_result);
+ fprintf(stderr, "GPGPU-Sim PTX: ERROR ** while removing temporary files %d\n", rm_result);
exit(1);
}
}
@@ -193,7 +198,7 @@ void fix_duplicate_errors(char fname2[1024]) {
printf("Running: %s\n", commandline);
int result = system(commandline);
if (result != 0) {
- printf("GPGPU-Sim PTX: ERROR ** while changing filename from %s to %s", fname2, tempfile);
+ fprintf(stderr, "GPGPU-Sim PTX: ERROR ** while changing filename from %s to %s", fname2, tempfile);
exit(1);
}
@@ -282,12 +287,12 @@ void fix_duplicate_errors(char fname2[1024]) {
printf("Running: %s\n", commandline);
result = system(commandline);
if (result != 0) {
- printf("GPGPU-Sim PTX: ERROR ** while deleting %s", tempfile);
+ fprintf(stderr, "GPGPU-Sim PTX: ERROR ** while deleting %s", tempfile);
exit(1);
}
}
-void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num, unsigned sm_version )
+void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num )
{
char fname[1024];
snprintf(fname,1024,"_ptx_XXXXXX");
@@ -308,9 +313,9 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num
printf("Running: %s\n", commandline2);
int result = system(commandline2);
if( result != 0 ) {
- printf("GPGPU-Sim PTX: ERROR ** while loading PTX (a) %d\n", result);
- printf(" Ensure you have write access to simulation directory\n");
- printf(" and have \'cat\' and \'sed\' in your path.\n");
+ fprintf(stderr, "GPGPU-Sim PTX: ERROR ** while loading PTX (a) %d\n", result);
+ fprintf(stderr, " Ensure you have write access to simulation directory\n");
+ fprintf(stderr, " and have \'cat\' and \'sed\' in your path.\n");
exit(1);
}
@@ -321,15 +326,20 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num
extra_flags[0]=0;
#if CUDART_VERSION >= 3000
- if (sm_version == 0) sm_version = 20;
+ if ( g_occupancy_sm_number == 0 ) {
+ fprintf( stderr, "gpgpusim.config must specify the sm version for the GPU that you use to compute occupancy \"-gpgpu_occupancy_sm_number XX\".\n"
+ "The register file size is specifically tied to the sm version used to querry ptxas for register usage.\n"
+ "A register size/SM mismatch may result in occupancy differences." );
+ exit(1);
+ }
extern bool g_cdp_enabled;
if(!g_cdp_enabled)
- snprintf(extra_flags,1024,"--gpu-name=sm_%u",sm_version);
+ snprintf(extra_flags,1024,"--gpu-name=sm_%u", g_occupancy_sm_number);
else
- snprintf(extra_flags,1024,"--compile-only --gpu-name=sm_%u",sm_version);
+ snprintf(extra_flags,1024,"--compile-only --gpu-name=sm_%u",g_occupancy_sm_number);
#endif
- snprintf(commandline,1024,"$CUDA_INSTALL_PATH/bin/ptxas %s -v %s --output-file /dev/null 2> %s",
+ snprintf(commandline,1024,"$PTXAS_CUDA_INSTALL_PATH/bin/ptxas %s -v %s --output-file /dev/null 2> %s",
extra_flags, fname2, tempfile_ptxinfo);
printf("GPGPU-Sim PTX: generating ptxinfo using \"%s\"\n", commandline);
result = system(commandline);
@@ -347,8 +357,8 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num
result = system(commandline);
}
if (result != 0) {
- printf("GPGPU-Sim PTX: ERROR ** while loading PTX (b) %d\n", result);
- printf(" Ensure ptxas is in your path.\n");
+ fprintf(stderr, "GPGPU-Sim PTX: ERROR ** while loading PTX (b) %d\n", result);
+ fprintf(stderr, " Ensure ptxas is in your path.\n");
exit(1);
}
}
@@ -362,7 +372,7 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num
printf("GPGPU-Sim PTX: removing ptxinfo using \"%s\"\n", commandline);
result = system(commandline);
if( result != 0 ) {
- printf("GPGPU-Sim PTX: ERROR ** while loading PTX (c) %d\n", result);
+ fprintf(stderr, "GPGPU-Sim PTX: ERROR ** while loading PTX (c) %d\n", result);
exit(1);
}
}
diff --git a/src/cuda-sim/ptx_loader.h b/src/cuda-sim/ptx_loader.h
index d3d0c92..cb02eda 100644
--- a/src/cuda-sim/ptx_loader.h
+++ b/src/cuda-sim/ptx_loader.h
@@ -32,7 +32,7 @@
extern bool g_override_embedded_ptx;
class symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source_num );
-void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num, unsigned sm_version=20 );
+void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num );
char* gpgpu_ptx_sim_convert_ptx_and_sass_to_ptxplus(const std::string ptx_str, const std::string sass_str, const std::string elf_str);
bool keep_intermediate_files();
diff --git a/src/debug.cc b/src/debug.cc
index cfd7bb0..ae15760 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -222,7 +222,7 @@ void gpgpu_sim::gpgpu_debug()
}
}
-bool thread_at_brkpt( ptx_thread_info *thread, const struct brk_pt &b )
+bool thread_at_brkpt( ptx_thread_info *thread, const class brk_pt &b )
{
return b.is_equal(thread->get_location(),thread->get_uid());
}
diff --git a/src/debug.h b/src/debug.h
index 7c79f1e..1277494 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -87,7 +87,7 @@ extern int gpgpu_ptx_instruction_classification ;
class ptx_thread_info;
class ptx_instruction;
-bool thread_at_brkpt( ptx_thread_info *thd_info, const struct brk_pt &b );
+bool thread_at_brkpt( ptx_thread_info *thd_info, const class brk_pt &b );
void hit_watchpoint( unsigned watchpoint_num, ptx_thread_info *thd, const ptx_instruction *pI );
#endif
diff --git a/src/gpgpu-sim/dram.h b/src/gpgpu-sim/dram.h
index a8bff14..15c63e7 100644
--- a/src/gpgpu-sim/dram.h
+++ b/src/gpgpu-sim/dram.h
@@ -87,7 +87,7 @@ struct bank_t
unsigned int bkgrpindex;
};
-struct mem_fetch;
+class mem_fetch;
class dram_t
{
@@ -178,7 +178,7 @@ private:
unsigned int ave_mrqs_partial;
unsigned int bwutil_partial;
- struct memory_stats_t *m_stats;
+ class memory_stats_t *m_stats;
class Stats* mrqq_Dist; //memory request queue inside DRAM
friend class frfcfs_scheduler;
diff --git a/src/gpgpu-sim/mem_fetch.cc b/src/gpgpu-sim/mem_fetch.cc
index 580c051..729636d 100644
--- a/src/gpgpu-sim/mem_fetch.cc
+++ b/src/gpgpu-sim/mem_fetch.cc
@@ -39,7 +39,7 @@ mem_fetch::mem_fetch( const mem_access_t &access,
unsigned wid,
unsigned sid,
unsigned tpc,
- const class memory_config *config )
+ const struct memory_config *config )
{
m_request_uid = sm_next_mf_request_uid++;
m_access = access;
diff --git a/src/gpgpu-sim/mem_fetch.h b/src/gpgpu-sim/mem_fetch.h
index c89edbb..de98748 100644
--- a/src/gpgpu-sim/mem_fetch.h
+++ b/src/gpgpu-sim/mem_fetch.h
@@ -55,7 +55,7 @@ public:
unsigned wid,
unsigned sid,
unsigned tpc,
- const class memory_config *config );
+ const struct memory_config *config );
~mem_fetch();
void set_status( enum mem_fetch_status status, unsigned long long cycle );
@@ -141,7 +141,7 @@ private:
static unsigned sm_next_mf_request_uid;
- const class memory_config *m_mem_config;
+ const struct memory_config *m_mem_config;
unsigned icnt_flit_size;
};
diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h
index bdd8dbe..53a10e0 100644
--- a/src/gpgpu-sim/shader.h
+++ b/src/gpgpu-sim/shader.h
@@ -286,7 +286,7 @@ typedef std::bitset<WARP_PER_CTA_MAX> warp_set_t;
int register_bank(int regnum, int wid, unsigned num_banks, unsigned bank_warp_shift);
class shader_core_ctx;
-class shader_core_config;
+struct shader_core_config;
class shader_core_stats;
enum scheduler_prioritization_type
@@ -967,7 +967,7 @@ struct ifetch_buffer_t {
unsigned m_warp_id;
};
-class shader_core_config;
+struct shader_core_config;
class simd_function_unit {
public:
@@ -1347,7 +1347,7 @@ struct shader_core_config : public core_config
struct shader_core_stats_pod {
- void* shader_core_stats_pod_start[]; // DO NOT MOVE FROM THE TOP - spaceless pointer to the start of this structure
+ void* shader_core_stats_pod_start[0]; // DO NOT MOVE FROM THE TOP - spaceless pointer to the start of this structure
unsigned long long *shader_cycles;
unsigned *m_num_sim_insn; // number of scalar thread instructions committed by this shader core
unsigned *m_num_sim_winsn; // number of warp instructions committed by this shader core
diff --git a/src/stream_manager.h b/src/stream_manager.h
index 222a1b2..d3a804f 100644
--- a/src/stream_manager.h
+++ b/src/stream_manager.h
@@ -93,7 +93,7 @@ public:
m_stream=stream;
m_done=false;
}
- stream_operation( class CUevent_st *e, struct CUstream_st *stream )
+ stream_operation( struct CUevent_st *e, struct CUstream_st *stream )
{
m_kernel=NULL;
m_type=stream_event;
@@ -172,10 +172,10 @@ private:
bool m_sim_mode;
kernel_info_t *m_kernel;
- class CUevent_st *m_event;
+ struct CUevent_st *m_event;
};
-class CUevent_st {
+struct CUevent_st {
public:
CUevent_st( bool blocking )
{