diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cuda-sim/ptx_loader.h | 2 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_parser.cc | 3 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_parser.h | 3 | ||||
| -rw-r--r-- | src/cuda-sim/ptxinfo.y | 5 | ||||
| -rw-r--r-- | src/gpgpusim_entrypoint.cc | 10 | ||||
| -rw-r--r-- | src/gpgpusim_entrypoint.h | 7 |
6 files changed, 14 insertions, 16 deletions
diff --git a/src/cuda-sim/ptx_loader.h b/src/cuda-sim/ptx_loader.h index ee09e16..77f27c8 100644 --- a/src/cuda-sim/ptx_loader.h +++ b/src/cuda-sim/ptx_loader.h @@ -37,7 +37,7 @@ class ptxinfo_data{ char linebuf[PTXINFO_LINEBUF_SIZE]; unsigned col; const char *g_ptxinfo_filename; - + void ptxinfo_addinfo(); }; diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc index 2872b84..9094ec3 100644 --- a/src/cuda-sim/ptx_parser.cc +++ b/src/cuda-sim/ptx_parser.cc @@ -48,7 +48,6 @@ void set_ptx_warp_size(const struct core_config * warp_size) g_shader_core_config=warp_size; } -static bool g_debug_ir_generation=false; const char *g_filename; // the program intermediate representation... @@ -70,7 +69,7 @@ const char *decode_token( int type ) return g_ptx_token_decode[type].c_str(); } -void read_parser_environment_variables() +void ptx_recognizer::read_parser_environment_variables() { g_filename = getenv("PTX_SIM_KERNELFILE"); char *dbg_level = getenv("PTX_SIM_DEBUG"); diff --git a/src/cuda-sim/ptx_parser.h b/src/cuda-sim/ptx_parser.h index 25c01fe..bc9a872 100644 --- a/src/cuda-sim/ptx_parser.h +++ b/src/cuda-sim/ptx_parser.h @@ -62,6 +62,7 @@ class ptx_recognizer { g_error_detected = 0; g_entry_func_param_index=0; g_func_info = NULL; + g_debug_ir_generation=false; } // global list yyscan_t scanner; @@ -103,6 +104,7 @@ class ptx_recognizer { unsigned g_entry_func_param_index; function_info *g_func_info; operand_info g_return_var; + bool g_debug_ir_generation; // member function list void init_directive_state(); @@ -169,6 +171,7 @@ class ptx_recognizer { void start_inst_group(); void end_inst_group(); bool check_for_duplicates( const char *identifier ); + void read_parser_environment_variables(); }; diff --git a/src/cuda-sim/ptxinfo.y b/src/cuda-sim/ptxinfo.y index 00c81e0..b303958 100644 --- a/src/cuda-sim/ptxinfo.y +++ b/src/cuda-sim/ptxinfo.y @@ -29,7 +29,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %{ typedef void * yyscan_t; -class ptxinfo_data; +#include "ptx_loader.h" %} %define api.pure full @@ -79,7 +79,6 @@ class ptxinfo_data; static unsigned g_system; int ptxinfo_lex(YYSTYPE * yylval_param, yyscan_t yyscanner, ptxinfo_data* ptxinfo); void yyerror(yyscan_t yyscanner, ptxinfo_data* ptxinfo, const char* msg); - void ptxinfo_addinfo(); void ptxinfo_function(const char *fname ); void ptxinfo_regs( unsigned nregs ); void ptxinfo_lmem( unsigned declared, unsigned system ); @@ -104,7 +103,7 @@ line: HEADER INFO COLON line_info ; line_info: function_name - | function_info { ptxinfo_addinfo(); } + | function_info { ptxinfo->ptxinfo_addinfo(); } | gmem_info ; diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc index de937b0..476a9d4 100644 --- a/src/gpgpusim_entrypoint.cc +++ b/src/gpgpusim_entrypoint.cc @@ -35,9 +35,13 @@ #include "gpgpu-sim/gpu-sim.h" #include "gpgpu-sim/icnt_wrapper.h" #include "stream_manager.h" +#include "../libcuda/gpgpu_context.h" #define MAX(a,b) (((a)>(b))?(a):(b)) +static int sg_argc = 3; +static const char *sg_argv[] = {"", "-config","gpgpusim.config"}; + struct GPGPUsim_ctx* the_gpgpusim = NULL; @@ -205,12 +209,12 @@ void exit_simulation() extern bool g_cuda_launch_blocking; -gpgpu_sim *gpgpu_ptx_sim_init_perf() +gpgpu_sim *gpgpu_context::gpgpu_ptx_sim_init_perf() { srand(1); print_splash(); read_sim_environment_variables(); - read_parser_environment_variables(); + ptx_parser->read_parser_environment_variables(); option_parser_t opp = option_parser_create(); ptx_reg_options(opp); @@ -220,7 +224,7 @@ gpgpu_sim *gpgpu_ptx_sim_init_perf() GPGPUsim_ctx_ptr()->g_the_gpu_config = new gpgpu_sim_config(); GPGPUsim_ctx_ptr()->g_the_gpu_config->reg_options(opp); // register GPU microrachitecture options - option_parser_cmdline(opp, GPGPUsim_ctx_ptr()->sg_argc, GPGPUsim_ctx_ptr()->sg_argv); // parse configuration options + option_parser_cmdline(opp, sg_argc, sg_argv); // parse configuration options fprintf(stdout, "GPGPU-Sim: Configuration options:\n\n"); option_parser_print(opp, stdout); // Set the Numeric locale to a standard locale where a decimal point is a "dot" not a "comma" diff --git a/src/gpgpusim_entrypoint.h b/src/gpgpusim_entrypoint.h index 406dd00..a443151 100644 --- a/src/gpgpusim_entrypoint.h +++ b/src/gpgpusim_entrypoint.h @@ -44,9 +44,6 @@ struct GPGPUsim_ctx { break_limit = false; g_sim_lock = PTHREAD_MUTEX_INITIALIZER; - sg_argc = 3; - sg_argv = {"", "-config","gpgpusim.config"}; - g_the_gpu_config=NULL; g_the_gpu=NULL; g_stream_manager=NULL; @@ -70,9 +67,6 @@ struct GPGPUsim_ctx { struct CUctx_st* the_context; - int sg_argc; - const char *sg_argv[3]; - pthread_mutex_t g_sim_lock; bool g_sim_active; bool g_sim_done; @@ -80,7 +74,6 @@ struct GPGPUsim_ctx { }; -class gpgpu_sim *gpgpu_ptx_sim_init_perf(); void start_sim_thread(int api); class gpgpu_sim* g_the_gpu(); |
