summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Rogers <[email protected]>2013-02-22 21:31:31 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:50:05 -0700
commit1f421f9fd3f576880d21483aed369576b08143d1 (patch)
tree86598d0b654339632021e658e5064bc38c010306 /src
parent7a90f721b00a6f0a9bbac5f63b374932fc780b5b (diff)
Fixed at least one error in the valgrind build. Forgot to initial a member variable.
I thought the init() function where dynamic_warp_id is initialized was called on construction. It is not. Added a default value in the constructor. Maybe a code review would have caught this :) Also cleaned up some weird code I had in the ptx_instruction::to_string(). Also trimmed out tabs from our stored source line string so it is much more readable on print [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 15310]
Diffstat (limited to 'src')
-rw-r--r--src/cuda-sim/ptx_ir.cc27
-rw-r--r--src/gpgpu-sim/shader.cc1
-rw-r--r--src/gpgpu-sim/shader.h1
3 files changed, 14 insertions, 15 deletions
diff --git a/src/cuda-sim/ptx_ir.cc b/src/cuda-sim/ptx_ir.cc
index 678febf..242901b 100644
--- a/src/cuda-sim/ptx_ir.cc
+++ b/src/cuda-sim/ptx_ir.cc
@@ -1183,6 +1183,8 @@ ptx_instruction::ptx_instruction( int opcode,
m_source_file = file?file:"<unknown>";
m_source_line = line;
m_source = source;
+ // Trim tabs
+ m_source.erase( std::remove( m_source.begin(), m_source.end(), '\t' ), m_source.end() );
if (opcode == CALL_OP) {
const operand_info &target = func_addr();
@@ -1211,21 +1213,18 @@ void ptx_instruction::print_insn( FILE *fp ) const
std::string ptx_instruction::to_string() const
{
- std::string result( m_source );
- unsigned semi_c_pos = result.find(";");
- assert( semi_c_pos != std::string::npos );
+ char buf[ STR_SIZE ];
+ unsigned used_bytes = 0;
if( !is_label() ) {
- char buf[ STR_SIZE ];
- buf[ STR_SIZE - 1 ] = '\0';
- snprintf( buf, STR_SIZE, " PC=0x%03x ", m_PC );
- result += std::string( buf );
- } else
- result += std::string(" ");
- char buf[STR_SIZE];
- buf[STR_SIZE - 1] = '\0';
- snprintf( buf, STR_SIZE,
- "(%s:%d) %s", m_source_file.c_str(), m_source_line, m_source.c_str() + semi_c_pos );
- return result;
+ used_bytes += snprintf( buf + used_bytes, STR_SIZE - used_bytes, " PC=0x%03x ", m_PC );
+ } else {
+ used_bytes += snprintf( buf + used_bytes, STR_SIZE - used_bytes, " " );
+ }
+ used_bytes += snprintf( buf + used_bytes, STR_SIZE - used_bytes,
+ "(%s:%d) %s",
+ m_source_file.c_str(), m_source_line,
+ m_source.c_str() );
+ return std::string( buf );
}
unsigned function_info::sm_next_uid = 1;
diff --git a/src/gpgpu-sim/shader.cc b/src/gpgpu-sim/shader.cc
index 9d974db..797ebc0 100644
--- a/src/gpgpu-sim/shader.cc
+++ b/src/gpgpu-sim/shader.cc
@@ -786,7 +786,6 @@ void scheduler_unit::order_by_priority( std::vector< T >& result_list,
result_list.clear();
typename std::vector< T > temp = input_list;
-
if ( ORDERING_GREEDY_THEN_PRIORITY_FUNC == ordering ) {
T greedy_value = *last_issued_from_input;
result_list.push_back( greedy_value );
diff --git a/src/gpgpu-sim/shader.h b/src/gpgpu-sim/shader.h
index 952651e..fd1cb88 100644
--- a/src/gpgpu-sim/shader.h
+++ b/src/gpgpu-sim/shader.h
@@ -101,6 +101,7 @@ public:
assert( m_inst_in_pipeline==0);
m_imiss_pending=false;
m_warp_id=(unsigned)-1;
+ m_dynamic_warp_id = (unsigned)-1;
n_completed = m_warp_size;
m_n_atomic=0;
m_membar=false;