Skip to content

Fix fd gather priority - #3016

Open
mloubout wants to merge 2 commits into
mainfrom
fix-fd-gather-priority
Open

Fix fd gather priority#3016
mloubout wants to merge 2 commits into
mainfrom
fix-fd-gather-priority

Conversation

@mloubout

@mloubout mloubout commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

`highest_priority` ranked operands by `_fd_priority`, which an `Add` or `Mul`
reports as the generic `Differentiable` fallback rather than as the priority
of the Functions it is built from. Operands carrying quite different
staggering therefore tied there, and `sorted` being stable the winner fell
out of SymPy's argument ordering -- which differs between an `EvalDerivative`
and the `IndexDerivative` standing for the same expression, so `expand`
silently decided where a product was gathered.

On an elastic TTI gradient that put the `I * C * I^T` contraction on the
strain instead of on the node-centred stiffness, leaving an outer
interpolation that the NODE block would not have needed. With `expand=False`
the second-order error then fell with slope 1.46 rather than 2, and scaling a
kernel by two changed the result by 1.27 rather than by 2.
@mloubout mloubout added API api (symbolics, types, ...) no-pro-trigger Skip the devitopro submodule update on merge labels Sep 4, 2026
Fails without the fix: `highest_priority` comes back with the staggered
Function, the two sums both reporting the `Differentiable` fallback (.5)
rather than the NODE Function's 1.2, and so tying.
@mloubout
mloubout force-pushed the fix-fd-gather-priority branch from f953801 to 07a38b0 Compare September 4, 2026 14:58
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.72%. Comparing base (b330c14) to head (07a38b0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3016   +/-   ##
=======================================
  Coverage   83.72%   83.72%           
=======================================
  Files         257      257           
  Lines       54822    54838   +16     
  Branches     4693     4694    +1     
=======================================
+ Hits        45901    45915   +14     
- Misses       8110     8111    +1     
- Partials      811      812    +1     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.63% <100.00%> (-0.01%) ⬇️
pytest-gpu-gcc- 78.34% <100.00%> (+<0.01%) ⬆️
pytest-gpu-icx- 78.26% <100.00%> (-0.02%) ⬇️
pytest-gpu-nvc-nvidiaX 69.15% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API api (symbolics, types, ...) no-pro-trigger Skip the devitopro submodule update on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant