Skip to content

Commit

Permalink
bug fixes for ifmap and ofmap stalls
Browse files Browse the repository at this point in the history
  • Loading branch information
ritikraj7 committed Sep 30, 2024
1 parent 498cff4 commit d78b477
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scalesim/memory/double_buffered_scratchpad_mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def service_memory_requests(self, ifmap_demand_mat, filter_demand_mat, ofmap_dem
ofmap_cycle_out = self.ofmap_buf.service_writes(incoming_requests_arr_np=ofmap_demand_line,
incoming_cycles_arr_np=cycle_arr)
ofmap_serviced_cycles += [ofmap_cycle_out[0]]
ofmap_stalls = ofmap_cycle_out[0] - cycle_arr[0] - 1
ofmap_stalls = ofmap_cycle_out[0] - cycle_arr[0]

self.stall_cycles += int(max(ifmap_stalls[0], filter_stalls[0], ofmap_stalls[0]))

Expand Down
5 changes: 4 additions & 1 deletion scalesim/memory/read_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ def service_reads(self, incoming_requests_arr_np, # 2D array with the requests
self.new_prefetch()
potential_stall_cycles = self.last_prefect_cycle - (cycle + offset)
offset += potential_stall_cycles # Offset increments if there were potential stalls
if potential_stall_cycles > 0:
offset += potential_stall_cycles


out_cycles = cycle + offset
out_cycles_arr.append(out_cycles)
Expand Down Expand Up @@ -382,7 +385,7 @@ def new_prefetch(self):
if requested_data_size > self.active_buf_size:
self.next_line_prefetch_idx = num_lines % self.fetch_matrix.shape[0]
else:
self.next_line_prefetch_idx = (num_lines + 1) % self.fetch_matrix.shape[1]
self.next_line_prefetch_idx = (num_lines + 1) % self.fetch_matrix.shape[0]

# This does not need to return anything

Expand Down

0 comments on commit d78b477

Please sign in to comment.