Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

fix(reg_flow): route bending==0 Lamé calls to matvec_lame/diag_lame - #39

Merged
balbasty merged 1 commit into
claude/fastfields-teeny-refactor-js42idfrom
claude/reg-flow-diag-lame-bugfix
Aug 1, 2026
Merged

fix(reg_flow): route bending==0 Lamé calls to matvec_lame/diag_lame#39
balbasty merged 1 commit into
claude/fastfields-teeny-refactor-js42idfrom
claude/reg-flow-diag-lame-bugfix

Conversation

@balbasty

Copy link
Copy Markdown
Contributor

Summary

  • _flow_matvec/_flow_diag in reg_flow.cpp unconditionally routed any non-zero shears/div to the full combined matvec_all/diag_all stencil, even when bending == 0, leaving the cheaper Lamé-only matvec_lame/diag_lame stencils (already exercised via relax_lame_) unreachable from the public dispatch. _flow_kernel and _flow_relax already branch correctly on bending != 0; this mirrors that pattern in _flow_matvec/_flow_diag so an elastic-only (non-bending) registration configuration uses the cheaper ~9-tap stencil instead of the ~25-tap combined one.
  • Also adds regression tests (tests/test_reg_flow.cpp, tests/test_reg_field.cpp) for the corner cross-term sign bug fixed upstream in fastfields-kernels#32: on a square domain with the same boundary condition on every axis, diag(0,j,c) must be symmetric under axis swap (and, for flow's diag_all with shears == div, channel swap too). Confirmed these fail against the pre-fix kernels and pass against the fix.

Depends on

fastfields-kernels#32 — the impl/kernels submodule pins here are unchanged (dev-tree symlinks were used to validate locally against the fix); a real (non-symlinked) checkout needs the kernels PR merged and the pin bumped for the new diag-symmetry tests to pass.

Test plan

  • Full CPU suite (make test CXX=clang++) green: 0 failures across all 11 test binaries, reg_flow now 854 checks (830 + 24 new).
  • Confirmed the two new diag-symmetry tests fail (16 mismatches) when the kernels-side fix is reverted, and pass again once restored — not tautological.
  • Confirmed via a full test run that routing Lamé-only calls through matvec_lame/diag_lame instead of matvec_all/diag_all does not change any existing test's expected values (mathematically the two stencils must agree when bending == 0) — this is a performance fix, not a behavior change.

Generated by Claude Code

_flow_matvec/_flow_diag unconditionally selected the full combined
matvec_all/diag_all stencil whenever shears/div were non-zero, even
when bending==0, leaving the cheaper Lamé-only matvec_lame/diag_lame
stencils (already exercised via relax_lame_) unreachable from the
public dispatch. Mirror _flow_kernel's/_flow_relax's existing correct
"bending != 0" branch so an elastic-only (non-bending) registration
configuration uses the cheaper stencil.
Also add regression tests for the corner cross-term sign bug fixed
upstream in fastfields-kernels (diag_bending / diag_all boundary
correction): on a square domain with the same boundary condition on
every axis, diag(0,j,c) must be symmetric under axis (and, for
diag_all with shears==div, channel) swap. Confirmed these tests fail
against the pre-fix kernels and pass against the fix.
Adds the analogous test_diag_boundary_symmetry_2d() to
test_reg_field.cpp for the field-side diag_bending fix.
@balbastyClaude

Copy link
Copy Markdown
ContributorAuthor

Agent:claude-fastfields-to-teeny — opened from the fastfields teeny-refactor session (claude/fastfields-teeny-refactor-js42id). Flagging for disambiguation from the concurrent claude-jitfields-to-fastfields agent (claude/jitfields-fastfields-migration-v5r416), which is porting jitfields to fastfields directly, without teeny.


Generated by Claude Code

balbasty pushed a commit that referenced this pull request Jul 31, 2026
…flict
Both main (via cpu-impl#38's merge, 9e12e7d) and this branch (via
cpu-impl#39's merge, b6eae48) independently re-pinned impl since their
common ancestor. b6eae48 is a descendant of 9e12e7d (#39 was built on
top of #38's merged state), so it is the correct resolution -- kept.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AjQcY78NgbagPSbPJRr6Z
@balbasty
balbasty merged commit 8afcab4 into claude/fastfields-teeny-refactor-js42idAug 1, 2026
1 check failed
@balbasty
balbasty deleted the claude/reg-flow-diag-lame-bugfix branch August 1, 2026 08:17
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@balbasty@claude