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

Some fixups

parent 0bc54072
No related branches found
No related tags found
No related merge requests found
......@@ -212,5 +212,4 @@ def subst_rule(expr, rule):
def set_subst_rule(name, expr, visitor):
rule = lp.SubstitutionRule(name, (), visitor(expr))
subst_rule._memoize_cache = {k: v for k, v in subst_rule._memoize_cache.items() if v is not None}
print [type(v) for v in subst_rule._memoize_cache.values()]
return subst_rule(expr, rule)
......@@ -423,10 +423,12 @@ def visit_integrals(integrals):
# Ensure CSE on detjac * quadrature weight
domain = term.argument.argexpr.ufl_domain()
if term.argument.restriction:
set_subst_rule("integration_factor", uc.FacetJacobianDeterminant(domain)*uc.QuadratureWeight(domain), visitor)
if measure == "cell":
set_subst_rule("integration_factor_cell1", uc.QuadratureWeight(domain)*uc.Abs(uc.JacobianDeterminant(domain)), visitor)
set_subst_rule("integration_factor_cell2", uc.Abs(uc.JacobianDeterminant(domain))*uc.QuadratureWeight(domain), visitor)
else:
set_subst_rule("integration_factor", uc.QuadratureWeight(domain)*uc.Abs(uc.JacobianDeterminant(domain)), visitor)
set_subst_rule("integration_factor_facet1", uc.FacetJacobianDeterminant(domain)*uc.QuadratureWeight(domain), visitor)
set_subst_rule("integration_factor_facet2", uc.QuadratureWeight(domain)*uc.FacetJacobianDeterminant(domain), visitor)
get_backend(interface="accum_insn")(visitor, term, measure, subdomain_id)
......@@ -495,8 +497,6 @@ def extract_kernel_from_cache(tag, wrap_in_cgen=True):
silenced_warnings=silenced,
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:
......@@ -504,8 +504,13 @@ def extract_kernel_from_cache(tag, wrap_in_cgen=True):
# Precompute all the substrules
for sr in substrules:
print sr.name
kernel = lp.precompute(kernel, sr.name)
try:
kernel = lp.precompute(kernel, sr.name)
except:
pass
from loopy import make_reduction_inames_unique
kernel = make_reduction_inames_unique(kernel)
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