Skip to content

compiler: Misc enhancements for lowering of parlang backends #2878

Open
FabioLuporini wants to merge 7 commits intomainfrom
more-TMA-enhance
Open

compiler: Misc enhancements for lowering of parlang backends #2878
FabioLuporini wants to merge 7 commits intomainfrom
more-TMA-enhance

Conversation

@FabioLuporini
Copy link
Copy Markdown
Contributor

No description provided.

if not exprs:
return properties

# Auto-detect prefetchable Dimensions
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.

now unused, hence dropping

return schedule.rebuild(*processed, rmapper=rmapper)


def optimize_schedule_maxpar(schedule):
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.

this is 95% just like before, but it now also triggers in some rare cases excited in PRO

def _time_buffering_default(self):
return self._time_buffering and not isinstance(self.save, Buffer)

def _evaluate(self, **kwargs):
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.

@mloubout dropped as per your suggestion

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 84.61538% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.44%. Comparing base (c189f61) to head (c61b8cc).

Files with missing lines Patch % Lines
devito/ir/iet/efunc.py 57.14% 9 Missing ⚠️
devito/ir/clusters/cluster.py 92.59% 2 Missing ⚠️
devito/types/parallel.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2878      +/-   ##
==========================================
+ Coverage   83.42%   83.44%   +0.01%     
==========================================
  Files         248      248              
  Lines       51262    51306      +44     
  Branches     4431     4428       -3     
==========================================
+ Hits        42765    42811      +46     
- Misses       7735     7738       +3     
+ Partials      762      757       -5     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.81% <81.69%> (+0.04%) ⬆️
pytest-gpu-gcc- 78.04% <84.61%> (+0.02%) ⬆️
pytest-gpu-icx- 77.68% <84.61%> (+0.05%) ⬆️
pytest-gpu-nvc-nvidiaX 69.33% <81.69%> (+0.05%) ⬆️

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.

libs: tuple = ()

@classmethod
def from_body(cls, body):
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.

Does this really need a method? That just EFuncMetadata(body=body)

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.

Seconded

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.

Actually, it does improve readability elsewhere, so I'm not entirely opposed

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.

no, AI garbage, removing


@classmethod
def compose(cls, *items):
items = tuple(i for i in items if i is not None)
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 would an item be None?

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.

AI garbage leftover, removing

return cls()

return cls(
body=items[-1].body,
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 -1?

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.

this is because the idea is that you may have a sequence of IET passes

pseudocode example:

v0 = pass0(...)
v1 = pass1(..., body=v0.body)
v2 = pass2(..., body=v1.body)  

and each of those passes introduces different includes/libs/efuncs/...

in the end you want the union of various includes/libs/efuncs/... but the body of the last pass

so you EfuncMeta.compose(v0, v1, v2) and that way it will use v2's body


return cls(
body=items[-1].body,
efuncs=tuple(chain.from_iterable(i.efuncs for i in items)),
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 just our as_tuple and should be used. If this chain.from_iterable is more efficient then as_tuple should be updated (same for as_list)

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.

no it's an iterable of an iterable that you're chaining together here



@dataclass(frozen=True)
class EFuncMetadata:
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.

Since this clearly looks like it's for an IET pass return, it should be used throughout or at least for the efunc realted ones.

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.

yes, one of the reasons I put it in OSS... but that would be massive changes, I'd rather do it incrementally

also, changing the name to EFuncMeta

libs: tuple = ()

@classmethod
def from_body(cls, body):
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.

Seconded

pass


class ThreadArrive(Fence):
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.

Is this to make use of more sophisticated/granular thread barriers to reduce idle time somewhere?

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.

pretty much yes

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