summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
authortgrogers <[email protected]>2018-10-07 20:22:49 -0400
committertgrogers <[email protected]>2018-10-07 20:22:49 -0400
commit2ca656ae40436929f3d1261acabbd1c13db8470a (patch)
tree9ab5081e2b0fccfcd3e62a7f8d7bd3d8750323b7 /src/cuda-sim
parent1e2d7b4c3147a0371c26bf086024d1cf770ad60c (diff)
parent6bea063d90358417b9d95dd17f8c2b88491b7385 (diff)
Merge branch 'jain156-dev-purdue-integration' into dev-purdue-integration
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/cuda-sim.cc46
-rw-r--r--src/cuda-sim/cuda-sim.h2
-rw-r--r--src/cuda-sim/opcodes.def2
3 files changed, 26 insertions, 24 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 93bbc1d..02cd395 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -52,8 +52,10 @@
int gpgpu_ptx_instruction_classification;
void ** g_inst_classification_stat = NULL;
+void ** g_inst_mem_classification_stat = NULL;
void ** g_inst_op_classification_stat= NULL;
int g_ptx_kernel_count = -1; // used for classification stat collection purposes
+int g_ptx_kernel_count_prev = -1; // used for classification stat collection purposes
int g_debug_execution = 0;
int g_debug_thread_uid = 0;
addr_t g_debug_pc = 0xBEEF1518;
@@ -1241,12 +1243,16 @@ void init_inst_classification_stat()
#define MAX_CLASS_KER 1024
char kernelname[MAX_CLASS_KER] ="";
if (!g_inst_classification_stat) g_inst_classification_stat = (void**)calloc(MAX_CLASS_KER, sizeof(void*));
- snprintf(kernelname, MAX_CLASS_KER, "Kernel %d Classification\n",g_ptx_kernel_count );
+ snprintf(kernelname, MAX_CLASS_KER, "Kernel %d INST Classification",g_ptx_kernel_count );
assert( g_ptx_kernel_count < MAX_CLASS_KER ) ; // a static limit on number of kernels increase it if it fails!
g_inst_classification_stat[g_ptx_kernel_count] = StatCreate(kernelname,1,20);
+ if (!g_inst_mem_classification_stat) g_inst_mem_classification_stat = (void**)calloc(MAX_CLASS_KER, sizeof(void*));
+ snprintf(kernelname, MAX_CLASS_KER, "Kernel %d MEM Classification",g_ptx_kernel_count );
+ g_inst_mem_classification_stat[g_ptx_kernel_count] = StatCreate(kernelname,1,20);
if (!g_inst_op_classification_stat) g_inst_op_classification_stat = (void**)calloc(MAX_CLASS_KER, sizeof(void*));
- snprintf(kernelname, MAX_CLASS_KER, "Kernel %d OP Classification\n",g_ptx_kernel_count );
+ snprintf(kernelname, MAX_CLASS_KER, "Kernel %d OP Classification",g_ptx_kernel_count );
g_inst_op_classification_stat[g_ptx_kernel_count] = StatCreate(kernelname,1,100);
+ g_ptx_kernel_count_prev++;
}
static unsigned get_tex_datasize( const ptx_instruction *pI, ptx_thread_info *thread )
@@ -1324,6 +1330,17 @@ void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id)
delete pJ;
pI = pI_saved;
+ if ( gpgpu_ptx_instruction_classification ) {
+ init_inst_classification_stat();
+ if (op_classification) {
+ StatAddSample( g_inst_classification_stat[g_ptx_kernel_count], op_classification);
+ inst.op_classification = op_classification;
+ }
+ if (pI->get_space().get_type())
+ StatAddSample( g_inst_mem_classification_stat[g_ptx_kernel_count], ( int )pI->get_space().get_type());
+ StatAddSample( g_inst_op_classification_stat[g_ptx_kernel_count], (int) pI->get_opcode() );
+ }
+
// Run exit instruction if exit option included
if(pI->is_exit())
exit_impl(pI,this);
@@ -1409,27 +1426,6 @@ void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id)
if(!(this->m_functionalSimulationMode))
ptx_file_line_stats_add_exec_count(pI);
- if ( gpgpu_ptx_instruction_classification ) {
- init_inst_classification_stat();
- unsigned space_type=0;
- switch ( pI->get_space().get_type() ) {
- case global_space: space_type = 10; break;
- case local_space: space_type = 11; break;
- case tex_space: space_type = 12; break;
- case surf_space: space_type = 13; break;
- case param_space_kernel:
- case param_space_local:
- space_type = 14; break;
- case shared_space: space_type = 15; break;
- case const_space: space_type = 16; break;
- default:
- space_type = 0 ;
- break;
- }
- StatAddSample( g_inst_classification_stat[g_ptx_kernel_count], op_classification);
- if (space_type) StatAddSample( g_inst_classification_stat[g_ptx_kernel_count], ( int )space_type);
- StatAddSample( g_inst_op_classification_stat[g_ptx_kernel_count], (int) pI->get_opcode() );
- }
if ( (g_ptx_sim_num_insn % 100000) == 0 ) {
dim3 ctaid = get_ctaid();
dim3 tid = get_tid();
@@ -1849,8 +1845,10 @@ void gpgpu_cuda_ptx_sim_main_func( kernel_info_t &kernel, bool openCL )
//******PRINTING*******
printf( "GPGPU-Sim: Done functional simulation (%u instructions simulated).\n", g_ptx_sim_num_insn );
+ fflush(stdout);
if ( gpgpu_ptx_instruction_classification ) {
- StatDisp( g_inst_classification_stat[g_ptx_kernel_count]);
+ StatDisp ( g_inst_classification_stat[g_ptx_kernel_count]);
+ StatDisp ( g_inst_mem_classification_stat[g_ptx_kernel_count]);
StatDisp ( g_inst_op_classification_stat[g_ptx_kernel_count]);
}
diff --git a/src/cuda-sim/cuda-sim.h b/src/cuda-sim/cuda-sim.h
index 958daba..ef9549f 100644
--- a/src/cuda-sim/cuda-sim.h
+++ b/src/cuda-sim/cuda-sim.h
@@ -44,8 +44,10 @@ extern int g_ptx_sim_mode;
extern int g_debug_execution;
extern int g_debug_thread_uid;
extern void ** g_inst_classification_stat;
+extern void ** g_inst_mem_classification_stat;
extern void ** g_inst_op_classification_stat;
extern int g_ptx_kernel_count; // used for classification stat collection purposes
+extern int g_ptx_kernel_count_prev; // used for classification stat collection purposes
void ptx_opcocde_latency_options (option_parser_t opp);
extern class kernel_info_t *gpgpu_opencl_ptx_sim_init_grid(class function_info *entry,
diff --git a/src/cuda-sim/opcodes.def b/src/cuda-sim/opcodes.def
index e1b1422..ccf64d8 100644
--- a/src/cuda-sim/opcodes.def
+++ b/src/cuda-sim/opcodes.def
@@ -35,7 +35,9 @@ SFU 4
Mem(except Tex) 5
Tex 6
Nop 7
+Breakpoint 9
Other 10
+Scalar video 11
*/
OP_DEF(ABS_OP,abs_impl,"abs",1,1)
OP_DEF(ADD_OP,add_impl,"add",1,1)