summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
authorMengchi Zhang <[email protected]>2019-07-09 23:51:17 -0400
committerMengchi Zhang <[email protected]>2019-07-09 23:51:17 -0400
commit8b4f4ac167fd57284cebf38746bf571a52cf3a0f (patch)
tree155a025fec30c6a04c9862a47d1b36b2c5f55348 /src/cuda-sim
parentbf3146963f4261c24df76f23b5e21cd62d98cb14 (diff)
Move g_rpts
Signed-off-by: Mengchi Zhang <[email protected]>
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/cuda-sim.cc15
-rw-r--r--src/cuda-sim/cuda-sim.h10
2 files changed, 13 insertions, 12 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 11ba4ec..832a223 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -112,8 +112,6 @@ cudaLaunchDeviceV2_init_perWarp, cudaLaunchDevicV2_perKernel>"
"7200,8000,100,12000,1600");
}
-static address_type get_converge_point(address_type pc);
-
void gpgpu_t::gpgpu_ptx_sim_bindNameToTexture(const char* name, const struct textureReference* texref, int dim, int readmode, int ext)
{
std::string texname(name);
@@ -1096,7 +1094,7 @@ void ptx_instruction::pre_decode()
}
// get reconvergence pc
- reconvergence_pc = get_converge_point(pc);
+ reconvergence_pc = gpgpu_ctx->func_sim->get_converge_point(pc);
m_decoded=true;
}
@@ -2518,14 +2516,7 @@ void ptxinfo_opencl_addinfo( std::map<std::string,function_info*> &kernels )
clear_ptxinfo();
}
-struct rec_pts {
- gpgpu_recon_t *s_kernel_recon_points;
- int s_num_recon;
-};
-
-class std::map<function_info*,rec_pts> g_rpts;
-
-struct rec_pts find_reconvergence_points( function_info *finfo )
+struct rec_pts cuda_sim::find_reconvergence_points( function_info *finfo )
{
rec_pts tmp;
std::map<function_info*,rec_pts>::iterator r=g_rpts.find(finfo);
@@ -2564,7 +2555,7 @@ address_type get_return_pc( void *thd )
return the_thread->get_return_PC();
}
-address_type get_converge_point( address_type pc )
+address_type cuda_sim::get_converge_point( address_type pc )
{
// the branch could encode the reconvergence point and/or a bit that indicates the
// reconvergence point is the return PC on the call stack in the case the branch has
diff --git a/src/cuda-sim/cuda-sim.h b/src/cuda-sim/cuda-sim.h
index aa1fe40..0a1401a 100644
--- a/src/cuda-sim/cuda-sim.h
+++ b/src/cuda-sim/cuda-sim.h
@@ -120,6 +120,13 @@ void print_ptxinfo();
void clear_ptxinfo();
struct gpgpu_ptx_sim_info get_ptxinfo();
+class gpgpu_recon_t;
+struct rec_pts {
+ gpgpu_recon_t *s_kernel_recon_points;
+ int s_num_recon;
+};
+
+
class cuda_sim {
public:
cuda_sim( gpgpu_context* ctx ) {
@@ -149,6 +156,7 @@ class cuda_sim {
std::map<const void*,std::string> g_const_name_lookup; // indexed by hostVar
int g_ptx_sim_mode; // if non-zero run functional simulation only (i.e., no notion of a clock cycle)
unsigned gpgpu_param_num_shaders;
+ class std::map<function_info*,rec_pts> g_rpts;
// backward pointer
class gpgpu_context* gpgpu_ctx;
//global functions
@@ -165,6 +173,8 @@ class cuda_sim {
void gpgpu_ptx_sim_register_const_variable(void*, const char *deviceName, size_t size );
void read_sim_environment_variables();
void set_param_gpgpu_num_shaders(int num_shaders);
+ struct rec_pts find_reconvergence_points( function_info *finfo );
+ address_type get_converge_point( address_type pc );
};
#endif