Reference Guide  2.5.0
psyclone.gocean1p0.GOInvokes Class Reference
Inheritance diagram for psyclone.gocean1p0.GOInvokes:
Collaboration diagram for psyclone.gocean1p0.GOInvokes:

Public Member Functions

def __init__ (self, alg_calls, psy)
 
def gen_code (self, parent)
 
- Public Member Functions inherited from psyclone.psyGen.Invokes
def __init__ (self, alg_calls, invoke_cls, psy)
 
def __str__ (self)
 
def psy (self)
 
def names (self)
 
def get (self, invoke_name)
 

Additional Inherited Members

- Public Attributes inherited from psyclone.psyGen.Invokes
 invoke_map
 
 invoke_list
 

Detailed Description

The GOcean specific invokes class. This passes the GOcean specific
invoke class to the base class so it creates the one we require.

:param alg_calls: The Invoke calls discovered in the Algorithm layer.
:type alg_calls: OrderedDict of :py:class:`psyclone.parse.InvokeCall` \
    objects.
:param psy: the PSy object containing this GOInvokes object.
:type psy: :py:class:`psyclone.gocean1p0.GOPSy`

Definition at line 127 of file gocean1p0.py.

Member Function Documentation

◆ gen_code()

def psyclone.gocean1p0.GOInvokes.gen_code (   self,
  parent 
)
GOcean redefines the Invokes.gen_code() to start using the PSyIR
backend when possible. In cases where the backend can not be used yet
(e.g. OpenCL and PSyDataNodes) the parent class will be called. This
is a temporary workaround to avoid modifying the generator file while
other APIs still use the f2pygen module for code generation.
Once the PSyIR backend has generated an output, this is added into a
f2pygen PSyIRGen block in the f2pygen AST for each Invoke in the
PSy layer.

:param parent: the parent node in the f2pygen AST to which to add \
               content.
:type parent: `psyclone.f2pygen.ModuleGen`

Reimplemented from psyclone.psyGen.Invokes.

Definition at line 169 of file gocean1p0.py.

169  def gen_code(self, parent):
170  '''
171  GOcean redefines the Invokes.gen_code() to start using the PSyIR
172  backend when possible. In cases where the backend can not be used yet
173  (e.g. OpenCL and PSyDataNodes) the parent class will be called. This
174  is a temporary workaround to avoid modifying the generator file while
175  other APIs still use the f2pygen module for code generation.
176  Once the PSyIR backend has generated an output, this is added into a
177  f2pygen PSyIRGen block in the f2pygen AST for each Invoke in the
178  PSy layer.
179 
180  :param parent: the parent node in the f2pygen AST to which to add \
181  content.
182  :type parent: `psyclone.f2pygen.ModuleGen`
183  '''
184  if self.invoke_list:
185  # We just need one invoke as they all have a common root.
186  invoke = self.invoke_list[0]
187 
188  # Lower the GOcean PSyIR to language level so it can be visited
189  # by the backends
190  invoke.schedule.root.lower_to_language_level()
191  # Then insert it into a f2pygen AST as a PSyIRGen node.
192  # Note that other routines besides the Invoke could have been
193  # inserted during the lowering (e.g. module-inlined kernels),
194  # so have to iterate over all current children of root.
195  for child in invoke.schedule.root.children:
196  parent.add(PSyIRGen(parent, child))
197 
198 

References psyclone.nemo.NemoInvokes.invoke_list, and psyclone.psyGen.Invokes.invoke_list.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: