Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/robin-formatting' i…
Browse files Browse the repository at this point in the history
…nto robin-formatting
  • Loading branch information
RobinGeens committed Jul 30, 2024
2 parents c329536 + 4cad95e commit 0ed433d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions main_stream_mode_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,25 @@
)
_logging.basicConfig(level=_logging_level, format=_logging_format)

################################INPUTS################################
################################ INPUTS################################
accelerator = "stream/inputs/examples/hardware/tpu_like_quad_core.yaml"
workload_path = "stream/inputs/examples/workload/resnet18.onnx"
mapping_path = "stream/inputs/examples/mapping/tpu_like_quad_core.yaml"
CN_define_mode = 3 # manually define outer-CN loops
hint_loops = [[("OY", "all")], [("K", 2)]]
layer_cutoffs = [30] # layer_id >= 30 will use second entry
hint_loops = {(0, 1, 2, 3): [("OY", "all")], tuple(range(4, 49)): [("K", 4)]}
nb_ga_individuals = 16 # number of individuals in each generation
nb_ga_generations = 16 # number of genetic algorithm generations
######################################################################

################################PARSING###############################
################################ PARSING###############################
hw_name = accelerator.split(".")[-1]
wl_name = re.split(r"/|\.", workload_path)[-1]
if wl_name == "onnx":
wl_name = re.split(r"/|\.", workload_path)[-2]
hint_loops_str_list = []
if isinstance(hint_loops[0], list):
if isinstance(hint_loops, dict):
hint_loops_nested = list(hint_loops.values())
elif isinstance(hint_loops[0], list):
hint_loops_nested = hint_loops
else:
hint_loops_nested = [hint_loops]
Expand All @@ -52,7 +53,7 @@
scme_pkl_name = f"{experiment_id}-scme"
######################################################################

############PLOTTING#############
############ PLOTTING#############
plot_file_name = f"-{experiment_id}-"
plot_full_schedule = True
draw_dependencies = True
Expand All @@ -62,7 +63,7 @@
#################################


################################PATHS################################
################################ PATHS################################
node_hw_performances_path = f"outputs/{node_hw_cost_pkl_name}.pickle"
scme_path = f"outputs/{scme_pkl_name}.pickle"
timeline_fig_path_plotly = f"outputs/{experiment_id}-schedule.html"
Expand Down Expand Up @@ -92,7 +93,6 @@
plot_data_transfer=plot_data_transfer,
cn_define_mode=CN_define_mode,
hint_loops=hint_loops,
layer_cutoffs=layer_cutoffs,
scheduler_candidate_selection="memory",
operands_to_prefetch=[],
)
Expand Down
2 changes: 1 addition & 1 deletion stream/classes/opt/splitting/splitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ def convert_outer_cn_loops_with_k(outer_cn_loops: list, layer: ComputationNode,
if not isinstance(split_factor, int):
raise ValueError("The number of K splits should be an integer.")
if split_factor > 1:
outer_cn_loops += [(LayerDim("K"), split_factor)]
outer_cn_loops += [("K", split_factor)]
outer_loops = convert_outer_cn_loops(outer_cn_loops, layer)
return outer_loops
2 changes: 1 addition & 1 deletion stream/classes/stages/GenerateCNWorkloadHybridStage.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def get_outer_tmap_loop_dimensions(self, layer: ComputationNode) -> List[Tempora
# layer ids 0 to 3 will use [("OY", "all")] and layer id 4 will use [("OY", "all), ("K", "all")]
# Find which sublist this layer should use
try:
outer_cn_loops = next(v for k, v in self.hint_loops if layer.id in k)
outer_cn_loops = next(v for k, v in self.hint_loops.items() if layer.id in k)
except StopIteration:
raise ValueError(f"Layer id {layer.id} not in hint_loops: {self.hint_loops}")
outer_loops = convert_outer_cn_loops(outer_cn_loops, layer)
Expand Down

0 comments on commit 0ed433d

Please sign in to comment.