Replication cannot be turned off
I accidentally pointed all links to the interstellar
repo. This issue exists in both repos.
With (1) replication
switched off, (2) partition_loops
unspecified, and (3) at least one loop's partitioning_size
less than or equal to half the PE dimension, the tool is supposed to produce a result without replication being used, but instead it errors out.
Error Message:
Traceback (most recent call last):
File "../../tools/run_optimizer.py", line 107, in <module>
energy, perf = basic_optimizer(arch_info, network_info, schedule_info, True, args.verbose)
File "../../tools/run_optimizer.py", line 14, in basic_optimizer
smallest_cost, best_mapping_point, perf = cm.optimizer.opt_optimizer(resource, layer, schedule, verbose)
File "/home/users/allpan/ee272-2022/ee272-interstellar/cnn_mapping/optimizer.py", line 16, in opt_optimizer
smallest_cost, perf, best_mapping_point = mapping_point_generator.opt_mapping_point_generator_function(resource, layer, hint, verbose)
File "/home/users/allpan/ee272-2022/ee272-interstellar/cnn_mapping/mapping_point_generator.py", line 690, in opt_mapping_point_generator_function
for blocking_partitioning in blocking_partitioning_generator:
File "/home/users/allpan/ee272-2022/ee272-interstellar/cnn_mapping/mapping_point_generator.py", line 578, in blocking_partitioning_generator_function
for pi in pb_generator:
File "/home/users/allpan/ee272-2022/ee272-interstellar/cnn_mapping/mapping_point_generator.py", line 535, in parallel_blocking_generator_function
resource.utilization_threshold)
File "/home/users/allpan/ee272-2022/ee272-interstellar/cnn_mapping/mapping_point_generator.py", line 500, in current_level_partition_blocking_with_hint
u_threshold)
File "/home/users/allpan/ee272-2022/ee272-interstellar/cnn_mapping/mapping_point_generator.py", line 436, in current_level_partition_blocking_2d_with_hint
1], schedule, u_threshold)
File "/home/users/allpan/ee272-2022/ee272-interstellar/cnn_mapping/mapping_point_generator.py", line 388, in current_level_partition_blocking_1d_with_hint
for l0 in partition_loops:
TypeError: 'NoneType' object is not iterable
By looking into the code, I found out that replication
is only tested if current_level_partition_blocking
is called. But it won't be called if you give a schedule_hint
.
This shouldn't be the intended behavior, since we still want to give it a schedule_hint
that specifies the loops to unroll, unrolling factor, etc. And because of this, when we give it a schedule_hint
, the current_level_partition_blocking_with_hint
function is always called, leading to current_level_partition_blocking_1d_with_hint
being called and this statement failing, because partition_loops
isn't specified. However, partition_loops
isn't expected to be set because we do not want to use replication.
Further examination shows that, if we do specify parallel_loops
(OX and ON) while disabling replication
, the loop blocking generated is still replicated. (The layer used is shown at the bottom.)
best schedule: [[('OY', 2, 1), ('OC', 2, 16), ('IC', 1, 3), ('ON', 4, 4), None, None, None], [('FX', 7, 1), ('FY', 7, 1), ('OY', 7, 1), ('OC', 2, 1), None, None, None], [('OX', 112, 1), ('OY', 8, 1), None, None, None, None, None]] ([[4], [6, 5]], None, None) None
You can see ('ON', 4, 4)
is a result of replication.
- Memory Arch
{
"mem_levels": 3,
"capacity":[64, 131072, 1073741824],
"access_cost":[0.12, 20.25, 200],
"static_cost":[0, 0, 0],
"parallel_count":[256, 1, 1],
"parallel_cost":[0.035],
"precision":16,
"replication":false
}
- Dataflow
{
"schedule_hint": {
"IC": {
"level0":{
"order":3,
"partitioning_size":3
}
},
"OC": {
"level0":{
"order":4,
"partitioning_size":16
}
}
}
}
- Layer
{
"fmap_width":112,
"fmap_height":112,
"input_fmap_channel":3,
"output_fmap_channel":64,
"window_width":7,
"window_height":7,
"batch_size":16,
"stride_width":2,
"stride_height":2
}