Skip to content

Conversation

@victoria-atkinson
Copy link
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
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.

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