Compile interpolation through the GEM optimisation pipeline - #5381
Merged
Conversation
connorjward
reviewed
Aug 24, 2026
connorjward
left a comment
Contributor
There was a problem hiding this comment.
How much of this code is the same as in compile_form? Ideally they would be the same code path no?
Contributor
Author
Ideally we would have a unified assembler that would deal with compositions of same-mesh interpolate and Form. I suggest we take this as the first step. |
Contributor
Agreed. Fine to do in pieces. |
This was referenced Aug 24, 2026
pbrubeck
force-pushed
the
pbrubeck/interp-spectral
branch
from
August 26, 2026 11:22
43e17a5 to
4976308
Compare
Dual evaluation now leaves the point indices free, so interpolation can go through mode.Integrals and mode.flatten with the points as its quadrature multiindex, exactly as form assembly does. The value shape is summed before the pipeline: those indices are carried by Deltas, so they want cancellation rather than sum factorisation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pbrubeck
force-pushed
the
pbrubeck/interp-spectral
branch
from
August 26, 2026 11:26
4976308 to
37671b8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
assemble(interpolate)now contracts over the points with the same GEM optimisations as inassemble(Form).Depends on firedrakeproject/fiat#288
Benchmark
Interpolation into CG on a 16x16x16 extruded hex mesh, minimum of 15 timed
batches.
fscalar,uvector,Atensor, all CG of the given degree.f*f*f -> S(CG1)dot(u,u)*u -> V(CG1)inner(A,A) -> S(CG1)dot(A,A) -> T(CG1)dot(A,dot(A,u)) -> V(CG1)dot(A,dot(A,A)) -> T(CG1)f*f*f -> S(CG2)dot(u,u)*u -> V(CG2)inner(A,A) -> S(CG2)dot(A,A) -> T(CG2)dot(A,dot(A,u)) -> V(CG2)dot(A,dot(A,A)) -> T(CG2)f*f*f -> S(CG3)dot(u,u)*u -> V(CG3)inner(A,A) -> S(CG3)dot(A,A) -> T(CG3)dot(A,dot(A,u)) -> V(CG3)dot(A,dot(A,A)) -> T(CG3)Speed up comes from Delta cancellation that was missing for tensor-valued expressions.
f*f*fandinner(A,A)have an empty value shape, so this change cannotaffect them: they are the control, and come out at 1.00x flops and
0.95-1.01x time. Every case with a value shape improves.
Temporaries rise in two cases (81 to 120 at CG2
dot(A,A), 44 to 65 at CG1dot(A,A)), and both are still faster, so the extra register pressure doesnot cost anything measurable.
Generated with Claude Code