Skip to content

(towards #2971) move ACC loop trans and OMP parallel loop trans#3066

Merged
arporter merged 24 commits intomasterfrom
2971_move_accloop_ompparallelloop_trans
May 1, 2026
Merged

(towards #2971) move ACC loop trans and OMP parallel loop trans#3066
arporter merged 24 commits intomasterfrom
2971_move_accloop_ompparallelloop_trans

Conversation

@victoria-atkinson
Copy link
Copy Markdown
Collaborator

No description provided.

@victoria-atkinson victoria-atkinson changed the base branch from 2971_move_transformations to master July 29, 2025 14:51
@arporter
Copy link
Copy Markdown
Member

Sorry to crash the party but I've just found a bug in OMPParallelTrans and, since I think you're moving it in this PR, it would be good to fix it. We have:

    def validate(self, node_list, options=None):
        '''
        Perform OpenMP-specific validation checks.

        :param node_list: list of Nodes to put within parallel region.
        :type node_list: list of :py:class:`psyclone.psyir.nodes.Node`
        :param options: a dictionary with options for transformations.
        :type options: Optional[Dict[str, Any]]
        :param bool options["node-type-check"]: this flag controls if the \
                type of the nodes enclosed in the region should be tested \
                to avoid using unsupported nodes inside a region.

        :raises TransformationError: if the target Nodes are already within \
                                     some OMP parallel region.
        '''
        if node_list[0].ancestor(OMPDirective):
            raise TransformationError("Error in OMPParallel transformation:" +
                                      " cannot create an OpenMP PARALLEL " +
                                      "region within another OpenMP region.")

and thus we fall over if the supplied node_list is a single Node. Since RegionTrans (which this class inherits from) permits node_list to be a single Node, this class should too. I think all that is needed is to add:

        node_list = self.get_node_list(node_list)
        if node_list[0].ancestor....

We'd also need to add a new test that calling OMPParallelTrans.validate works OK if provided with just a single Node rather than a list.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.96%. Comparing base (0ec7bbb) to head (a273c37).
⚠️ Report is 25 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3066   +/-   ##
=======================================
  Coverage   99.96%   99.96%           
=======================================
  Files         389      391    +2     
  Lines       54620    54629    +9     
=======================================
+ Hits        54601    54610    +9     
  Misses         19       19           

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

@victoria-atkinson
Copy link
Copy Markdown
Collaborator Author

@sergisiso @LonelyCat124 @arporter this is ready for review, thank you!

Copy link
Copy Markdown
Member

@arporter arporter left a comment

Choose a reason for hiding this comment

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

Nice job @victoria-atkinson - thanks :-)
Just some minor tidying up to do.
I'll fire off the integration tests in the meantime.

Comment thread src/psyclone/psyir/transformations/acc_loop_trans.py Outdated
Comment thread src/psyclone/psyir/transformations/acc_loop_trans.py Outdated
Comment thread src/psyclone/psyir/transformations/omp_parallel_loop_trans.py Outdated
Comment thread src/psyclone/psyir/transformations/omp_parallel_loop_trans.py Outdated
Comment thread src/psyclone/psyir/transformations/omp_parallel_loop_trans.py Outdated
Comment thread src/psyclone/tests/psyir/transformations/transformations_test.py Outdated
Comment thread src/psyclone/psyir/transformations/acc_loop_trans.py
Comment thread src/psyclone/psyir/transformations/omp_parallel_loop_trans.py
Comment thread src/psyclone/transformations.py
Comment thread tutorial/practicals/generic/4_openacc/solutions/collapse_trans.py Outdated
@victoria-atkinson
Copy link
Copy Markdown
Collaborator Author

@arporter Thanks for reviewing Andy :) I think it's ready for review again

Copy link
Copy Markdown
Member

@arporter arporter left a comment

Choose a reason for hiding this comment

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

Thanks Victoria, very nearly there now.
I see the ITs were green - whoop :-)

Comment thread src/psyclone/psyir/transformations/acc_loop_trans.py Outdated
Comment thread src/psyclone/psyir/transformations/acc_loop_trans.py Outdated
Comment thread src/psyclone/psyir/transformations/acc_loop_trans.py
@arporter
Copy link
Copy Markdown
Member

Hi @victoria-atkinson, if you could fix the linting error and bring this up to master, I'll take another look. Thanks :-)

Copy link
Copy Markdown
Member

@arporter arporter left a comment

Choose a reason for hiding this comment

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

Thanks Victoria, that all looks good now.
Will proceed to merge.

@arporter
Copy link
Copy Markdown
Member

arporter commented May 1, 2026

This is just waiting on #3422 now.

@arporter
Copy link
Copy Markdown
Member

arporter commented May 1, 2026

On discussion with @LonelyCat124, this is going to jump #3422 now as that still has a bit to do.

@arporter
Copy link
Copy Markdown
Member

arporter commented May 1, 2026

The linkspector failure is the known issue of the LFRic Met Office page and is being dealt with elsewhere.

@arporter arporter merged commit e481860 into master May 1, 2026
12 of 15 checks passed
@arporter arporter deleted the 2971_move_accloop_ompparallelloop_trans branch May 1, 2026 12:36
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.

3 participants