Skip to content

api: fix handling of multiple conditions for buffering#2850

Open
mloubout wants to merge 6 commits into
mainfrom
multi-cond-again
Open

api: fix handling of multiple conditions for buffering#2850
mloubout wants to merge 6 commits into
mainfrom
multi-cond-again

Conversation

@mloubout
Copy link
Copy Markdown
Contributor

No description provided.

@mloubout mloubout added the API api (symbolics, types, ...) label Feb 16, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 85.85366% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.38%. Comparing base (347d2c7) to head (0500469).

Files with missing lines Patch % Lines
devito/passes/clusters/buffering.py 78.26% 16 Missing and 9 partials ⚠️
devito/ir/clusters/algorithms.py 77.77% 1 Missing and 1 partial ⚠️
devito/passes/clusters/asynchrony.py 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #2850    +/-   ##
========================================
  Coverage   83.38%   83.38%            
========================================
  Files         248      248            
  Lines       51960    52065   +105     
  Branches     4480     4509    +29     
========================================
+ Hits        43326    43414    +88     
- Misses       7879     7892    +13     
- Partials      755      759     +4     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.58% <68.90%> (-0.06%) ⬇️
pytest-gpu-gcc- 78.10% <85.36%> (+0.01%) ⬆️
pytest-gpu-icx- 78.03% <85.36%> (+0.02%) ⬆️
pytest-gpu-nvc-nvidiaX 69.12% <68.90%> (-0.06%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

Comment thread devito/symbolics/extended_sympy.py Outdated
return CondNe(*self.args, evaluate=False)

@property
def _as_min(self):
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.

I would drop this and rather have a singledispatch handler for CondEq where necessary


def relational_shift(expr, s):
"""
Infer shift incurred by the expression. Generally only
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.

I could use an example here to quickly visualise what's it trying to do

expr = uxreplace(expr, {d: IntDiv(index, d.symbolic_factor)})

# Merge conditionals when possible. E.g if we have an implicit_dim
# and there is a dimension with the same parent, we ca merged
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.

Dimension

"ca merged"

"their conditions"

you could also make the example a bit more practical

for d in input_expr.implicit_dims:
if d not in conditionals:
continue
for cd in dict(conditionals):
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.

list(...) is fine

Comment thread devito/ir/equations/equation.py Outdated
# Replace the ConditionalDimensions in `expr`
for d, cond in conditionals.items():
# Replace dimension with index
index = d.index
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.

you can spare this line

ispace = IterationSpace(intervals, iterators)

# Construct the conditionals and replace the ConditionalDimensions in `expr`
# Construct the conditionals
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.

I think we should place this whole block of code, which constructs/lowers the conditionals, into its own separate functions, and a docstring with some examples

@mloubout mloubout force-pushed the multi-cond-again branch 4 times, most recently from ef708e5 to b997156 Compare May 22, 2026 15:13
@mloubout mloubout force-pushed the multi-cond-again branch 5 times, most recently from 7a1a6aa to c7786ea Compare May 28, 2026 17:17
@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

@mloubout mloubout force-pushed the multi-cond-again branch 7 times, most recently from 516047a to f354a19 Compare May 29, 2026 13:47
@mloubout mloubout force-pushed the multi-cond-again branch 3 times, most recently from 01f7a1c to f904760 Compare May 29, 2026 16:42
@mloubout mloubout force-pushed the multi-cond-again branch from f904760 to 0500469 Compare May 29, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API api (symbolics, types, ...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants