Skip to content

api: fix handling of multiple conditions for buffering#2850

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

api: fix handling of multiple conditions for buffering#2850
mloubout wants to merge 5 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 32.09877% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.24%. Comparing base (c71560b) to head (b997156).

Files with missing lines Patch % Lines
tests/test_buffering.py 10.00% 36 Missing ⚠️
devito/ir/equations/equation.py 41.17% 9 Missing and 1 partial ⚠️
devito/passes/clusters/buffering.py 16.66% 5 Missing ⚠️
devito/types/relational.py 77.77% 4 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (c71560b) and HEAD (b997156). Click for more details.

HEAD has 12 uploads less than BASE
Flag BASE (c71560b) HEAD (b997156)
17 10
pytest-gpu-gcc- 6 4
pytest-gpu-icx- 3 2
pytest-gpu-nvc-nvidiaX 1 0
pytest-gpu-aomp-amdgpuX 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2850       +/-   ##
===========================================
- Coverage   83.37%   45.24%   -38.14%     
===========================================
  Files         248      248               
  Lines       51881    51949       +68     
  Branches     4479     4488        +9     
===========================================
- Hits        43257    23504    -19753     
- Misses       7867    27497    +19630     
- Partials      757      948      +191     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX ?
pytest-gpu-gcc- 43.27% <32.09%> (-34.82%) ⬇️
pytest-gpu-icx- 43.10% <32.09%> (-34.90%) ⬇️
pytest-gpu-nvc-nvidiaX ?

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 2 times, most recently from 174023a to 29d0ec9 Compare May 19, 2026 12:56
@mloubout mloubout force-pushed the multi-cond-again branch from 29d0ec9 to ef708e5 Compare May 22, 2026 15:12
@mloubout mloubout force-pushed the multi-cond-again branch from ef708e5 to b997156 Compare May 22, 2026 15:13
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