diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cuda-sim/ptx_ir.cc | 8 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_ir.h | 6 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_sim.cc | 3 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/cuda-sim/ptx_ir.cc b/src/cuda-sim/ptx_ir.cc index 849cc5d..3719fb2 100644 --- a/src/cuda-sim/ptx_ir.cc +++ b/src/cuda-sim/ptx_ir.cc @@ -43,11 +43,9 @@ typedef void * yyscan_t; #define STR_SIZE 1024 -unsigned symbol::sm_next_uid = 1; - unsigned symbol::get_uid() { - unsigned result = sm_next_uid++; + unsigned result = (gpgpu_ctx->symbol_sm_next_uid)++; return result; } @@ -152,7 +150,7 @@ symbol *symbol_table::add_variable( const char *identifier, const type_info *typ std::string key(identifier); assert( m_symbols.find(key) == m_symbols.end() ); snprintf(buf,1024,"%s:%u",filename,line); - symbol *s = new symbol(identifier,type,buf,size); + symbol *s = new symbol(identifier,type,buf,size,gpgpu_ctx); m_symbols[ key ] = s; if ( type != NULL && type->get_key().is_global() ) { @@ -173,7 +171,7 @@ void symbol_table::add_function( function_info *func, const char *filename, unsi char buf[1024]; snprintf(buf,1024,"%s:%u",filename,linenumber); type_info *type = add_type( func ); - symbol *s = new symbol(func->get_name().c_str(),type,buf,0); + symbol *s = new symbol(func->get_name().c_str(),type,buf,0,gpgpu_ctx); s->set_function(func); m_symbols[ func->get_name() ] = s; } diff --git a/src/cuda-sim/ptx_ir.h b/src/cuda-sim/ptx_ir.h index 1ffbebc..2fbda1c 100644 --- a/src/cuda-sim/ptx_ir.h +++ b/src/cuda-sim/ptx_ir.h @@ -152,8 +152,9 @@ class operand_info; class symbol { public: - symbol( const char *name, const type_info *type, const char *location, unsigned size ) + symbol( const char *name, const type_info *type, const char *location, unsigned size, gpgpu_context* ctx ) { + gpgpu_ctx = ctx; m_uid = get_uid(); m_name = name; m_decl_location = location; @@ -273,6 +274,7 @@ public: unsigned uid() const { return m_uid; } private: + gpgpu_context* gpgpu_ctx; unsigned get_uid(); unsigned m_uid; const type_info *m_type; @@ -299,8 +301,6 @@ private: bool m_reg_num_valid; std::list<operand_info> m_initializer; - static unsigned sm_next_uid; - }; class symbol_table { diff --git a/src/cuda-sim/ptx_sim.cc b/src/cuda-sim/ptx_sim.cc index 62bb529..949ee66 100644 --- a/src/cuda-sim/ptx_sim.cc +++ b/src/cuda-sim/ptx_sim.cc @@ -37,7 +37,6 @@ typedef void * yyscan_t; void feature_not_implemented( const char *f ); -unsigned long long g_ptx_cta_info_uid = 1; ptx_cta_info::ptx_cta_info( unsigned sm_idx, gpgpu_context* ctx ) { @@ -45,7 +44,7 @@ ptx_cta_info::ptx_cta_info( unsigned sm_idx, gpgpu_context* ctx ) ctx->func_sim->g_ptx_cta_info_sm_idx_used.insert(sm_idx); m_sm_idx = sm_idx; - m_uid = g_ptx_cta_info_uid++; + m_uid = (ctx->g_ptx_cta_info_uid)++; m_bar_threads = 0; gpgpu_ctx = ctx; } |
