Skip to content

(Closes #3334) Make module-inlining mandatory for Kernel transformations#3388

Open
arporter wants to merge 22 commits intomasterfrom
3334_take_two
Open

(Closes #3334) Make module-inlining mandatory for Kernel transformations#3388
arporter wants to merge 22 commits intomasterfrom
3334_take_two

Conversation

@arporter
Copy link
Copy Markdown
Member

A second attempt at this after my git fu let me down badly.
Original changes are here: https://github.com/stfc/PSyclone/pull/3294/changes#diff-436bf7f3b5f30b4c1d6ff1f9a0a8e144f924bae78cbcc9595b30fc5954e715e0

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.95%. Comparing base (8dd90f5) to head (5032ef7).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3388      +/-   ##
==========================================
- Coverage   99.95%   99.95%   -0.01%     
==========================================
  Files         387      388       +1     
  Lines       54310    54202     -108     
==========================================
- Hits        54288    54180     -108     
  Misses         22       22              

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

@arporter
Copy link
Copy Markdown
Member Author

ITs were all green and coverage is now OK. Ready for a first review from @hiker, @LonelyCat124 or @sergisiso.

@sergisiso
Copy link
Copy Markdown
Collaborator

I got worried that the previous PR which still had several open comments ended saying it was merged:
image

But what happened is that those commits were part of the 1734_stricter_symbols branch, with follow up commits reverting the changes, and github spoted that those were merged. @arporter This is probably why you coudn't see the changes after brining the branch it to master, the master history already had those commits plus commits reverting them.

Anyway I've checked that the comments I made in the previous PR are now addressed or ported to the new review.

Copy link
Copy Markdown
Collaborator

@sergisiso sergisiso left a comment

Choose a reason for hiding this comment

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

@arporter Most comments raised in the other PR are now resolved. There is just some minor clean up/clarfications to do.

Comment on lines -105 to -106
--kernel-renaming {multiple,single}
(psykal mode) naming scheme to use when re-naming transformed kernels
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

psyclone -h still has this flag because the changes to generator.py has not been ported to this second take branch.

There are also other kernel-renaming mentions here:

doc/user_guide/transformations.rst
582:two different kernel-renaming schemes: "multiple" and "single"
583:(specified via the ``--kernel-renaming`` command-line flag). In the

src/psyclone/configuration.py
742:                            kernel-renaming scheme.

src/psyclone/generator.py
239:    :raises GenerationError: if an invalid kernel-renaming scheme is specified.
276:            f"Invalid kernel-renaming scheme supplied: {str(verr)}") from verr
534:        '--kernel-renaming', default="multiple",

src/psyclone/tests/generator_test.py
1681:    kernel-renaming scheme is supplied.
1693:    assert "Invalid kernel-renaming scheme supplied" in str(err.value)

Comment on lines -2319 to -2329
for kernel in kernels:
try:
kernel.check_outer_scope_accesses(
node, "Kernel",
permit_unresolved=False,
ignore_non_data_accesses=True)
except SymbolError as err:
raise TransformationError(
f"Cannot apply {self.name} to Kernel '{node.name}' "
f"because it accesses data from its outer scope: "
f"{err.value}") from err
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not sure we can delete this.

You added the comment "This also implies that there are no unqualified imports or undeclared symbols.", do you mean that module-inlining would have failed? Can we not have a pre-existing local routine with unqualified imports?

Or a kernel that was module-inlined, then another transformation or script adds an unqualifired import, then we apply this.

assert isinstance(kschedule.symbol_table.lookup("xstart").interface,
ArgumentInterface)
assert isinstance(kschedule.symbol_table.lookup("xstop").interface,
assert isinstance(kschedule.symbol_table.lookup("xstop_1").interface,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why did this name change?

self._check_callee_implementation_is_local(node)

def apply(self, node, **kwargs):
'''
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe add "Do nothing" here and "Call CalleeTransformationMixin validation" in the validate docstring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants