diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/abstract_hardware_model.cc | 11 | ||||
| -rw-r--r-- | src/abstract_hardware_model.h | 2 | ||||
| -rw-r--r-- | src/cuda-sim/Makefile | 73 | ||||
| -rw-r--r-- | src/cuda-sim/cuda-sim.cc | 1 | ||||
| -rw-r--r-- | src/cuda-sim/instructions.cc | 34 | ||||
| -rw-r--r-- | src/cuda-sim/ptx.l | 3 | ||||
| -rw-r--r-- | src/cuda-sim/ptx.y | 2 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_loader.cc | 187 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_loader.h | 3 | ||||
| -rw-r--r-- | src/cuda-sim/ptx_parser.cc | 11 | ||||
| -rw-r--r-- | src/gpgpu-sim/dram.cc | 29 | ||||
| -rw-r--r-- | src/gpgpu-sim/dram.h | 10 | ||||
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.cc | 4 | ||||
| -rw-r--r-- | src/gpgpu-sim/gpu-sim.h | 22 | ||||
| -rw-r--r-- | src/gpgpu-sim/shader.cc | 17 | ||||
| -rw-r--r-- | src/gpgpusim_entrypoint.cc | 11 |
16 files changed, 319 insertions, 101 deletions
diff --git a/src/abstract_hardware_model.cc b/src/abstract_hardware_model.cc index 9e476eb..6457edd 100644 --- a/src/abstract_hardware_model.cc +++ b/src/abstract_hardware_model.cc @@ -49,9 +49,18 @@ void move_warp( warp_inst_t *&dst, warp_inst_t *&src ) void gpgpu_functional_sim_config::reg_options(class OptionParser * opp) { + option_parser_register(opp, "-gpgpu_ptx_use_cuobjdump", OPT_BOOL, + &m_ptx_use_cuobjdump, + "Use cuobjdump to extract ptx and sass from binaries", +#if (CUDART_VERSION >= 4000) + "1" +#else + "0" +#endif + ); option_parser_register(opp, "-gpgpu_ptx_convert_to_ptxplus", OPT_BOOL, &m_ptx_convert_to_ptxplus, - "Convert embedded ptx to ptxplus", + "Convert SASS (native ISA) to ptxplus and run ptxplus", "0"); option_parser_register(opp, "-gpgpu_ptx_save_converted_ptxplus", OPT_BOOL, &m_ptx_save_converted_ptxplus, diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h index a6cc811..4bfdda9 100644 --- a/src/abstract_hardware_model.h +++ b/src/abstract_hardware_model.h @@ -337,6 +337,7 @@ public: unsigned get_forced_max_capability() const { return m_ptx_force_max_capability; } bool convert_to_ptxplus() const { return m_ptx_convert_to_ptxplus; } + bool use_cuobjdump() const { return m_ptx_use_cuobjdump; } bool saved_converted_ptxplus() const { return m_ptx_save_converted_ptxplus; } int get_ptx_inst_debug_to_file() const { return g_ptx_inst_debug_to_file; } @@ -348,6 +349,7 @@ private: // PTX options int m_ptx_convert_to_ptxplus; int m_ptx_save_converted_ptxplus; + int m_ptx_use_cuobjdump; unsigned m_ptx_force_max_capability; int g_ptx_inst_debug_to_file; diff --git a/src/cuda-sim/Makefile b/src/cuda-sim/Makefile index a475ca2..a70ee5f 100644 --- a/src/cuda-sim/Makefile +++ b/src/cuda-sim/Makefile @@ -159,13 +159,15 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/gnu/stubs-64.h ../../build/release/cuda-sim/cuda_device_printf.o: ptx.tab.h ptx_sim.h ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/stdlib.h +../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/waitstatus.h +../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/endian.h +../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/endian.h +../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/sys/types.h ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/types.h ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/typesizes.h ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/time.h -../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/endian.h -../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/endian.h -../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/sys/select.h ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/select.h ../../build/release/cuda-sim/cuda_device_printf.o: /usr/include/bits/sigset.h @@ -193,13 +195,15 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/wordsize.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/gnu/stubs.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/gnu/stubs-64.h +../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/waitstatus.h +../../build/release/cuda-sim/cuda-sim.o: /usr/include/endian.h +../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/endian.h +../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/sys/types.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/types.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/typesizes.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/time.h -../../build/release/cuda-sim/cuda-sim.o: /usr/include/endian.h -../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/endian.h -../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/sys/select.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/select.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/sigset.h @@ -242,6 +246,7 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/cuda-sim.o: /usr/include/zconf.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/unistd.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/posix_opt.h +../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/environments.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/bits/confname.h ../../build/release/cuda-sim/cuda-sim.o: /usr/include/getopt.h ../../build/release/cuda-sim/cuda-sim.o: ../gpgpu-sim/scoreboard.h @@ -261,13 +266,15 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/instructions.o: /usr/include/gnu/stubs-64.h ../../build/release/cuda-sim/instructions.o: ptx.tab.h ptx_sim.h ../../build/release/cuda-sim/instructions.o: /usr/include/stdlib.h +../../build/release/cuda-sim/instructions.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/instructions.o: /usr/include/bits/waitstatus.h +../../build/release/cuda-sim/instructions.o: /usr/include/endian.h +../../build/release/cuda-sim/instructions.o: /usr/include/bits/endian.h +../../build/release/cuda-sim/instructions.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/instructions.o: /usr/include/sys/types.h ../../build/release/cuda-sim/instructions.o: /usr/include/bits/types.h ../../build/release/cuda-sim/instructions.o: /usr/include/bits/typesizes.h ../../build/release/cuda-sim/instructions.o: /usr/include/time.h -../../build/release/cuda-sim/instructions.o: /usr/include/endian.h -../../build/release/cuda-sim/instructions.o: /usr/include/bits/endian.h -../../build/release/cuda-sim/instructions.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/instructions.o: /usr/include/sys/select.h ../../build/release/cuda-sim/instructions.o: /usr/include/bits/select.h ../../build/release/cuda-sim/instructions.o: /usr/include/bits/sigset.h @@ -311,6 +318,7 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/instructions.o: /usr/include/zconf.h ../../build/release/cuda-sim/instructions.o: /usr/include/unistd.h ../../build/release/cuda-sim/instructions.o: /usr/include/bits/posix_opt.h +../../build/release/cuda-sim/instructions.o: /usr/include/bits/environments.h ../../build/release/cuda-sim/instructions.o: /usr/include/bits/confname.h ../../build/release/cuda-sim/instructions.o: /usr/include/getopt.h ../../build/release/cuda-sim/instructions.o: ../gpgpu-sim/scoreboard.h @@ -336,11 +344,13 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/memory.o: /usr/include/bits/stdio_lim.h ../../build/release/cuda-sim/memory.o: /usr/include/bits/sys_errlist.h ../../build/release/cuda-sim/memory.o: /usr/include/stdlib.h -../../build/release/cuda-sim/memory.o: /usr/include/sys/types.h -../../build/release/cuda-sim/memory.o: /usr/include/time.h +../../build/release/cuda-sim/memory.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/memory.o: /usr/include/bits/waitstatus.h ../../build/release/cuda-sim/memory.o: /usr/include/endian.h ../../build/release/cuda-sim/memory.o: /usr/include/bits/endian.h ../../build/release/cuda-sim/memory.o: /usr/include/bits/byteswap.h +../../build/release/cuda-sim/memory.o: /usr/include/sys/types.h +../../build/release/cuda-sim/memory.o: /usr/include/time.h ../../build/release/cuda-sim/memory.o: /usr/include/sys/select.h ../../build/release/cuda-sim/memory.o: /usr/include/bits/select.h ../../build/release/cuda-sim/memory.o: /usr/include/bits/sigset.h @@ -358,13 +368,15 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/ptx_ir.o: /usr/include/gnu/stubs.h ../../build/release/cuda-sim/ptx_ir.o: /usr/include/gnu/stubs-64.h ptx.tab.h ../../build/release/cuda-sim/ptx_ir.o: ptx_sim.h /usr/include/stdlib.h +../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/waitstatus.h +../../build/release/cuda-sim/ptx_ir.o: /usr/include/endian.h +../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/endian.h +../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx_ir.o: /usr/include/sys/types.h ../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/types.h ../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/typesizes.h ../../build/release/cuda-sim/ptx_ir.o: /usr/include/time.h -../../build/release/cuda-sim/ptx_ir.o: /usr/include/endian.h -../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/endian.h -../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx_ir.o: /usr/include/sys/select.h ../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/select.h ../../build/release/cuda-sim/ptx_ir.o: /usr/include/bits/sigset.h @@ -393,13 +405,15 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/ptx_loader.o: /usr/include/gnu/stubs-64.h ../../build/release/cuda-sim/ptx_loader.o: ptx.tab.h ptx_sim.h ../../build/release/cuda-sim/ptx_loader.o: /usr/include/stdlib.h +../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/waitstatus.h +../../build/release/cuda-sim/ptx_loader.o: /usr/include/endian.h +../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/endian.h +../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx_loader.o: /usr/include/sys/types.h ../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/types.h ../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/typesizes.h ../../build/release/cuda-sim/ptx_loader.o: /usr/include/time.h -../../build/release/cuda-sim/ptx_loader.o: /usr/include/endian.h -../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/endian.h -../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx_loader.o: /usr/include/sys/select.h ../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/select.h ../../build/release/cuda-sim/ptx_loader.o: /usr/include/bits/sigset.h @@ -433,13 +447,15 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/ptx_parser.o: /usr/include/gnu/stubs-64.h ../../build/release/cuda-sim/ptx_parser.o: ptx.tab.h ptx_sim.h ../../build/release/cuda-sim/ptx_parser.o: /usr/include/stdlib.h +../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/waitstatus.h +../../build/release/cuda-sim/ptx_parser.o: /usr/include/endian.h +../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/endian.h +../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx_parser.o: /usr/include/sys/types.h ../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/types.h ../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/typesizes.h ../../build/release/cuda-sim/ptx_parser.o: /usr/include/time.h -../../build/release/cuda-sim/ptx_parser.o: /usr/include/endian.h -../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/endian.h -../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx_parser.o: /usr/include/sys/select.h ../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/select.h ../../build/release/cuda-sim/ptx_parser.o: /usr/include/bits/sigset.h @@ -465,13 +481,15 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/wordsize.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/gnu/stubs.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/gnu/stubs-64.h +../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/waitstatus.h +../../build/release/cuda-sim/ptx_sim.o: /usr/include/endian.h +../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/endian.h +../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/sys/types.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/types.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/typesizes.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/time.h -../../build/release/cuda-sim/ptx_sim.o: /usr/include/endian.h -../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/endian.h -../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/sys/select.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/select.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/sigset.h @@ -513,6 +531,7 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/ptx_sim.o: /usr/include/zconf.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/unistd.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/posix_opt.h +../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/environments.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/bits/confname.h ../../build/release/cuda-sim/ptx_sim.o: /usr/include/getopt.h ../../build/release/cuda-sim/ptx_sim.o: ../gpgpu-sim/scoreboard.h @@ -530,13 +549,15 @@ $(OUTPUT_DIR)/lex.ptx_.o: ptx.tab.c ../../build/release/cuda-sim/ptx-stats.o: /usr/include/gnu/stubs-64.h ../../build/release/cuda-sim/ptx-stats.o: ptx.tab.h ptx_sim.h ../../build/release/cuda-sim/ptx-stats.o: /usr/include/stdlib.h +../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/waitflags.h +../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/waitstatus.h +../../build/release/cuda-sim/ptx-stats.o: /usr/include/endian.h +../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/endian.h +../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx-stats.o: /usr/include/sys/types.h ../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/types.h ../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/typesizes.h ../../build/release/cuda-sim/ptx-stats.o: /usr/include/time.h -../../build/release/cuda-sim/ptx-stats.o: /usr/include/endian.h -../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/endian.h -../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/byteswap.h ../../build/release/cuda-sim/ptx-stats.o: /usr/include/sys/select.h ../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/select.h ../../build/release/cuda-sim/ptx-stats.o: /usr/include/bits/sigset.h diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index d8c2c00..7d8d254 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -43,6 +43,7 @@ #include "ptx_loader.h" #include "ptx_parser.h" #include "../gpgpu-sim/gpu-sim.h" +#include "ptx_sim.h" #include "../gpgpusim_entrypoint.h" #include "decuda_pred_table/decuda_pred_table.h" #include "../stream_manager.h" diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc index 550a076..4537bd0 100644 --- a/src/cuda-sim/instructions.cc +++ b/src/cuda-sim/instructions.cc @@ -80,11 +80,12 @@ ptx_reg_t ptx_thread_info::get_reg( const symbol *reg ) const std::string &name = reg->name(); unsigned call_uid = m_callstack.back().m_call_uid; ptx_reg_t uninit_reg; - uninit_reg.u32 = 0xDEADBEEF; + uninit_reg.u32 = 0x0; set_reg(reg, uninit_reg); // give it a value since we are going to warn the user anyway std::string file_loc = get_location(); if( !unfound_register_warned ) { - printf("GPGPU-Sim PTX: WARNING (%s) ** reading undefined register \'%s\' (cuid:%u). Setting to 0XDEADBEEF.\n", + printf("GPGPU-Sim PTX: WARNING (%s) ** reading undefined register \'%s\' (cuid:%u). Setting to 0X00000000. This is okay if you are simulating the native ISA" + "\n", file_loc.c_str(), name.c_str(), call_uid ); unfound_register_warned = true; } @@ -818,13 +819,21 @@ void atom_callback( const inst_t* inst, ptx_thread_info* thread ) const operand_info &src2 = pI->src2(); // b // Get operand values - src1_data = thread->get_operand_value(src1, dst, to_type, thread, 1); // a - src2_data = thread->get_operand_value(src2, dst, to_type, thread, 1); // b + if (dst.get_symbol()->type()){ + src1_data = thread->get_operand_value(src1, dst, to_type, thread, 1); // a + src2_data = thread->get_operand_value(src2, dst, to_type, thread, 1); // b + } else { + //This is the case whent he first argument (dest) is '_' + src1_data = thread->get_operand_value(src1, src1, to_type, thread, 1); // a + src2_data = thread->get_operand_value(src2, src1, to_type, thread, 1); // b + } // Copy value pointed to in operand 'a' into register 'd' // (i.e. copy src1_data to dst) thread->get_global_memory()->read(src1_data.u32,size/8,&data.s64); - thread->set_operand_value(dst, data, to_type, thread, pI); // Write value into register 'd' + if (dst.get_symbol()->type()){ + thread->set_operand_value(dst, data, to_type, thread, pI); // Write value into register 'd' + } // Get the atomic operation to be performed unsigned m_atomic_spec = pI->get_atomic(); @@ -1080,7 +1089,12 @@ void atom_impl( const ptx_instruction *pI, ptx_thread_info *thread ) const operand_info &src1 = pI->src1(); const operand_info &dst = pI->dst(); unsigned i_type = pI->get_type(); - ptx_reg_t src1_data = thread->get_operand_value(src1, dst, i_type, thread, 1); + ptx_reg_t src1_data; + if (dst.get_symbol()->type()){ + src1_data = thread->get_operand_value(src1, dst, i_type, thread, 1); + } else { + src1_data = thread->get_operand_value(src1, src1, i_type, thread, 1); + } memory_space_t space = pI->get_space(); @@ -1944,10 +1958,10 @@ void ex2_impl( const ptx_instruction *pI, ptx_thread_info *thread ) } void exit_impl( const ptx_instruction *pI, ptx_thread_info *thread ) -{ +{ + thread->set_done(); thread->exitCore(); thread->registerExit(); - thread->set_done(); } void mad_def( const ptx_instruction *pI, ptx_thread_info *thread ); @@ -2755,9 +2769,9 @@ void ret_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { bool empty = thread->callstack_pop(); if( empty ) { + thread->set_done(); thread->exitCore(); thread->registerExit(); - thread->set_done(); } } @@ -2766,9 +2780,9 @@ void retp_impl( const ptx_instruction *pI, ptx_thread_info *thread ) { bool empty = thread->callstack_pop_plus(); if( empty ) { + thread->set_done(); thread->exitCore(); thread->registerExit(); - thread->set_done(); } } diff --git a/src/cuda-sim/ptx.l b/src/cuda-sim/ptx.l index 70d4c23..8c330fc 100644 --- a/src/cuda-sim/ptx.l +++ b/src/cuda-sim/ptx.l @@ -381,8 +381,9 @@ breakaddr TC; ptx_lval.int_value = BREAKADDR_OP; return OPCODE; [^\"]* TC; ptx_lval.string_value = strdup(yytext); } -<INITIAL,NOT_OPCODE>. TC; ptx_error((const char*)NULL); +<*>\t@@DWARF.*\n +<INITIAL,NOT_OPCODE>. TC; ptx_error((const char*)NULL); %% extern int g_error_detected; diff --git a/src/cuda-sim/ptx.y b/src/cuda-sim/ptx.y index f0b67fb..430fc00 100644 --- a/src/cuda-sim/ptx.y +++ b/src/cuda-sim/ptx.y @@ -476,7 +476,9 @@ operand: IDENTIFIER { add_scalar_operand( $1 ); } | tex_operand | IDENTIFIER PLUS INT_OPERAND { add_address_operand($1,$3); } | IDENTIFIER LO_OPTION { add_scalar_operand( $1 ); change_operand_lohi(1);} + | MINUS IDENTIFIER LO_OPTION { add_scalar_operand( $2 ); change_operand_lohi(1); change_operand_neg();} | IDENTIFIER HI_OPTION { add_scalar_operand( $1 ); change_operand_lohi(2);} + | MINUS IDENTIFIER HI_OPTION { add_scalar_operand( $2 ); change_operand_lohi(2); change_operand_neg();} | IDENTIFIER PIPE IDENTIFIER { add_2vector_operand($1,$3); change_double_operand_type(-1);} | IDENTIFIER PIPE IDENTIFIER LO_OPTION { add_2vector_operand($1,$3); change_double_operand_type(-1); change_operand_lohi(1);} | IDENTIFIER PIPE IDENTIFIER HI_OPTION { add_2vector_operand($1,$3); change_double_operand_type(-1); change_operand_lohi(2);} diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc index 61a357e..d3d87f7 100644 --- a/src/cuda-sim/ptx_loader.cc +++ b/src/cuda-sim/ptx_loader.cc @@ -29,6 +29,7 @@ #include "ptx_ir.h" #include "cuda-sim.h" #include "ptx_parser.h" +#include <unistd.h> #include <dirent.h> #include <fstream> @@ -45,7 +46,7 @@ bool g_override_embedded_ptx = false; extern "C" int ptx_parse(); extern "C" int ptx__scan_string(const char*); -const char *g_ptxinfo_filename = NULL; +extern "C" const char *g_ptxinfo_filename = NULL; extern "C" int ptxinfo_parse(); extern "C" int ptxinfo_debug; extern "C" FILE *ptxinfo_in; @@ -89,8 +90,9 @@ void print_ptx_file( const char *p, unsigned source_num, const char *filename ) fflush(stdout); } -char* gpgpu_ptx_sim_convert_ptx_to_ptxplus(const char *ptx_str, const char *cubin_str, unsigned source_num, bool save_converted ) +char* gpgpu_ptx_sim_convert_ptx_to_ptxplus(const char *ptx_str, const char *cubin_str, unsigned source_num, bool save_converted, bool cuobjdump) { + printf("GPGPU-Sim PTX: converting EMBEDDED .ptx file to ptxplus \n"); // Extract ptx to a file @@ -104,49 +106,60 @@ char* gpgpu_ptx_sim_convert_ptx_to_ptxplus(const char *ptx_str, const char *cubi fprintf(ptxfile,"%s",ptx_str); fclose(ptxfile); - // Extract cubin to a file - char fname_cubin[1024]; - snprintf(fname_cubin,1024,"_cubin_XXXXXX"); - int fd2=mkstemp(fname_cubin); - close(fd2); - - printf("GPGPU-Sim PTX: extracting embedded cubin to temporary file \"%s\"\n", fname_cubin); - FILE *cubinfile = fopen(fname_cubin,"w"); - fprintf(cubinfile,"%s",cubin_str); - fclose(cubinfile); + char fname_ptxplus[1024]; + snprintf(fname_ptxplus,1024,"_ptxplus_XXXXXX"); + int fd4=mkstemp(fname_ptxplus); + close(fd4); - // Run decuda + // Extract cubin to a file char fname_decuda[1024]; - snprintf(fname_decuda,1024,"_decuda_XXXXXX"); - int fd3=mkstemp(fname_decuda); - close(fd3); + char fname_cubin[1024]; + if( !cuobjdump){ - char decuda_commandline[1024]; - snprintf(decuda_commandline,1024,"$DECUDA_INSTALL_PATH/decuda.py -o %s %s", fname_decuda, fname_cubin); + snprintf(fname_cubin,1024,"_cubin_XXXXXX"); + int fd2=mkstemp(fname_cubin); + close(fd2); - printf("GPGPU-Sim PTX: calling decuda on cubin file, decuda output file = \"%s\"\n", fname_decuda); - int decuda_result = system(decuda_commandline); - if( decuda_result != 0 ) { - printf("GPGPU-Sim PTX: ERROR ** while calling decuda (b) %d\n", decuda_result); - printf(" Ensure env variable DECUDA_INSTALL_PATH is set and points to decuda base directory.\n"); - exit(1); - } + printf("GPGPU-Sim PTX: extracting embedded cubin to temporary file \"%s\"\n", fname_cubin); + FILE *cubinfile = fopen(fname_cubin,"w"); + fprintf(cubinfile,"%s",cubin_str); + fclose(cubinfile); - // Run decuda_to_ptxplus - char fname_ptxplus[1024]; - snprintf(fname_ptxplus,1024,"_ptxplus_XXXXXX"); - int fd4=mkstemp(fname_ptxplus); - close(fd4); - char d2pp_commandline[1024]; - snprintf(d2pp_commandline,1024,"$D2PP_INSTALL_PATH/decuda_to_ptxplus %s %s %s %s > /dev/null", fname_decuda, fname_ptx, fname_cubin, fname_ptxplus); + snprintf(fname_decuda,1024,"_decuda_XXXXXX"); + int fd3=mkstemp(fname_decuda); + close(fd3); - printf("GPGPU-Sim PTX: calling decuda_to_ptxplus, ptxplus output file = \"%s\"\n", fname_ptxplus); - int d2pp_result = system(d2pp_commandline); - if( d2pp_result != 0 ) { - printf("GPGPU-Sim PTX: ERROR ** while calling decuda_to_ptxplus %d\n", d2pp_result); - printf(" Ensure env variable D2PP_INSTALL_PATH is set and points to decuda_to_ptxplus base directory.\n"); - exit(1); + // Run decuda + char decuda_commandline[1024]; + snprintf(decuda_commandline,1024,"$DECUDA_INSTALL_PATH/decuda.py -o %s %s", fname_decuda, fname_cubin); + printf("GPGPU-Sim PTX: calling decuda on cubin file, decuda output file = \"%s\"\n", fname_decuda); + int decuda_result = system(decuda_commandline); + if( decuda_result != 0 ) { + printf("GPGPU-Sim PTX: ERROR ** while calling decuda (b) %d\n", decuda_result); + printf(" Ensure env variable DECUDA_INSTALL_PATH is set and points to decuda base directory.\n"); + exit(1); + } + // Run decuda_to_ptxplus + char d2pp_commandline[1024]; + snprintf(d2pp_commandline,1024,"$D2PP_INSTALL_PATH/decuda_to_ptxplus %s %s %s %s > /dev/null", fname_decuda, fname_ptx, fname_cubin, fname_ptxplus); + printf("GPGPU-Sim PTX: calling decuda_to_ptxplus, ptxplus output file = \"%s\"\n", fname_ptxplus); + int d2pp_result = system(d2pp_commandline); + if( d2pp_result != 0 ) { + printf("GPGPU-Sim PTX: ERROR ** while calling decuda_to_ptxplus %d\n", d2pp_result); + printf(" Ensure env variable D2PP_INSTALL_PATH is set and points to decuda_to_ptxplus base directory.\n"); + exit(1); + } + } + else { + // Run cuobjdump_to_ptxplus + char commandline[1024]; + int result; + snprintf(commandline, 1024, "$GPGPUSIM_ROOT/cuobjdump_to_ptxplus/cuobjdump_to_ptxplus /proc/%d/exe %s", getpid(), fname_ptxplus); + fflush(stdout); + printf("GPGPU-Sim PTX: calling cuobjdump_to_ptxplus on exe file, output file = \"%s\"\n", fname_ptxplus); + result = system(commandline); + if(result){printf("GPGPU-Sim PTX: ERROR ** could not execute %s\n", commandline); exit(1);} } // Get ptxplus from file @@ -173,7 +186,12 @@ char* gpgpu_ptx_sim_convert_ptx_to_ptxplus(const char *ptx_str, const char *cubi // Remove temporary files char rm_commandline[1024]; - snprintf(rm_commandline,1024,"rm -f %s %s %s %s", fname_ptx, fname_cubin, fname_decuda, fname_ptxplus); + if (!cuobjdump) { + snprintf(rm_commandline,1024,"rm -f %s %s %s %s", fname_ptx, fname_cubin, fname_decuda, fname_ptxplus); + } + else { + snprintf(rm_commandline,1024,"rm -f %s %s", fname_ptx, fname_ptxplus); + } printf("GPGPU-Sim PTX: removing temporary files using \"%s\"\n", rm_commandline); int rm_result = system(rm_commandline); if( rm_result != 0 ) { @@ -186,6 +204,92 @@ char* gpgpu_ptx_sim_convert_ptx_to_ptxplus(const char *ptx_str, const char *cubi return ptxplus_str; } +char* gpgpu_ptx_sim_convert_ptx_and_sass_to_ptxplus(const char *ptxfilename, const char *elffilename, const char *sassfilename) +{ + + printf("GPGPU-Sim PTX: converting EMBEDDED .ptx file to ptxplus \n"); + +/* + // Extract ptx to a file + char fname_ptx[1024]; + snprintf(fname_ptx,1024,"_ptx_XXXXXX"); + int fd1=mkstemp(fname_ptx); + close(fd1); + + printf("GPGPU-Sim PTX: extracting embedded .ptx to temporary file \"%s\"\n", fname_ptx); + FILE *ptxfile = fopen(fname_ptx,"w"); + fprintf(ptxfile,"%s",ptx_str); + fclose(ptxfile); + + char fname_sass[1024]; + snprintf(fname_sass,1024,"_sass_XXXXXX"); + int fd2=mkstemp(fname_sass); + close(fd2); + + printf("GPGPU-Sim PTX: extracting .sass to temporary file \"%s\"\n", fname_sass); + FILE *sassfile = fopen(fname_sass,"w"); + fprintf(sassfile,"%s",sass_str); + fclose(sassfile); + + char fname_elf[1024]; + snprintf(fname_elf,1024,"_elf_XXXXXX"); + int fd3=mkstemp(fname_elf); + close(fd3); + + printf("GPGPU-Sim PTX: extracting .elf to temporary file \"%s\"\n", fname_elf); + FILE *elffile = fopen(fname_elf,"w"); + fprintf(elffile,"%s",elf_str); + fclose(elffile); +*/ + char fname_ptxplus[1024]; + snprintf(fname_ptxplus,1024,"_ptxplus_XXXXXX"); + int fd4=mkstemp(fname_ptxplus); + close(fd4); + + // Extract cubin to a file + char fname_decuda[1024]; + char fname_cubin[1024]; + + + // Run cuobjdump_to_ptxplus + char commandline[1024]; + int result; + snprintf(commandline, 1024, "$GPGPUSIM_ROOT/cuobjdump_to_ptxplus/cuobjdump_to_ptxplus %s %s %s %s", ptxfilename, sassfilename, elffilename, fname_ptxplus); + fflush(stdout); + printf("GPGPU-Sim PTX: calling cuobjdump_to_ptxplus\ncommandline: %s\n", commandline); + result = system(commandline); + if(result){printf("GPGPU-Sim PTX: ERROR ** could not execute %s\n", commandline); exit(1);} + + + // Get ptxplus from file + std::ifstream fileStream(fname_ptxplus, std::ios::in); + std::string text, line; + while(getline(fileStream,line)) { + text += (line + "\n"); + } + fileStream.close(); + + char* ptxplus_str = new char [strlen(text.c_str())+1]; + strcpy(ptxplus_str, text.c_str()); + + // Remove temporary files + /* + char rm_commandline[1024]; + + snprintf(rm_commandline,1024,"rm -f %s", fname_ptxplus); + + printf("GPGPU-Sim PTX: removing temporary files using \"%s\"\n", rm_commandline); + int rm_result = system(rm_commandline); + if( rm_result != 0 ) { + printf("GPGPU-Sim PTX: ERROR ** while removing temporary files %d\n", rm_result); + exit(1); + } + */ + printf("GPGPU-Sim PTX: DONE converting EMBEDDED .ptx file to ptxplus \n"); + + return ptxplus_str; +} + symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source_num ) { @@ -237,6 +341,7 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num close(fd); char commandline2[4096]; snprintf(commandline2,4096,"cat %s | sed 's/.version 1.5/.version 1.4/' | sed 's/, texmode_independent//' | sed 's/\\(\\.extern \\.const\\[1\\] .b8 \\w\\+\\)\\[\\]/\\1\\[1\\]/' | sed 's/const\\[.\\]/const\\[0\\]/g' > %s", fname, fname2); + printf("Running: %s\n", commandline2); int result = system(commandline2); if( result != 0 ) { printf("GPGPU-Sim PTX: ERROR ** while loading PTX (a) %d\n", result); @@ -252,10 +357,10 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num extra_flags[0]=0; #if CUDART_VERSION >= 3000 - snprintf(extra_flags,1024,"--gpu-name=sm_20"); + snprintf(extra_flags,1024,"--gpu-name=sm_13"); #endif - snprintf(commandline,1024,"ptxas %s -v %s --output-file /dev/null 2> %s", + snprintf(commandline,1024,"ptxas %s -v %s --output-file /dev/null 2> %s", extra_flags, fname2, tempfile_ptxinfo); printf("GPGPU-Sim PTX: generating ptxinfo using \"%s\"\n", commandline); result = system(commandline); diff --git a/src/cuda-sim/ptx_loader.h b/src/cuda-sim/ptx_loader.h index 0266755..aa98a91 100644 --- a/src/cuda-sim/ptx_loader.h +++ b/src/cuda-sim/ptx_loader.h @@ -32,6 +32,7 @@ extern bool g_override_embedded_ptx; class symbol_table *gpgpu_ptx_sim_load_ptx_from_string( const char *p, unsigned source_num ); void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num ); -char* gpgpu_ptx_sim_convert_ptx_to_ptxplus(const char *ptx_str, const char *cubin_str, unsigned source_num, bool save_converted ); +char* gpgpu_ptx_sim_convert_ptx_to_ptxplus(const char *ptx_str, const char *cubin_str, unsigned source_num, bool save_converted, bool cuobjdump ); +char* gpgpu_ptx_sim_convert_ptx_and_sass_to_ptxplus(const char *ptx_str, const char *sass_str, const char *elf_str); #endif diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc index 3db984d..308405a 100644 --- a/src/cuda-sim/ptx_parser.cc +++ b/src/cuda-sim/ptx_parser.cc @@ -43,6 +43,7 @@ const char *g_filename; unsigned g_max_regs_per_thread = 0; // the program intermediate representation... +static symbol_table *g_global_allfiles_symbol_table = NULL; static symbol_table *g_global_symbol_table = NULL; std::map<std::string,symbol_table*> g_sym_name_to_symbol_table; static symbol_table *g_current_symbol_table = NULL; @@ -105,7 +106,13 @@ void read_parser_environment_variables() symbol_table *init_parser( const char *ptx_filename ) { g_filename = strdup(ptx_filename); - g_global_symbol_table = g_current_symbol_table = new symbol_table("global",0,NULL); + if (g_global_allfiles_symbol_table == NULL) { + g_global_allfiles_symbol_table = new symbol_table("global_allfiles", 0, NULL); + g_global_symbol_table = g_current_symbol_table = g_global_allfiles_symbol_table; + } + else { + g_global_symbol_table = g_current_symbol_table = new symbol_table("global",0,g_global_allfiles_symbol_table); + } ptx_lineno = 1; #define DEF(X,Y) g_ptx_token_decode[X] = Y; @@ -767,7 +774,7 @@ void add_scalar_operand( const char *identifier ) DPRINTF("add_scalar_operand"); const symbol *s = g_current_symbol_table->lookup(identifier); if ( s == NULL ) { - if ( g_opcode == BRA_OP || g_opcode == CALLP_OP || g_opcode == BREAKADDR_OP) { + if ( g_opcode == BRA_OP || g_opcode == CALLP_OP) { // forward branch target... s = g_current_symbol_table->add_variable(identifier,NULL,0,g_filename,ptx_lineno); } else { diff --git a/src/gpgpu-sim/dram.cc b/src/gpgpu-sim/dram.cc index 104ec66..c073f0d 100644 --- a/src/gpgpu-sim/dram.cc +++ b/src/gpgpu-sim/dram.cc @@ -56,13 +56,24 @@ dram_t::dram_t( unsigned int partition_id, const struct memory_config *config, m rw = READ; //read mode is default + bkgrp = (bankgrp_t**) calloc(sizeof(bankgrp_t*), m_config->nbkgrp); + bkgrp[0] = (bankgrp_t*) calloc(sizeof(bank_t), m_config->nbkgrp); + for (unsigned i=1; i<m_config->nbkgrp; i++) { + bkgrp[i] = bkgrp[0] + i; + } + for (unsigned i=0; i<m_config->nbkgrp; i++) { + bkgrp[i]->CCDLc = 0; + bkgrp[i]->RTPLc = 0; + } + bk = (bank_t**) calloc(sizeof(bank_t*),m_config->nbk); bk[0] = (bank_t*) calloc(sizeof(bank_t),m_config->nbk); for (unsigned i=1;i<m_config->nbk;i++) bk[i] = bk[0] + i; - for (unsigned i=0;i<m_config->nbk;i++) + for (unsigned i=0;i<m_config->nbk;i++) { bk[i]->state = BANK_IDLE; - + bk[i]->bkgrpindex = i/(m_config->nbk/m_config->nbkgrp); + } prio = 0; rwq = new fifo_pipeline<dram_req_t>("rwq",m_config->CL,m_config->CL+1); mrqq = new fifo_pipeline<dram_req_t>("mrqq",0,2); @@ -248,10 +259,12 @@ void dram_t::cycle() // check if any bank is ready to issue a new read for (unsigned i=0;i<m_config->nbk;i++) { unsigned j = (i + prio) % m_config->nbk; + unsigned grp = j>>m_config->bk_tag_length; if (bk[j]->mrq) { //if currently servicing a memory request bk[j]->mrq->data->set_status(IN_PARTITION_DRAM,gpu_sim_cycle+gpu_tot_sim_cycle); // correct row activated for a READ if ( !issued && !CCDc && !bk[j]->RCDc && + !(bkgrp[grp]->CCDLc) && (bk[j]->curr_row == bk[j]->mrq->row) && (bk[j]->mrq->rw == READ) && (WTRc == 0 ) && (bk[j]->state == BANK_ACTIVE) && @@ -263,8 +276,10 @@ void dram_t::cycle() rwq->push(bk[j]->mrq); bk[j]->mrq->txbytes += m_config->BL * m_config->busW * m_config->gpu_n_mem_per_ctrlr; //16 bytes CCDc = m_config->tCCD; + bkgrp[grp]->CCDLc = m_config->tCCDL; RTWc = m_config->tRTW; bk[j]->RTPc = m_config->BL/2; + bkgrp[grp]->RTPLc = m_config->tRTPL; issued = true; n_rd++; bwutil+= m_config->BL/2; @@ -283,6 +298,7 @@ void dram_t::cycle() } else // correct row activated for a WRITE if ( !issued && !CCDc && !bk[j]->RCDWRc && + !(bkgrp[grp]->CCDLc) && (bk[j]->curr_row == bk[j]->mrq->row) && (bk[j]->mrq->rw == WRITE) && (RTWc == 0 ) && (bk[j]->state == BANK_ACTIVE) && @@ -295,6 +311,7 @@ void dram_t::cycle() bk[j]->mrq->txbytes += m_config->BL * m_config->busW * m_config->gpu_n_mem_per_ctrlr; /*16 bytes*/ CCDc = m_config->tCCD; + bkgrp[grp]->CCDLc = m_config->tCCDL; WTRc = m_config->tWTR; bk[j]->WTPc = m_config->tWTP; issued = true; @@ -342,7 +359,9 @@ void dram_t::cycle() if ( (!issued) && (bk[j]->curr_row != bk[j]->mrq->row) && (bk[j]->state == BANK_ACTIVE) && - (!bk[j]->RASc && !bk[j]->WTPc && !bk[j]->RTPc) ) { + (!bk[j]->RASc && !bk[j]->WTPc && + !bk[j]->RTPc && + !bkgrp[grp]->RTPLc) ) { // make the bank idle again bk[j]->state = BANK_IDLE; bk[j]->RPc = m_config->tRP; @@ -389,6 +408,10 @@ void dram_t::cycle() DEC2ZERO(bk[j]->WTPc); DEC2ZERO(bk[j]->RTPc); } + for (unsigned j=0; j<m_config->nbkgrp; j++) { + DEC2ZERO(bkgrp[j]->CCDLc); + DEC2ZERO(bkgrp[j]->RTPLc); + } #ifdef DRAM_VISUALIZE visualize(); diff --git a/src/gpgpu-sim/dram.h b/src/gpgpu-sim/dram.h index 96b912b..ad773b3 100644 --- a/src/gpgpu-sim/dram.h +++ b/src/gpgpu-sim/dram.h @@ -58,6 +58,12 @@ public: class mem_fetch * data; }; +struct bankgrp_t +{ + unsigned int CCDLc; + unsigned int RTPLc; +}; + struct bank_t { unsigned int RCDc; @@ -77,6 +83,8 @@ struct bank_t unsigned int n_access; unsigned int n_writes; unsigned int n_idle; + + unsigned int bkgrpindex; }; struct mem_fetch; @@ -110,6 +118,8 @@ private: const struct memory_config *m_config; + bankgrp_t **bkgrp; + bank_t **bk; unsigned int prio; diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 51b832c..e71818b 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -123,8 +123,8 @@ void memory_config::reg_options(class OptionParser * opp) "Burst length of each DRAM request (default = 4 DDR cycle)", "4"); option_parser_register(opp, "-gpgpu_dram_timing_opt", OPT_CSTR, &gpgpu_dram_timing_opt, - "DRAM timing parameters = {nbk:tCCD:tRRD:tRCD:tRAS:tRP:tRC:CL:WL:tCDLR:tWR}", - "4:2:8:12:21:13:34:9:4:5:13"); + "DRAM timing parameters = {nbk:nbkgrp:tCCD:tCCDL:tRRD:tRCD:tRAS:tRP:tRTPL:tRC:CL:WL:tCDLR:tWR}", + "4:1:2:0:8:12:21:13:0:34:9:4:5:13"); option_parser_register(opp, "-rop_latency", OPT_UINT32, &rop_latency, "ROP queue latency (default 85)", "85"); diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h index 31def4b..fe66d04 100644 --- a/src/gpgpu-sim/gpu-sim.h +++ b/src/gpgpu-sim/gpu-sim.h @@ -72,8 +72,14 @@ struct memory_config { void init() { assert(gpgpu_dram_timing_opt); - sscanf(gpgpu_dram_timing_opt,"%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d", - &nbk,&tCCD,&tRRD,&tRCD,&tRAS,&tRP,&tRC,&CL,&WL,&tCDLR,&tWR); + sscanf(gpgpu_dram_timing_opt,"%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d", + &nbk,&nbkgrp,&tCCD,&tCCDL,&tRRD,&tRCD,&tRAS,&tRP,&tRTPL,&tRC,&CL,&WL,&tCDLR,&tWR); + int nbkt = nbk/nbkgrp; + unsigned i; + for (i=0; nbkt>0; i++) { + nbkt = nbkt>>1; + } + bk_tag_length = i; tRCDWR = tRCD-(WL+1); tRTW = (CL+(BL/2)+2-WL); tWTR = (WL+(BL/2)+tCDLR); @@ -101,6 +107,10 @@ struct memory_config { unsigned dram_latency; // DRAM parameters + + unsigned tCCDL; //column to column delay when bank groups are enabled + unsigned tRTPL; //read to precharge delay when bank groups are enabled for GDDR5 this is identical to RTPS, if for other DRAM this is different, you will need to split them in two + unsigned tCCD; //column to column delay unsigned tRRD; //minimal time required between activation of rows in different banks unsigned tRCD; //row to column delay - time required to activate a row before a read @@ -119,6 +129,9 @@ struct memory_config { unsigned tWTP; //time to switch from write to precharge in the same bank unsigned busW; + unsigned nbkgrp; // number of bank groups (has to be power of 2) + unsigned bk_tag_length; //number of bits that define a bank inside a bank group + unsigned nbk; linear_to_raw_address_translation m_address_mapping; @@ -237,7 +250,7 @@ public: const gpgpu_sim_config &get_config() const { return m_config; } void gpu_print_stat() const; void dump_pipeline( int mask, int s, int m ) const; - + //The next three functions added to be used by the functional simulation function //! Get shader core configuration @@ -270,6 +283,7 @@ private: void shader_print_runtime_stat( FILE *fout ); void shader_print_l1_miss_stat( FILE *fout ) const; void visualizer_printstat(); + void print_shader_cycle_distro( FILE *fout ) const; void gpgpu_debug(); @@ -311,7 +325,7 @@ public: unsigned long long gpu_sim_insn; unsigned long long gpu_tot_sim_insn; unsigned long long gpu_sim_insn_last_update; - unsigned gpu_sim_insn_last_update_sid; + unsigned gpu_sim_insn_last_update_sid; }; #endif diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc index 4c90667..527fdcb 100644 --- a/src/gpgpu-sim/shader.cc +++ b/src/gpgpu-sim/shader.cc @@ -1736,7 +1736,22 @@ void barrier_set_t::dump() const void shader_core_ctx::warp_exit( unsigned warp_id ) { - m_barriers.warp_exit( warp_id ); + bool done = true; + for ( unsigned i = warp_id*get_config()->warp_size; + i < (warp_id+1)*get_config()->warp_size; + i++ ) { + +// if(this->m_thread[i]->m_functional_model_thread_state && this->m_thread[i].m_functional_model_thread_state->donecycle()==0) { +// done = false; +// } + + + if (m_thread[i] && !m_thread[i]->is_done()) done = false; + } + //if (m_warp[warp_id].get_n_completed() == get_config()->warp_size) + //if (this->m_simt_stack[warp_id]->get_num_entries() == 0) + if (done) + m_barriers.warp_exit( warp_id ); } bool shader_core_ctx::warp_waiting_at_barrier( unsigned warp_id ) const diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc index e18b088..add9a22 100644 --- a/src/gpgpusim_entrypoint.cc +++ b/src/gpgpusim_entrypoint.cc @@ -238,15 +238,8 @@ int gpgpu_opencl_ptx_sim_main_perf( kernel_info_t *grid ) return 0; } -//! Functional simulation of OpenCL -/*! - * This function call the CUDA PTX functional simulator - */ int gpgpu_opencl_ptx_sim_main_func( kernel_info_t *grid ) { - //calling the CUDA PTX simulator, sending the kernel by reference and a flag set to true, - //the flag used by the function to distinguish OpenCL calls from the CUDA simulation calls which - //it is needed by the called function to not register the exit the exit of OpenCL kernel as it doesn't register entering in the first place as the CUDA kernels does - gpgpu_cuda_ptx_sim_main_func( *grid, true ); - return 0; + printf("GPGPU-Sim PTX API: OpenCL functional-only simulation not yet implemented (use performance simulation)\n"); + exit(1); } |
