-
Notifications
You must be signed in to change notification settings - Fork 44
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
New feature: Allows the output data of a layer to remain in the low-level memory for later use when possible #25
Conversation
…enough for current layer processing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the comments, and format your code using black
## do not add the current mem into the modified architecture | ||
##################################################### | ||
|
||
class RemoveNoUseMemStage(Stage): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is not the most informative. Maybe something like "RemoveUnusedMemoryStage"?
for cme, extra_info in sub_stage.run(): | ||
yield cme, extra_info | ||
|
||
def generate_accelerator_removing_nouse_mem(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly rename this function.
memory_hierarchy = core.memory_hierarchy | ||
|
||
if len(self.layer.constant_operands) == 1: | ||
act_operand = self.layer.memory_operand_links[[operand for operand in self.layer.input_operands if operand not in self.layer.constant_operands][0]] # act representation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename all operand variables to reflect if they're "layer operands" or "memory operands" either in the name or in comments
## mem_update_weight = current_mem_level | ||
##################################################### | ||
|
||
class SearchNoUseMemStage(Stage): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this class and documentation to "SearchUnusedMemoryStage" or something similar.
const_operand = self.layer.memory_operand_links[weight_operand] # weight representation | ||
|
||
# Find target_act/const/output_mem_level | ||
for pos, ele in enumerate(self.mem_update_list[f"{curr_id}"]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is curr_id not already a string? If not, you should convert a variable to a string using str(...)
# Find target_act/const/output_mem_level | ||
for pos, ele in enumerate(self.mem_update_list[f"{curr_id}"]): | ||
if list(ele.keys())[0] == f"{act_operand}": | ||
target_act_mem_level = self.mem_update_list[f"{curr_id}"][pos][f"{act_operand}"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure act_operand is already a string?
dataflows = core.dataflows | ||
if dataflows is not None: | ||
raise NotImplementedError( | ||
"Scale your core-defined dataflows accordingly here." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do the dataflows have to be scaled?
Update mem_update_list and mem_update_weight according to the algorithm description at the file beginning. | ||
""" | ||
""" | ||
param const_operand: constant operand name (e.g. "W") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You specify three parameters but the function has no parameters?
… not passed the test
…elated pytest under tests/main
…_memory -> test_origin
New fixes:
Extra note:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
New feature:
Note:
workload_data_always_from_top_mem
parameter toTrue
in therun()
function within theSearchNoUseMemStage.py
file.New stages:
How to use:
Example:
An example function,
get_hardware_performance_zigzag_unused_mem_removing
is provided inapi.py
for reference.