Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code issues in read_buffer.py #82

Open
Mo-guan opened this issue Nov 27, 2023 · 1 comment
Open

Code issues in read_buffer.py #82

Mo-guan opened this issue Nov 27, 2023 · 1 comment
Labels
question Further information is requested

Comments

@Mo-guan
Copy link

Mo-guan commented Nov 27, 2023

In line 334-337 of read_buffer.py,

        start_idx = self.next_line_prefetch_idx
        num_lines = math.ceil(self.prefetch_buf_size / self.req_gen_bandwidth)
        end_idx = start_idx + num_lines
        requested_data_size = num_lines * self.req_gen_bandwidth

requested_data_size is computed based on self.prefetch_buf_size, then in line 360-364,

        if requested_data_size > self.active_buf_size:
            valid_cols = int(self.active_buf_size % self.req_gen_bandwidth)
            row = prefetch_requests.shape[0] - 1
            for col in range(valid_cols, self.req_gen_bandwidth):
                prefetch_requests[row][col] = -1

it is compared to the self.active_buf_size, and due to the significant difference in buffer capacity, the code seems to be useless, maybe requested_data_size should be compared with self.prefetch_buf_size considering self.next_col_prefetch_idx

@ExcitingYi
Copy link

ExcitingYi commented Dec 7, 2023

I also think there's something wrong. Strictly, the requested_data cannot be larger than prefetch_buf_size. Also, self.next_col_prefetch_idx should be updated in the func. Besides, the code in the following lines

        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]

seems to be wrong. I think it should be

        if requested_data_size > self.active_buf_size:
            self.next_line_prefetch_idx = (self.next_line_prefetch_idx + num_lines) % self.fetch_matrix.shape[0]
        else:
            self.next_line_prefetch_idx = (self.next_line_prefetch_idx + num_lines + 1) % self.fetch_matrix.shape[0]

But they don't affect the results. I think we don't need to care about the "fake data" from DRAM. As the stall cycle is decided by hashed_buf (whether the addr in buf) and num_lines (the size of prefetched buf).

@AnandS09 AnandS09 added the question Further information is requested label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants