summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/abstract_hardware_model.h2
-rw-r--r--src/cuda-sim/cuda-math.h1
-rw-r--r--src/cuda-sim/cuda-sim.cc2
-rw-r--r--src/cuda-sim/ptx.l4
-rw-r--r--src/cuda-sim/ptx.y6
-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/cuda-sim/ptx_parser.cc12
-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/gpu-cache.cc4
-rw-r--r--src/gpgpu-sim/gpu-sim.cc3
-rw-r--r--src/gpgpu-sim/mem_fetch.cc3
-rw-r--r--src/gpgpu-sim/mem_fetch.h4
-rw-r--r--src/gpgpu-sim/shader.h6
-rw-r--r--src/stream_manager.h6
18 files changed, 60 insertions, 45 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index 6fa2ba0..8333247 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -388,7 +388,7 @@ protected:
std::deque<simt_stack_entry> m_stack;
};
-#define GLOBAL_HEAP_START 0x703E20000
+#define GLOBAL_HEAP_START 0xC0000000
// start allocating from this address (lower values used for allocating globals in .ptx file)
#define SHARED_MEM_SIZE_MAX (64*1024)
#define LOCAL_MEM_SIZE_MAX (8*1024)
diff --git a/src/cuda-sim/cuda-math.h b/src/cuda-sim/cuda-math.h
index f88c526..afac330 100644
--- a/src/cuda-sim/cuda-math.h
+++ b/src/cuda-sim/cuda-math.h
@@ -150,6 +150,7 @@ float __ll2float_rd(long long int a) {
#include <device_types.h>
#include <fenv.h>
+
// 32-bit integer to float
float __int2float_rn(int a) {
int orig_rnd_mode = fegetround();
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 93bbc1d..99e054d 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -2092,7 +2092,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.l b/src/cuda-sim/ptx.l
index 5471d6f..af015c9 100644
--- a/src/cuda-sim/ptx.l
+++ b/src/cuda-sim/ptx.l
@@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ptx.tab.h"
#include <string.h>
-char linebuf[1024];
+char linebuf[4096];
unsigned col = 0;
#define TC col+=strlen(ptx_text);
#define CHECK_UNSIGNED \
@@ -382,7 +382,7 @@ breakaddr TC; ptx_lval.int_value = BREAKADDR_OP; return OPCODE;
"//"[^\n]* TC; // eat single
-\n.* col=0; strncpy(linebuf, yytext + 1, 1024); yyless( 1 );
+\n.* col=0; strncpy(linebuf, yytext + 1, sizeof(linebuf)); yyless( 1 );
" " TC;
"\t" TC;
diff --git a/src/cuda-sim/ptx.y b/src/cuda-sim/ptx.y
index c0c58a6..2783fc2 100644
--- a/src/cuda-sim/ptx.y
+++ b/src/cuda-sim/ptx.y
@@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%token PTR_DIRECTIVE
%token ENTRY_DIRECTIVE
%token EXTERN_DIRECTIVE
-%token WEAK_DIRECTIVE
%token FILE_DIRECTIVE
%token FUNC_DIRECTIVE
%token GLOBAL_DIRECTIVE
@@ -271,6 +270,7 @@ ptr_spec: /*empty*/
ptr_space_spec: GLOBAL_DIRECTIVE { add_ptr_spec(global_space); }
| LOCAL_DIRECTIVE { add_ptr_spec(local_space); }
| SHARED_DIRECTIVE { add_ptr_spec(shared_space); }
+ | CONST_DIRECTIVE { add_ptr_spec(global_space); }
ptr_align_spec: ALIGN_DIRECTIVE INT_OPERAND
@@ -332,6 +332,7 @@ var_spec_list: var_spec
var_spec: space_spec
| type_spec
| align_spec
+ | VISIBLE_DIRECTIVE
| EXTERN_DIRECTIVE { add_extern_spec(); }
| WEAK_DIRECTIVE
;
@@ -514,7 +515,8 @@ compare_spec:EQ_OPTION { add_option(EQ_OPTION); }
| NAN_OPTION { add_option(NAN_OPTION); }
;
-operand_list: operand
+operand_list: /* empty*/
+ | operand
| operand COMMA operand_list;
operand: IDENTIFIER { add_scalar_operand( $1 ); }
diff --git a/src/cuda-sim/ptx_ir.h b/src/cuda-sim/ptx_ir.h
index 36ef3d5..f4d3641 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/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc
index e5731a8..6dc1f40 100644
--- a/src/cuda-sim/ptx_parser.cc
+++ b/src/cuda-sim/ptx_parser.cc
@@ -265,7 +265,7 @@ void parse_assert_impl( int test_value, const char *file, unsigned line, const c
parse_error_impl(file,line, msg);
}
-extern char linebuf[1024];
+extern char linebuf[4096];
void set_return()
@@ -433,7 +433,7 @@ void add_identifier( const char *identifier, int array_dim, unsigned array_ident
assert( (num_bits%8) == 0 );
addr = g_current_symbol_table->get_shared_next();
addr_pad = pad_address(addr, num_bits/8, 128);
- printf("from 0x%x to 0x%lx (shared memory space)\n",
+ printf("from 0x%llx to 0x%llx (shared memory space)\n",
addr+addr_pad,
addr+addr_pad + num_bits/8);
fflush(stdout);
@@ -450,7 +450,7 @@ void add_identifier( const char *identifier, int array_dim, unsigned array_ident
assert( (num_bits%8) == 0 );
addr = g_current_symbol_table->get_global_next();
addr_pad = pad_address(addr, num_bits/8, 128);
- printf("from 0x%x to 0x%lx (global memory space) %u\n",
+ printf("from 0x%llx to 0x%llx (global memory space) %u\n",
addr+addr_pad,
addr+addr_pad + num_bits/8,
g_const_alloc++);
@@ -471,7 +471,7 @@ void add_identifier( const char *identifier, int array_dim, unsigned array_ident
assert( (num_bits%8) == 0 );
addr = g_current_symbol_table->get_global_next();
addr_pad = pad_address(addr, num_bits/8, 128);
- printf("from 0x%x to 0x%lx (global memory space)\n",
+ printf("from 0x%llx to 0x%llx (global memory space)\n",
addr+addr_pad,
addr+addr_pad + num_bits/8);
fflush(stdout);
@@ -488,7 +488,7 @@ void add_identifier( const char *identifier, int array_dim, unsigned array_ident
assert( (num_bits%8) == 0 );
addr = g_current_symbol_table->get_local_next();
addr_pad = pad_address(addr, num_bits/8, 128);
- printf("from 0x%x to 0x%lx (local memory space)\n",
+ printf("from 0x%llx to 0x%llx (local memory space)\n",
addr+addr_pad,
addr+addr_pad + num_bits/8);
fflush(stdout);
@@ -501,7 +501,7 @@ void add_identifier( const char *identifier, int array_dim, unsigned array_ident
assert( (num_bits%8) == 0 );
addr = g_current_symbol_table->get_local_next();
addr_pad = pad_address(addr, num_bits/8, 128);
- printf("from 0x%x to 0x%lx\n",
+ printf("from 0x%llx to 0x%llx\n",
addr+addr_pad,
addr+addr_pad + num_bits/8);
fflush(stdout);
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 965936b..bee5b7b 100644
--- a/src/gpgpu-sim/dram.h
+++ b/src/gpgpu-sim/dram.h
@@ -104,7 +104,7 @@ enum bank_grp_bits_position{
LOWER_BITS
};
-struct mem_fetch;
+class mem_fetch;
class dram_t
{
@@ -243,7 +243,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/gpu-cache.cc b/src/gpgpu-sim/gpu-cache.cc
index fdcbdaf..e4ed6aa 100644
--- a/src/gpgpu-sim/gpu-cache.cc
+++ b/src/gpgpu-sim/gpu-cache.cc
@@ -708,8 +708,8 @@ void cache_stats::print_stats(FILE *fout, const char *cache_name) const{
/// the provided name is used.
/// The printed format is "<cache_name>[<request_type>][<request_status>] = <stat_value>"
///
- std::vector< unsigned > total_access;
- total_access.resize(NUM_MEM_ACCESS_TYPE, 0);
+ std::vector< unsigned > total_access;
+ total_access.resize(NUM_MEM_ACCESS_TYPE, 0);
std::string m_cache_name = cache_name;
for (unsigned type = 0; type < NUM_MEM_ACCESS_TYPE; ++type) {
for (unsigned status = 0; status < NUM_CACHE_REQUEST_STATUS; ++status) {
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index 6606cc7..d02e8e1 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
+#include <signal.h>
#include "zlib.h"
@@ -1550,7 +1551,7 @@ void gpgpu_sim::cycle()
if( g_single_step && ((gpu_sim_cycle+gpu_tot_sim_cycle) >= g_single_step) ) {
- asm("int $03");
+ raise(SIGTRAP); // Debug breakpoint
}
gpu_sim_cycle++;
if( g_interactive_debugger_enabled )
diff --git a/src/gpgpu-sim/mem_fetch.cc b/src/gpgpu-sim/mem_fetch.cc
index c05a693..a260a35 100644
--- a/src/gpgpu-sim/mem_fetch.cc
+++ b/src/gpgpu-sim/mem_fetch.cc
@@ -39,9 +39,10 @@ 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,
mem_fetch *m_original_mf,
mem_fetch *m_original_wr_mf)
+
{
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 da67d49..e5efffd 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 *original_mf = NULL,
mem_fetch *original_wr_mf = NULL);
~mem_fetch();
@@ -148,7 +148,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;
mem_fetch* original_mf; //this pointer is set up when a request is divided into sector requests at L2 cache (if the req size > L2 sector size), so the pointer refers to the original request
diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h
index fc8fe78..4a87126 100644
--- a/src/gpgpu-sim/shader.h
+++ b/src/gpgpu-sim/shader.h
@@ -294,7 +294,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
@@ -1000,7 +1000,7 @@ struct ifetch_buffer_t {
unsigned m_warp_id;
};
-class shader_core_config;
+struct shader_core_config;
class simd_function_unit {
public:
@@ -1415,7 +1415,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 )
{