Skip to content

Commit 3a27189

Browse files
fix: formatting and typing
1 parent 60eaf04 commit 3a27189

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

discopop_library/discopop_optimizer/UpdateOptimization/RemoveLoopIndexUpdates.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# the 3-Clause BSD License. See the LICENSE file in the package base
77
# directory for details.
88

9-
from typing import List
9+
from typing import List, cast
10+
from discopop_explorer.PEGraphX import LoopNode
1011
from discopop_library.discopop_optimizer.OptimizerArguments import OptimizerArguments
1112
from discopop_library.discopop_optimizer.Variables.Experiment import Experiment
1213
from discopop_library.discopop_optimizer.classes.context.Update import Update
@@ -15,7 +16,8 @@
1516
from discopop_library.result_classes.OptimizerOutputPattern import OptimizerOutputPattern
1617

1718

18-
def remove_loop_index_updates(experiment: Experiment, best_configuration: OptimizerOutputPattern, arguments: OptimizerArguments
19+
def remove_loop_index_updates(
20+
experiment: Experiment, best_configuration: OptimizerOutputPattern, arguments: OptimizerArguments
1921
) -> OptimizerOutputPattern:
2022
to_be_removed: List[Update] = []
2123
for update in best_configuration.data_movement:
@@ -25,7 +27,7 @@ def remove_loop_index_updates(experiment: Experiment, best_configuration: Optimi
2527
loop_cu_id = data_at(experiment.optimization_graph, update.target_node_id).original_cu_id
2628
if loop_cu_id is None:
2729
continue
28-
loop_indices = experiment.detection_result.pet.node_at(loop_cu_id).loop_indices
30+
loop_indices = cast(LoopNode, experiment.detection_result.pet.node_at(loop_cu_id)).loop_indices
2931
# check for loop indices as targeted varbiables
3032
if update.write_data_access.var_name in loop_indices:
3133
# found update to loop index
@@ -42,12 +44,10 @@ def remove_loop_index_updates(experiment: Experiment, best_configuration: Optimi
4244
if len(to_be_removed) > 0:
4345
print()
4446

45-
46-
4747
if arguments.verbose:
4848
print("Removed loop index updates")
4949
for update in best_configuration.data_movement:
5050
print("# ", update)
5151
print()
5252

53-
return best_configuration
53+
return best_configuration

0 commit comments

Comments
 (0)