Skip to content
Snippets Groups Projects
Commit 87229205 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Remove variability concerning which inputs to combine

parent 896cb5e4
No related branches found
No related tags found
No related merge requests found
...@@ -288,33 +288,35 @@ def _level2_optimal_vectorization_strategy_generator(sumfacts, width, qp, alread ...@@ -288,33 +288,35 @@ def _level2_optimal_vectorization_strategy_generator(sumfacts, width, qp, alread
inoutkey_sumfacts = [tuple(sorted(filter(lambda sf: sf.inout_key == key, sumfacts))) for key in keys] inoutkey_sumfacts = [tuple(sorted(filter(lambda sf: sf.inout_key == key, sumfacts))) for key in keys]
for parallel in (1, 2): for parallel in (1, 2):
if parallel > len(keys):
continue
if parallel == 2 and next(iter(sumfacts)).stage == 3: if parallel == 2 and next(iter(sumfacts)).stage == 3:
continue continue
for which in filter(lambda w: w == tuple(sorted(w)),
it.permutations(range(len(keys)), parallel)): horizontal = 1
horizontal = 1 while horizontal <= width // parallel:
while horizontal <= width // parallel: combo = sum((inoutkey_sumfacts[part][:horizontal] for part in range(parallel)), ())
combo = sum((inoutkey_sumfacts[part][:horizontal] for part in which), ())
vecdict = get_vectorization_dict(combo, width // (horizontal * parallel), horizontal * parallel, qp)
vecdict = get_vectorization_dict(combo, width // (horizontal * parallel), horizontal * parallel, qp) horizontal *= 2
horizontal *= 2
if vecdict is None:
if vecdict is None: # This particular choice was rejected for some reason.
# This particular choice was rejected for some reason. # Possible reasons:
# Possible reasons: # * the quadrature point tuple not being suitable
# * the quadrature point tuple not being suitable # for this vectorization strategy
# for this vectorization strategy # * there are not enough horizontal kernels
# * there are not enough horizontal kernels continue
continue
# Go into recursion to also vectorize all kernels not in this combo
# Go into recursion to also vectorize all kernels not in this combo for opp in _level2_optimal_vectorization_strategy_generator(list_diff(sumfacts, combo),
for opp in _level2_optimal_vectorization_strategy_generator(list_diff(sumfacts, combo), width,
width, qp,
qp, add_to_frozendict(already, vecdict),
add_to_frozendict(already, vecdict), ):
): yielded = True
yielded = True yield opp
yield opp
# If we did not yield on this recursion level, yield what we got so far # If we did not yield on this recursion level, yield what we got so far
if not yielded: if not yielded:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment