From 7ad6e1907a896d5ae24322807cd36ea9c3153619 Mon Sep 17 00:00:00 2001 From: Ammar Ratnani Date: Mon, 27 Mar 2023 22:39:36 -0400 Subject: [PATCH] Fix unneeded read in `trace_parser` The `parse_from_string` method in `trace_parser.cc` currently reads in one delta for each active thread. However, `tracer_tool.cu` does not write the delta for the first thread since it will always be zero. This commit updates the behavior of `trace_parser` to match the intended trace format. Even though this bug was present, it had no effect in the past since the `base_delta_decompress` function is correct. --- gpu-simulator/trace-parser/trace_parser.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gpu-simulator/trace-parser/trace_parser.cc b/gpu-simulator/trace-parser/trace_parser.cc index 6b2b59557..e48c299de 100644 --- a/gpu-simulator/trace-parser/trace_parser.cc +++ b/gpu-simulator/trace-parser/trace_parser.cc @@ -201,15 +201,22 @@ bool inst_trace_t::parse_from_string(std::string trace, unsigned long long base_address = 0; std::vector deltas; // read addresses as base address and deltas + // remember that the first active processor doesn't have a delta - it + // corresponds to the base address + bool first_bit1_found = false; ss >> std::hex >> base_address; for (int s = 0; s < WARP_SIZE; s++) { if (mask_bits.test(s)) { - long long delta = 0; - ss >> std::dec >> delta; - deltas.push_back(delta); + if(!first_bit1_found) { + first_bit1_found = true; + continue; + } else { + long long delta = 0; + ss >> std::dec >> delta; + deltas.push_back(delta); + } } } - memadd_info->base_delta_decompress(base_address, deltas, mask_bits); } } // Finish Parsing