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

Fixups

parent 866645c2
No related branches found
No related tags found
No related merge requests found
......@@ -50,17 +50,23 @@ def attach_vectorization_info(sf):
return _cache_vectorization_info(sf, None)
@backend(interface="vectorization_costfunction", name="greedy")
@backend(interface="vectorization_strategy", name="greedy")
def greedy_costfunction(sf):
return 1
@backend(interface="vectorization_costfunction", name="explicit")
@backend(interface="vectorization_strategy", name="explicit")
def explicit_costfunction(sf):
# Read the explicitly set values for horizontal and vertical vectorization
width = get_vcl_type_size(np.float64)
horizontal = int(get_option("vectorization_horizontal", width))
vertical = int(get_option("vectorization_vertical", 1))
horizontal = get_option("vectorization_horizontal")
if horizontal is None:
horizontal = width
vertical = get_option("vectorization_vertical")
if vertical is None:
vertical = 1
horizontal = int(horizontal)
vertical = int(vertical)
if sf.horizontal_width == horizontal and sf.vertical_width == vertical:
return 1
......@@ -71,8 +77,8 @@ def explicit_costfunction(sf):
def strategy_cost(strategy):
qp, strategy = strategy
set_quadrature_points(qp)
func = get_backend(interface="vectorization_costfunction",
name=get_option("vectorization_strategy"))
func = get_backend(interface="vectorization_strategy",
selector=lambda: get_option("vectorization_strategy"))
return sum(float(func(sf)) for sf in strategy.values())
......@@ -80,8 +86,8 @@ def stringify_vectorization_strategy(strategy):
result = []
qp, strategy = strategy
result.append["Printing potential vectorization strategy:"]
result.append["Quadrature point tuple: {}".format(qp)]
result.append("Printing potential vectorization strategy:")
result.append("Quadrature point tuple: {}".format(qp))
# Look for all realizations in the strategy and iterate over them
cache_keys = frozenset(v.cache_key for v in strategy.values())
......@@ -89,14 +95,16 @@ def stringify_vectorization_strategy(strategy):
# Filter all the kernels that are realized by this and print
for key in strategy:
if strategy[key].cache_key == ck:
result.append["{}:".format(key)]
result.append("{}:".format(key))
# Find one representative to print
for val in strategy.values():
if val.cache_key == ck:
result.append[" {}".format(val)]
result.append(" {}".format(val))
break
return result
def decide_vectorization_strategy():
""" Decide how to vectorize!
......@@ -144,7 +152,7 @@ def decide_vectorization_strategy():
# Register the results
for sf in all_sumfacts:
_cache_vectorization_info(sf, sfdict.get(sf, no_vec(sf)))
_cache_vectorization_info(sf, sfdict[sf])
def vectorization_opportunity_generator(sumfacts, width):
......
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