Hello,
I have a question regarding the calculation the next_line_prefetch_idx in read_buffer.py.
The relevant code block from lines 309-312 (def prefetch_active_buffer(self, start_cycle)) of read_buffer.py is as following:
if requested_data_size > self.active_buf_size: # Set the line to be prefetched next
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[0]
To enhance the correctness of the logic, I suggest the following modification:
if requested_data_size > self.active_buf_size: # Set the line to be prefetched next
self.next_line_prefetch_idx = (num_lines - 1) % self.fetch_matrix.shape[0]
else:
self.next_line_prefetch_idx = num_lines % self.fetch_matrix.shape[0]
The reason for this modification is as follows: The row indices for fetch_matrix start from 0. When requested_data_size > self.active_buf_size, it indicates that the last line of the current prefetch requests(prefetch_requests[num_lines-1]) cannot be entirely accommodated within active_buf. Therefore, self.next_line_prefetch_idx is set to (num_lines-1) % self.fetch_matrix.shape[0], which starts from prefetch_requests[num_lines-1].
Similarly, when requested_data_size <= self.active_buf_size, it suggests that the last line of the current prefetch requests(prefetch_requests[num_lines-1]) can fit entirely within active_buf. Hence, self.next_line_prefetch_idx is set to num_lines % self.fetch_matrix.shape[0], which starts from prefetch_requests[num_lines].
Looking forward to your feedback and suggestions.
Thank you.
Hello,
I have a question regarding the calculation the next_line_prefetch_idx in read_buffer.py.
The relevant code block from
lines 309-312 (def prefetch_active_buffer(self, start_cycle))of read_buffer.py is as following:To enhance the correctness of the logic, I suggest the following modification:
The reason for this modification is as follows: The row indices for
fetch_matrixstart from 0. Whenrequested_data_size > self.active_buf_size, it indicates that the last line of the current prefetch requests(prefetch_requests[num_lines-1]) cannot be entirely accommodated withinactive_buf. Therefore,self.next_line_prefetch_idxis set to(num_lines-1) % self.fetch_matrix.shape[0], which starts fromprefetch_requests[num_lines-1].Similarly, when
requested_data_size <= self.active_buf_size, it suggests that the last line of the current prefetch requests(prefetch_requests[num_lines-1]) can fit entirely withinactive_buf. Hence,self.next_line_prefetch_idxis set tonum_lines % self.fetch_matrix.shape[0], which starts fromprefetch_requests[num_lines].Looking forward to your feedback and suggestions.
Thank you.