Skip to content

compiler: Revamp fuse-task optoption#2975

Open
FabioLuporini wants to merge 9 commits into
mainfrom
fuse-tasks-groups
Open

compiler: Revamp fuse-task optoption#2975
FabioLuporini wants to merge 9 commits into
mainfrom
fuse-tasks-groups

Conversation

@FabioLuporini

Copy link
Copy Markdown
Contributor

I'm also renaming it into what it should always have been in the first place -- 'npthreads'. This is an undocumented option anyway and no-one is using it, so I think it's perfectly safe

More tests in PRO

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.32710% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.56%. Comparing base (0aa772b) to head (3afe7c7).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
devito/passes/iet/orchestration.py 92.92% 4 Missing and 4 partials ⚠️
devito/passes/clusters/buffering.py 93.93% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2975      +/-   ##
==========================================
+ Coverage   83.54%   83.56%   +0.02%     
==========================================
  Files         257      257              
  Lines       53591    53779     +188     
  Branches     4585     4611      +26     
==========================================
+ Hits        44770    44943     +173     
- Misses       8028     8037       +9     
- Partials      793      799       +6     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.52% <92.05%> (+0.12%) ⬆️
pytest-gpu-gcc- 78.18% <23.36%> (-0.22%) ⬇️
pytest-gpu-icx- 78.10% <23.36%> (-0.23%) ⬇️
pytest-gpu-nvc-nvidiaX 69.16% <92.05%> (+0.10%) ⬆️

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

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

@mloubout mloubout left a comment

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.

Looks sane, probably gonna make #2850 a pain

Comment thread devito/core/cpu.py
# Fusion
o['fuse-tasks'] = oo.pop('fuse-tasks', False)
# Tasking
o['npthreads'] = oo.pop('npthreads', 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.

nitpicking: might wanna throw a warning, or oo.pop('npthreads', oo.pop('fuse-tasks', None) for "safety"

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.

OK

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 there any documentation that needs updating to reflect this change?

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

Comment thread devito/passes/clusters/asynchrony.py Outdated
return None

gid, = gids
return gid

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.

just return gids.pop()

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

Comment thread devito/core/cpu.py
# Fusion
o['fuse-tasks'] = oo.pop('fuse-tasks', False)
# Tasking
o['npthreads'] = oo.pop('npthreads', 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.

Is there any documentation that needs updating to reflect this change?

Comment thread devito/ir/iet/nodes.py Outdated
Comment on lines +1562 to +1563
optype, = {type(op) for spot in self.sync_spots
for op in spot.sync_ops}

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.

This should probably have some kind of error handling or at least an assert for the case there are mixed types here (and the set is not length-1), otherwise it's potentially going to lead to cryptic errors or even silent errors if the ValueError gets ingested by a try-except

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

self.dim = dim
self.size = size
self.origin = origin
self.gid = gid

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.

What does gid stand for?

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.

adding a docstring, but basically group id (a la Linux)

Comment thread devito/passes/iet/orchestration.py Outdated
body=Conditional(task.condition.condition,
task.spot.body))
for task in tasks]
insertions[tasks[-1].anchor].append(SyncSpotRegion(spots))

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.

Nitpick: pulling out tasks[-1].anchor and assigning a descriptive variable name would improve readability here

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 changed already, I knew I may still have had to tweak a couple of things, including this one

Comment thread devito/passes/iet/orchestration.py Outdated
return iet, [efunc]
layers = {infer_layer(i.function) for i in sync_ops}
if len(layers) != 1:
raise CompilationError("Unsupported streaming case")

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.

Nitpick: worth adding why to the error?

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.

those 4 lines also appear in another place, so I'll move them into a utility function and improve the error message as per your suggestion

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