add dynamic in scalesim#159
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional “dynamic IFMAP/FILTER SRAM bank allocation” mode to Scale-Sim’s memory system, exposing the toggle via config and surfacing the final bank split in the compute report output.
Changes:
- Add
EnableDynamicconfig knob and plumb it into the memory system setup. - Implement dynamic bank assignment logic in
double_buffered_scratchpad_memand runtime bank-topology updates inread_buffer. - Extend compute reporting to include final IFMAP/FILTER bank allocation (CSV header + per-layer item).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
scalesim/single_layer_sim.py |
Passes dynamic-allocation enable flag into memory system; records final bank split for reporting. |
scalesim/simulator.py |
Updates compute report CSV header to include final bank allocation column. |
scalesim/scale_config.py |
Adds EnableDynamic parsing/writing and a getter to expose the feature toggle. |
scalesim/memory/read_buffer.py |
Adds runtime-updatable bank topology and adjusts bank-id handling for layout conflict modeling. |
scalesim/memory/double_buffered_scratchpad_mem.py |
Implements the dynamic bank allocator and applies topology changes during request servicing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -140,6 +140,33 @@ def reset(self): # TODO: check if all resets are working propoerly | |||
| self.hashed_buffer_valid = False | |||
| self.trace_valid = False | |||
| self.use_ramulator_trace = False | |||
| # In (contiguous mapping), such multi-bank mapping would result in more bank conflict slowdown. | ||
| bank_id = column_addr // self.bw_per_bank | ||
| bank_id = min(bank_id, self.num_bank - 1) | ||
| assert bank_id < self.num_bank, f"bank id = {bank_id} for column_addr = {column_addr} needs to be smaller than total number of bank = {self.num_bank}" |
| if len(self.dynamic_unassigned_banks) == 0: | ||
| return False | ||
|
|
||
| bank_id = self.dynamic_unassigned_banks.pop(0) | ||
| if assign_to_ifmap: | ||
| self.dynamic_ifmap_banks.add(bank_id) | ||
| else: | ||
| self.dynamic_filter_banks.add(bank_id) | ||
|
|
||
| self._apply_dynamic_bank_topology() |
| else: | ||
| ifmap_reqs = int(np.count_nonzero(ifmap_demand_line != -1)) | ||
| filter_reqs = int(np.count_nonzero(filter_demand_line != -1)) | ||
| self._assign_one_dynamic_bank(assign_to_ifmap=(ifmap_reqs >= filter_reqs)) |
|
Hi @Mikemy666, thanks for creating the PR. Can you please add a summary/small documentation for the PR? Basically, some information on (i) the problem it solves, (ii) the description of the changes introduced by the PR (iii) results before and after the PR. Thanks again, I really appreciate it! |
|
Also, the code has some bugs. Please see 'Run default SCALE-Sim configuration' section in https://github.com/scalesim-project/SCALE-Sim/actions/runs/23181205759/job/68080184961. |
No description provided.