Skip to content
Snippets Groups Projects
Unverified Commit 87f90f34 authored by Andreas Klöckner's avatar Andreas Klöckner Committed by GitHub
Browse files

Merge pull request #23 from inducer/diff-batch-op-cache-v2

parents 6f3e5e98 6c2571f6
No related branches found
No related tags found
No related merge requests found
...@@ -525,14 +525,20 @@ class ExecutionMapper(mappers.Evaluator, ...@@ -525,14 +525,20 @@ class ExecutionMapper(mappers.Evaluator,
if in_grp.nelements == 0: if in_grp.nelements == 0:
continue continue
matrices = repr_op.matrices(out_grp, in_grp) # Cache operator
cache_key = "diff_batch", in_grp, out_grp, tuple(insn.operators),\
# FIXME: Should transfer matrices to device and cache them field.entry_dtype
matrices_ary = np.empty(( try:
noperators, out_grp.nunit_dofs, in_grp.nunit_dofs)) matrices_ary_dev = self.bound_op.operator_data_cache[cache_key]
for i, op in enumerate(insn.operators): except KeyError:
matrices_ary[i] = matrices[op.rst_axis] matrices = repr_op.matrices(out_grp, in_grp)
matrices_ary_dev = self.array_context.from_numpy(matrices_ary) matrices_ary = np.empty(
(noperators, out_grp.nunit_dofs, in_grp.nunit_dofs),
dtype=field.entry_dtype)
for i, op in enumerate(insn.operators):
matrices_ary[i] = matrices[op.rst_axis]
matrices_ary_dev = self.array_context.from_numpy(matrices_ary)
self.bound_op.operator_data_cache[cache_key] = matrices_ary_dev
self.array_context.call_loopy( self.array_context.call_loopy(
prg(noperators), prg(noperators),
......
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