summaryrefslogtreecommitdiff
path: root/src/cuda-sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuda-sim')
-rw-r--r--src/cuda-sim/cuda-sim.cc7
-rw-r--r--src/cuda-sim/instructions.cc24
-rw-r--r--src/cuda-sim/ptx_loader.cc2
3 files changed, 32 insertions, 1 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 89c240f..02c7dfd 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -438,6 +438,7 @@ void gpgpu_t::gpu_memset( size_t dst_start_addr, int c, size_t count )
void ptx_print_insn( address_type pc, FILE *fp )
{
+ static unsigned size=1;
std::map<unsigned,function_info*>::iterator f = g_pc_to_finfo.find(pc);
if( f == g_pc_to_finfo.end() ) {
fprintf(fp,"<no instruction at address 0x%x>", pc );
@@ -445,6 +446,7 @@ void ptx_print_insn( address_type pc, FILE *fp )
}
function_info *finfo = f->second;
assert( finfo );
+ size = finfo->print_insn(pc,fp);
}
void ptx_instruction::set_opcode_and_latency()
@@ -1088,6 +1090,8 @@ void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id)
// Output instruction information to file and stdout
if( config.get_ptx_inst_debug_to_file() != 0 &&
(config.get_ptx_inst_debug_thread_uid() == 0 || config.get_ptx_inst_debug_thread_uid() == get_uid()) ) {
+ dim3 ctaid = get_ctaid();
+ dim3 tid = get_tid();
fprintf(m_gpu->get_ptx_inst_debug_file(),
"[thd=%u] : (%s:%u - %s)\n",
get_uid(),
@@ -1453,6 +1457,7 @@ void gpgpu_ptx_sim_memcpy_symbol(const char *hostVar, const void *src, size_t co
printf("Execution error: No information for PTX symbol w/ hostVar=0x%Lx\n", (unsigned long long)hostVar );
abort();
} else printf("GPGPU-Sim PTX: gpgpu_ptx_sim_memcpy_symbol: Found PTX symbol w/ hostVar=0x%Lx\n", (unsigned long long)hostVar );
+ const char *mem_name = NULL;
memory_space *mem = NULL;
std::map<std::string,symbol_table*>::iterator st = g_sym_name_to_symbol_table.find(sym_name.c_str());
@@ -1465,9 +1470,11 @@ void gpgpu_ptx_sim_memcpy_symbol(const char *hostVar, const void *src, size_t co
switch (mem_region.get_type()) {
case const_space:
mem = gpu->get_global_memory();
+ mem_name = "global";
break;
case global_space:
mem = gpu->get_global_memory();
+ mem_name = "global";
break;
default:
abort();
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index 8a737bc..6976ba0 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -882,6 +882,8 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
src2_data, // b
op_result; // temp variable to hold operation result
+ bool data_ready = false;
+
// Get operand info of sources and destination
const operand_info &dst = pI->dst(); // d
const operand_info &src1 = pI->src1(); // a
@@ -916,9 +918,11 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
case B32_TYPE:
case U32_TYPE:
op_result.u32 = data.u32 & src2_data.u32;
+ data_ready = true;
break;
case S32_TYPE:
op_result.s32 = data.s32 & src2_data.s32;
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch (%x) with instruction\natom.AND only accepts b32\n", to_type);
@@ -936,9 +940,11 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
case B32_TYPE:
case U32_TYPE:
op_result.u32 = data.u32 | src2_data.u32;
+ data_ready = true;
break;
case S32_TYPE:
op_result.s32 = data.s32 | src2_data.s32;
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch (%x) with instruction\natom.OR only accepts b32\n", to_type);
@@ -956,9 +962,11 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
case B32_TYPE:
case U32_TYPE:
op_result.u32 = data.u32 ^ src2_data.u32;
+ data_ready = true;
break;
case S32_TYPE:
op_result.s32 = data.s32 ^ src2_data.s32;
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch (%x) with instruction\natom.XOR only accepts b32\n", to_type);
@@ -980,13 +988,16 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
case B32_TYPE:
case U32_TYPE:
op_result.u32 = MY_CAS_I(data.u32, src2_data.u32, src3_data.u32);
+ data_ready = true;
break;
case B64_TYPE:
case U64_TYPE:
op_result.u64 = MY_CAS_I(data.u64, src2_data.u64, src3_data.u64);
+ data_ready = true;
break;
case S32_TYPE:
op_result.s32 = MY_CAS_I(data.s32, src2_data.s32, src3_data.s32);
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch (%x) with instruction\natom.CAS only accepts b32 and b64\n", to_type);
@@ -1003,13 +1014,16 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
case B32_TYPE:
case U32_TYPE:
op_result.u32 = MY_EXCH(data.u32, src2_data.u32);
+ data_ready = true;
break;
case B64_TYPE:
case U64_TYPE:
op_result.u64 = MY_EXCH(data.u64, src2_data.u64);
+ data_ready = true;
break;
case S32_TYPE:
op_result.s32 = MY_EXCH(data.s32, src2_data.s32);
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch (%x) with instruction\natom.EXCH only accepts b32\n", to_type);
@@ -1026,15 +1040,19 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
switch ( to_type ) {
case U32_TYPE:
op_result.u32 = data.u32 + src2_data.u32;
+ data_ready = true;
break;
case S32_TYPE:
op_result.s32 = data.s32 + src2_data.s32;
+ data_ready = true;
break;
case U64_TYPE:
op_result.u64 = data.u64 + src2_data.u64;
+ data_ready = true;
break;
case F32_TYPE:
op_result.f32 = data.f32 + src2_data.f32;
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch with instruction\natom.ADD only accepts u32, s32, u64, and f32\n");
@@ -1050,6 +1068,7 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
switch ( to_type ) {
case U32_TYPE:
op_result.u32 = MY_INC_I(data.u32, src2_data.u32);
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch with instruction\natom.INC only accepts u32 and s32\n");
@@ -1065,6 +1084,7 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
switch ( to_type ) {
case U32_TYPE:
op_result.u32 = MY_DEC_I(data.u32, src2_data.u32);
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch with instruction\natom.DEC only accepts u32 and s32\n");
@@ -1080,9 +1100,11 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
switch ( to_type ) {
case U32_TYPE:
op_result.u32 = MY_MIN_I(data.u32, src2_data.u32);
+ data_ready = true;
break;
case S32_TYPE:
op_result.s32 = MY_MIN_I(data.s32, src2_data.s32);
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch with instruction\natom.MIN only accepts u32 and s32\n");
@@ -1098,9 +1120,11 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread )
switch ( to_type ) {
case U32_TYPE:
op_result.u32 = MY_MAX_I(data.u32, src2_data.u32);
+ data_ready = true;
break;
case S32_TYPE:
op_result.s32 = MY_MAX_I(data.s32, src2_data.s32);
+ data_ready = true;
break;
default:
printf("Execution error: type mismatch with instruction\natom.MAX only accepts u32 and s32\n");
diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc
index b5103df..56b9449 100644
--- a/src/cuda-sim/ptx_loader.cc
+++ b/src/cuda-sim/ptx_loader.cc
@@ -43,7 +43,7 @@ bool g_override_embedded_ptx = false;
/// extern prototypes
-//extern "C" int ptx_parse();
+extern "C" int ptx_parse();
extern "C" int ptx__scan_string(const char*);
const char *g_ptxinfo_filename;