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

Take substitutions from the kernel to avoid them being eliminated

parent afcc773d
No related branches found
No related tags found
No related merge requests found
......@@ -498,27 +498,24 @@ def extract_kernel_from_cache(tag, wrap_in_cgen=True):
name=name,
)
from loopy import make_reduction_inames_unique
kernel = make_reduction_inames_unique(kernel)
# Apply the transformations that were gathered during tree traversals
for trafo in transformations:
kernel = trafo[0](kernel, *trafo[1])
# Precompute all the substrules
for sr in substrules:
try:
tmpname = "precompute_{}".format(sr.name)
kernel = lp.precompute(kernel,
sr.name,
temporary_name=tmpname,
)
# Vectorization strategies are actually very likely to eliminate the
# precomputation temporary. To avoid the temporary elimination warning
# we need to explicitly disable it.
kernel = kernel.copy(silenced_warnings=kernel.silenced_warnings + ["temp_to_write({})".format(tmpname)])
except RunTimeError:
pass
from loopy import make_reduction_inames_unique
kernel = make_reduction_inames_unique(kernel)
for sr in kernel.substitutions:
tmpname = "precompute_{}".format(sr)
kernel = lp.precompute(kernel,
sr,
temporary_name=tmpname,
)
# Vectorization strategies are actually very likely to eliminate the
# precomputation temporary. To avoid the temporary elimination warning
# we need to explicitly disable it.
kernel = kernel.copy(silenced_warnings=kernel.silenced_warnings + ["temp_to_write({})".format(tmpname)])
from dune.perftool.loopy import heuristic_duplication
kernel = heuristic_duplication(kernel)
......
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