Accept vector-valued per-qp kernels in the diagonal assembler - #337
Merged
Conversation
A diagonal-only element kernel can now return the per-quadrature-point diagonal directly as an SVector, so the full NxN element matrix is never formed. The existing SMatrix method is untouched; the two dispatch on the kernel's return type. Signed-off-by: Alejandro Mota <amota@sandia.gov>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #337 +/- ##
==========================================
- Coverage 69.01% 68.99% -0.03%
==========================================
Files 55 55
Lines 6523 6525 +2
==========================================
Hits 4502 4502
- Misses 2021 2023 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cmhamel
approved these changes
Aug 24, 2026
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.
Summary
Adds one method to the diagonal assembly path:
_accumulate_q_value(::AssembledDiagonal, ...)now also accepts a per-quadrature-point SVector, so a physics-side kernel can return the element diagonal directly instead of a full NxN element matrix that the assembler immediately reduces to its diagonal. The existing SMatrix method is untouched; the two dispatch on the kernel's return type.Motivation
Carina's matrix-free Jacobi/Chebyshev/AMG preconditioner updates were computing every entry of the 24x24 element stiffness per quadrature point and keeping 24 of them. A CUPTI profile of a production Newmark step measured that kernel at 585 ms per Newton iteration on a V100 — ~100x the per-element cost of the matrix-free action (see Carina
benchmark/crosscode/README.md§4). With this method, Carina provides diagonal-only kernels (diag(JxW·G·A·G') needs only the tangent entries pairing a component with itself): the preconditioner update drops 587 → 12.4 ms on a V100 (47x) and 290 → 6.5 ms on an A100 (45x), contributing to end-to-end per-step gains up to 1.9x.Testing