Skip to content

(Closes #3334 #1013) Permit only module-inlined Kernels to be transformed#3294

Merged
sergisiso merged 46 commits intomasterfrom
1823_transform_inlined_kerns_only
Mar 23, 2026
Merged

(Closes #3334 #1013) Permit only module-inlined Kernels to be transformed#3294
sergisiso merged 46 commits intomasterfrom
1823_transform_inlined_kerns_only

Conversation

@arporter
Copy link
Copy Markdown
Member

@arporter arporter commented Jan 21, 2026

Require that all kernel transformations act only on module-inlined Kernels.
Do away with the 'rename-and-write' functionality currently used for modified kernels.
We have to keep the -okern command-line flag as that is used when creating OpenCL versions of Kernels.

@arporter arporter self-assigned this Jan 21, 2026
@arporter arporter marked this pull request as draft January 21, 2026 17:11
@arporter
Copy link
Copy Markdown
Member Author

Possibly I need to store the RoutineSymbol associated with a Kernel within the Kernel class (c.f. Call.reference). That way, I can tell whether it has been module-inlined or not and can get rid of the special flag for that.

@arporter
Copy link
Copy Markdown
Member Author

arporter commented Jan 23, 2026

Note to self: I will need to remove the kernel_outputdir test fixture.

EDIT: can't do this because we do still output OpenCL versions of kernels in some tests.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.95%. Comparing base (97543bc) to head (0949296).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3294      +/-   ##
==========================================
- Coverage   99.95%   99.95%   -0.01%     
==========================================
  Files         384      385       +1     
  Lines       54225    54087     -138     
==========================================
- Hits        54203    54065     -138     
  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

arporter commented Feb 4, 2026

Coverage is now all good but the LFRic extraction integration test failed :-(

@arporter
Copy link
Copy Markdown
Member Author

arporter commented Feb 4, 2026

In lfric/eg17/full_example_extract:

$ diff main_psy.f90 on_main/main_psy.f90 
4d3
<   use testkern_w0_kernel_mod, only : testkern_w0_code
74a74
>     use testkern_w0_kernel_mod, only : some_other_var, testkern_w0_code

so it appears the some_other_var import is missing on my branch.

@arporter
Copy link
Copy Markdown
Member Author

arporter commented Feb 4, 2026

This turned out to be due to the fact that I've moved the import of Kernel routines up into the Container and then the ExtractNode was falling foul of #1734

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 It's good to see this (even bigger) clean up.

I just have a some questions about why some lines were changed and it may be good to have a plan for when the KernelModuleInlineTrans is made generic (see inline).

Comment thread src/psyclone/psyir/transformations/omp_declare_target_trans.py
Comment thread src/psyclone/domain/common/transformations/kernel_transformation_mixin.py Outdated
Comment thread src/psyclone/domain/gocean/transformations/gocean_opencl_trans.py Outdated
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 has this changed? I am a bit worried about this one because if the call had argument names, this would not match anymore.

Comment thread doc/user_guide/psyclone_command.rst
Comment thread src/psyclone/psyGen.py
Comment thread src/psyclone/transformations.py
@arporter
Copy link
Copy Markdown
Member Author

Unfortunately, my change to ScopingNode.replace_symbols_using means that any local symbol that shadows an outer one gets replaced by the outer one. The problem I wanted to fix was where a local symbol depends on a symbol in an outer scope during a tree-copy operation. Child nodes are only attached into the new (copied) tree at the end of the copy operation - prior to that they can't see the parent scope. Therefore, only at this point can we update any references to symbols in the outer scope.

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