|
12 | 12 | import warnings |
13 | 13 |
|
14 | 14 | from psyclone.configuration import Config |
15 | | -from psyclone.errors import InternalError |
16 | | -from psyclone.psyGen import InvokeSchedule, Kern |
17 | 15 | from psyclone.psyir.nodes import Node, PSyDataNode, Schedule, Return, \ |
18 | 16 | OMPDoDirective, ACCDirective, ACCLoopDirective, Routine |
19 | 17 | from psyclone.psyir.transformations.region_trans import RegionTrans |
@@ -84,62 +82,6 @@ class name as a string, which means that the same function can |
84 | 82 |
|
85 | 83 | return self.__class__.__name__ |
86 | 84 |
|
87 | | - # ------------------------------------------------------------------------ |
88 | | - def get_unique_region_name(self, nodes, options): |
89 | | - '''This function returns the region and module name. If they are |
90 | | - specified in the user options, these names will just be returned (it |
91 | | - is then up to the user to guarantee uniqueness). Otherwise a name |
92 | | - based on the module and invoke will be created using indices to |
93 | | - make sure the name is unique. |
94 | | -
|
95 | | - :param nodes: a list of nodes. |
96 | | - :type nodes: list of :py:obj:`psyclone.psyir.nodes.Node` |
97 | | - :param options: a dictionary with options for transformations. |
98 | | - :type options: Dict[str, Any] |
99 | | - :param (str,str) options["region_name"]: an optional name to \ |
100 | | - use for this PSyData area, provided as a 2-tuple containing a \ |
101 | | - location name followed by a local name. The pair of strings \ |
102 | | - should uniquely identify a region unless aggregate information \ |
103 | | - is required (and is supported by the runtime library). |
104 | | -
|
105 | | - ''' |
106 | | - # We don't use a static method here since it might be useful to |
107 | | - # overwrite this functions in derived classes |
108 | | - name = options.get("region_name", None) |
109 | | - if name: |
110 | | - # pylint: disable=too-many-boolean-expressions |
111 | | - if not isinstance(name, tuple) or not len(name) == 2 or \ |
112 | | - not name[0] or not isinstance(name[0], str) or \ |
113 | | - not name[1] or not isinstance(name[1], str): |
114 | | - raise InternalError( |
115 | | - "Error in PSyDataTrans. The name must be a " |
116 | | - "tuple containing two non-empty strings.") |
117 | | - # pylint: enable=too-many-boolean-expressions |
118 | | - # Valid PSyData names have been provided by the user. |
119 | | - return name |
120 | | - |
121 | | - invoke = nodes[0].ancestor(InvokeSchedule).invoke |
122 | | - module_name = invoke.invokes.psy.name |
123 | | - |
124 | | - # Use the invoke name as a starting point. |
125 | | - region_name = invoke.name |
126 | | - kerns = [] |
127 | | - for node in nodes: |
128 | | - kerns.extend(node.walk(Kern)) |
129 | | - |
130 | | - if len(kerns) == 1: |
131 | | - # This PSyData region only has one kernel within it, |
132 | | - # so append the kernel name. |
133 | | - region_name += f"-{kerns[0].name}" |
134 | | - |
135 | | - # Add a region index to ensure uniqueness when there are |
136 | | - # multiple regions in an invoke. |
137 | | - key = module_name + "|" + region_name |
138 | | - idx = PSyDataTrans._used_kernel_names.get(key, 0) |
139 | | - PSyDataTrans._used_kernel_names[key] = idx + 1 |
140 | | - region_name += f"-r{idx}" |
141 | | - return (module_name, region_name) |
142 | | - |
143 | 85 | # ------------------------------------------------------------------------ |
144 | 86 | def validate(self, nodes: Union[Node, list[Node]], |
145 | 87 | options: Optional[dict[str, Any]] = None, |
|
0 commit comments