Skip to content

api: fix handling of multiple conditions for buffering#2850

Open
mloubout wants to merge 4 commits intomainfrom
multi-cond-again
Open

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

Conversation

@mloubout
Copy link
Contributor

No description provided.

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

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 45.20548% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.22%. Comparing base (828497e) to head (4fd0296).

Files with missing lines Patch % Lines
tests/test_buffering.py 10.52% 17 Missing ⚠️
tests/test_interpolation.py 20.00% 8 Missing ⚠️
devito/ir/equations/equation.py 53.33% 6 Missing and 1 partial ⚠️
devito/types/relational.py 82.35% 3 Missing ⚠️
devito/passes/clusters/cse.py 60.00% 1 Missing and 1 partial ⚠️
devito/symbolics/extended_sympy.py 60.00% 2 Missing ⚠️
devito/passes/clusters/buffering.py 50.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (828497e) and HEAD (4fd0296). Click for more details.

HEAD has 8 uploads less than BASE
Flag BASE (828497e) HEAD (4fd0296)
18 10
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2850       +/-   ##
===========================================
- Coverage   78.97%   45.22%   -33.75%     
===========================================
  Files         248      248               
  Lines       50936    50997       +61     
  Branches     4404     4412        +8     
===========================================
- Hits        40226    23064    -17162     
- Misses       9909    27004    +17095     
- Partials      801      929      +128     

☔ 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.

return CondNe(*self.args, evaluate=False)

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

Choose a reason for hiding this comment

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

list(...) is fine

# Replace the ConditionalDimensions in `expr`
for d, cond in conditionals.items():
# Replace dimension with index
index = d.index
Copy link
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
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

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

Comments