tsfc: contract each block after unconcatenating - #5297
Open
pbrubeck wants to merge 1 commit into
Open
Conversation
This was referenced Jul 29, 2026
pbrubeck
force-pushed
the
pbrubeck/hdivcurl-delta
branch
from
July 29, 2026 18:30
a9f3c30 to
f5181ab
Compare
compile_expression_dual_evaluation carried a TODO to apply the GEM optimisations that assembly applies. Apply one of them: contract each assignment once unconcatenate has split the Concatenate nodes. This matters for H(div) and H(curl). Those elements are a sum of blocks, each mapping into one vector component, and with firedrakeproject/fiat#270 each block selects its component with a Delta. Before unconcatenation the blocks are branches of a Concatenate, so the Deltas never meet; afterwards each pair of blocks is its own assignment, the Deltas multiply, and delta elimination cancels every pair mapping to different components. Coarse to fine interpolation, kernel temporaries and wall clock: NCF 1->4 832K -> 68K 3.07x faster NCE 1->4 307K -> 110K 2.23x faster NCE 1->3 131K -> 61K 2.23x faster Form assembly does not go through this function and is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pbrubeck
force-pushed
the
pbrubeck/hdivcurl-delta
branch
from
July 29, 2026 23:29
f5181ab to
7a92a6e
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.
compile_expression_dual_evaluationhad a standing TODO:Apply one of them: contract each assignment once
unconcatenatehas split theConcatenatenodes.This matters for H(div) and H(curl). Those elements are a sum of blocks, each
mapping into one vector component, and with firedrakeproject/fiat#271 each
block selects its component with a
Delta. Before unconcatenation the blocks arebranches of a
Concatenate, so the Deltas never meet; afterwards each pair ofblocks is its own assignment, the Deltas multiply, and delta elimination cancels
every pair that maps to different components.
Paired with firedrakeproject/fiat#271. Neither PR does anything on its own —
without the Deltas there is nothing for the contraction to cancel, and without the
contraction the Deltas never meet.
Effect
Coarse to fine interpolation, as p-multigrid prolongation. Kernel stack
temporaries and wall clock:
Form assembly is unchanged; it does not go through this function.
Testing
Matrix-free
mult/multTransposeagainst the assembled matrix, and aninterpolate/restrict round trip, for NCF/NCE on hexahedra and RTCF/RTCE on
quadrilaterals, spectral and fdm variants. Full FIAT suite on the paired branch.
🤖 Generated with Claude Code