-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify indexed ListTensor objects #336
Open
pbrubeck
wants to merge
14
commits into
FEniCS:main
Choose a base branch
from
firedrakeproject:pbrubeck/simplify-indexed
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
2 times, most recently
from
December 30, 2024 03:36
80ab7ca
to
a7a7922
Compare
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
from
December 30, 2024 03:55
a7a7922
to
0a0a4df
Compare
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
from
December 31, 2024 16:00
4dcc19a
to
5db1162
Compare
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
from
January 1, 2025 01:39
4fa252a
to
7100560
Compare
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
from
January 2, 2025 15:40
32ac46b
to
40d6f2f
Compare
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
from
January 2, 2025 15:45
40d6f2f
to
35509b8
Compare
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
from
January 4, 2025 19:41
766da29
to
e0c4e6a
Compare
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
2 times, most recently
from
January 7, 2025 01:36
e09ca53
to
1356ae0
Compare
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
from
January 7, 2025 06:15
1356ae0
to
bfa596d
Compare
This seems fine to me and thanks for the various modernisations added as well. |
pbrubeck
force-pushed
the
pbrubeck/simplify-indexed
branch
from
January 8, 2025 17:07
33bd10d
to
bfa596d
Compare
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.
When splitting mixed Forms, mixed Arguments get replaced by ListTensors of Zero and subspace Arguments of the form
[0, ..., 0, v[0], ..., v[k], 0, ..., 0]
. The resulting split Form would contain many instances of Indexed objects with this ListTensor, that could be simplified to either0
or[v[0], ..., v[k]] -> v
.Previously, the simplification step was left as a task for the form compiler, but working with such complicated expressions often results in sub-optimal code generation. This PR addresses the following simplications at the UFL-level:
Indexed(ListTensor[v0, ..., vk], (j,)) -> vj
ListTensor(Indexed(v, FixedIndex(i)) for i in range(k)) -> v
Restricted(ConstantValue) -> ConstantValue
As a consequence, splitting a bilinear Form with a block in the diagonal equal to zero produces an empty Form, losing all the information that the unsimplified Form carried around, such as the Arguments and the arity. This situation needs to be handled carefully as a special case. See firedrakeproject/firedrake#3947
With these simplifications, we can correctly estimate quadrature degrees for integrands that only depend on one component of the solution, thus lowering flop counts.