6
6
# the 3-Clause BSD License. See the LICENSE file in the package base
7
7
# directory for details.
8
8
9
- from typing import List
9
+ from typing import List , cast
10
+ from discopop_explorer .PEGraphX import LoopNode
10
11
from discopop_library .discopop_optimizer .OptimizerArguments import OptimizerArguments
11
12
from discopop_library .discopop_optimizer .Variables .Experiment import Experiment
12
13
from discopop_library .discopop_optimizer .classes .context .Update import Update
15
16
from discopop_library .result_classes .OptimizerOutputPattern import OptimizerOutputPattern
16
17
17
18
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
19
21
) -> OptimizerOutputPattern :
20
22
to_be_removed : List [Update ] = []
21
23
for update in best_configuration .data_movement :
@@ -25,7 +27,7 @@ def remove_loop_index_updates(experiment: Experiment, best_configuration: Optimi
25
27
loop_cu_id = data_at (experiment .optimization_graph , update .target_node_id ).original_cu_id
26
28
if loop_cu_id is None :
27
29
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
29
31
# check for loop indices as targeted varbiables
30
32
if update .write_data_access .var_name in loop_indices :
31
33
# found update to loop index
@@ -42,12 +44,10 @@ def remove_loop_index_updates(experiment: Experiment, best_configuration: Optimi
42
44
if len (to_be_removed ) > 0 :
43
45
print ()
44
46
45
-
46
-
47
47
if arguments .verbose :
48
48
print ("Removed loop index updates" )
49
49
for update in best_configuration .data_movement :
50
50
print ("# " , update )
51
51
print ()
52
52
53
- return best_configuration
53
+ return best_configuration
0 commit comments