Skip to content

compiler: Introduce SparseLocalSum - #3028

Merged
FabioLuporini merged 2 commits into
mainfrom
sparse-local-sum
Sep 16, 2026
Merged

FabioLuporini merged 2 commits into
mainfrom
sparse-local-sum

Conversation

@FabioLuporini

Copy link
Copy Markdown
Contributor

... for graceful lowering

this allows specialisation in PRO

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.57983% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.84%. Comparing base (cf24a2b) to head (531cd55).

Files with missing lines Patch % Lines
devito/ir/equations/algorithms.py 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3028      +/-   ##
==========================================
+ Coverage   83.67%   83.84%   +0.17%     
==========================================
  Files         257      258       +1     
  Lines       55079    55281     +202     
  Branches     4710     4719       +9     
==========================================
+ Hits        46087    46353     +266     
+ Misses       8174     8112      -62     
+ Partials      818      816       -2     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.65% <92.12%> (+0.11%) ⬆️
pytest-gpu-gcc- 78.50% <99.57%> (+0.08%) ⬆️
pytest-gpu-icx- 78.44% <99.57%> (+0.08%) ⬆️
pytest-gpu-nvc-nvidiaX 69.18% <92.12%> (+0.08%) ⬆️

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.

@FabioLuporini
FabioLuporini force-pushed the sparse-local-sum branch 2 times, most recently from 97d58e4 to a099376 Compare September 15, 2026 19:13
obj = sympy.Expr.__new__(cls, expr)
obj._expr = expr
obj._cdims = as_tuple(cdims)
obj._dtype = np.dtype(dtype).type

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, leftover

return symbols - self.bound_symbols

def _evaluate(self, **kwargs):
return self._rebuild(Evaluable._evaluate_maybe_nested(self.expr, **kwargs))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just self.expr._evaluate?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

def _evaluate(self, **kwargs):
return self._rebuild(Evaluable._evaluate_maybe_nested(self.expr, **kwargs))

def _xreplace(self, rule):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird to need that here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Comment thread devito/passes/clusters/localsum.py Outdated
processed.extend([init, update])
subs[reduction] = value

expr = e.apply(partial(uxreplace, rule=subs))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a weird one, why not just uxreplace(e, subs) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, it was a leftover indeed, good catch

Comment thread devito/passes/clusters/localsum.py Outdated
"""
Construct the private initializer and guarded accumulation for one sum.
"""
value = Temp(name=sregistry.make_name(prefix='sum'), dtype=cluster.dtype)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use the reduction.dtype, not cluster.dtype

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed

@FabioLuporini
FabioLuporini merged commit 418f94a into main Sep 16, 2026
42 checks passed
@FabioLuporini
FabioLuporini deleted the sparse-local-sum branch September 16, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants