Repository navigation
Add Perf gates for assembly time and allocations - #9
Merged
Merged
Conversation
Generated tangents return a literal Int 0 for constant-zero entries; indexing the resulting mixed tuple with a runtime index allocated on every facet quadrature point (nonlinear pass grew from 8.8 kB at 20x20 to 124 kB at 100x100). Promoting the tuple makes it homogeneous. The context now also records which cells touch any piece, so interior cells skip the per-facet Set lookups (case (i) with facets: 2.4x to 1.7x of hand-written). Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: d6252e53-ed42-4149-9811-233262edb2ef Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Spec §6.6 items 1, 3, 4 and §10.6: case (i) linear assembly and case (iii) residual and Jacobian on 100x100 P1 within 3x of hand-written Ferrite loops (minimum of 10 runs after warm-up), per-pass allocations independent of mesh size (20x20 vs 100x100), and AllocCheck on the per-cell element, facet and gather functions. AllocCheck is a new test-only extra. Runs on Julia 1 only. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: d6252e53-ed42-4149-9811-233262edb2ef Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The cached facet-cell membership went stale when a caller mutated a facet set it had passed in: assembly skipped the new facet and the facet-count assertion threw. The context now copies every facet set into a Set{FacetIndex} at construction, so later mutations of the caller's set or of the grid's facet sets cannot desynchronise it.
Agent-Harness: Claude Code 2.1.310
Agent-Model: claude-opus-5-5
Agent-Session: d6252e53-ed42-4149-9811-233262edb2ef
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
This was referenced Oct 26, 2026
xtalax-droid
changed the base branch from
forge/m1-4-integration
to
forge/m1-3-assembly
October 26, 2026 21:03
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.
The M3 performance and allocation gate (spec §6.6 items 1, 3 and 4; §10.6). Stacked on #7 (base
forge/m1-4-integration).What
A new
Perftest group,test/Perf/perf.jl, runs on Julia 1 only and checks three gates on 100×100 P1 triangles.analyse,weak_form,emit_kernels, thenassemble_linear!in place). It must take at most 3× as long as a hand-written Ferrite loop. This is checked with and without the Neumann and Robin facets, and the operators must also agree with the hand-written ones to 1e-14.randJloop, and must agree with it to 1e-13.AllocCheck is added as a test-only extra.
Driver fixes
The gates found two problems in the driver, and Codex review found a third.
0for constant-zero entries. Indexing that mixed tuple allocated at every facet quadrature point, so the nonlinear pass grew from 8.8 kB to 124 kB between 20×20 and 100×100. The tangent tuple is now promoted to one type.AssemblyContextnow records which cells touch any boundary piece, and interior cells skip the facet membership lookups. This took the facet case from 2.42× to 1.68×.AssemblyContextnow copies each facet set when it is built. Later changes to the caller's set cannot get out of step with the cached cell list. This is documented in the docstring, and a regression test covers it.Measured on 100×100 P1
Minimum of 10 runs, with both sides assembling in place.
randJAllocations per pass are 12.5 kB for the linear pass and 8.9 kB for the nonlinear pass, the same at 20×20 and 100×100.
Tests
Runic and typos are clean. Codex approved it in round 2; round 1's finding was the stale facet-cell cache.
Branches covered: spec §6.6 items 1 and 3, with and without facets. Item 4, the performance of the one-pass nonlinear
randJ. The §10.6 "within 3×" and "allocation-free under AllocCheck" gates. Construction time at N = 1e4 belongs to the DAE lowering in M2 and M3.Reviewer notes
🤖 Posted by an AI agent · harness: Claude Code 2.1.310 · model: claude-opus-5-5
Review: unreviewed
Session: d6252e53-ed42-4149-9811-233262edb2ef