Skip to content

Conversation

FabioLuporini
Copy link
Contributor

Extended version of #2708

Copy link

codecov bot commented Aug 14, 2025

Codecov Report

❌ Patch coverage is 87.42138% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.08%. Comparing base (4ee88fb) to head (0917757).

Files with missing lines Patch % Lines
devito/passes/iet/definitions.py 72.72% 6 Missing and 3 partials ⚠️
devito/ir/cgen/printer.py 33.33% 4 Missing ⚠️
devito/passes/iet/engine.py 75.00% 4 Missing ⚠️
devito/arch/archinfo.py 0.00% 2 Missing ⚠️
devito/symbolics/extended_sympy.py 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2717      +/-   ##
==========================================
- Coverage   92.10%   92.08%   -0.03%     
==========================================
  Files         248      248              
  Lines       49654    49739      +85     
  Branches     4368     4373       +5     
==========================================
+ Hits        45734    45801      +67     
- Misses       3213     3228      +15     
- Partials      707      710       +3     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 71.03% <66.42%> (-0.04%) ⬇️
pytest-gpu-nvc-nvidiaX 72.02% <66.42%> (-0.03%) ⬇️

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.

Copy link
Contributor

@mloubout mloubout left a comment

Choose a reason for hiding this comment

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

Minor comments but looks good

@@ -117,6 +129,17 @@ def __mul__(self, other):
return super().__mul__(other)


class Terminal:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that really needed?

self.tensor = tensor

def _hashable_content(self):
return super()._hashable_content() + (self.tensor,)
Copy link
Contributor

Choose a reason for hiding this comment

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

self.tensor._hashable_content() might be more efficient

Copy link
Contributor

Choose a reason for hiding this comment

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

But couldn't that potentially cause key clashes if you somehow had both a FunctionMap and its tensor in the same mapper/set? I would say the current one is safer imo

@@ -127,6 +127,8 @@ class Array(ArrayBasic):

is_Array = True

_symbol_prefix = 'a'
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

self._directions = frozendict(directions)
directions = directions or {}
directions = {d: v for d, v in directions.items() if d in self.intervals}
directions.update({i.dim: Any for i in self.intervals
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth renaming the direction Any to avoid potential squatting on typing.Any?

directions = {d: v for d, v in directions.items() if d in self.intervals}
directions.update({i.dim: Any for i in self.intervals
if i.dim not in directions})
self._directions = frozendict(directions)

def __repr__(self):
ret = ', '.join(["%s%s" % (repr(i), repr(self.directions[i.dim]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover non-fstring

else:
definition = (decl)
definition = (decl, init)
efuncs = ()

frees = obj._C_free

if obj.free_symbols - {obj}:
Copy link
Contributor

Choose a reason for hiding this comment

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

kwargs = {'objs' if obj.free_symbols - {obj} else 'standalones': definition,
          efuncs': efuncs, 'frees': frees}
storage.update(obj, site, **kwargs)

perhaps?

self.tensor = tensor

def _hashable_content(self):
return super()._hashable_content() + (self.tensor,)
Copy link
Contributor

Choose a reason for hiding this comment

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

But couldn't that potentially cause key clashes if you somehow had both a FunctionMap and its tensor in the same mapper/set? I would say the current one is safer imo

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.

3 participants