Skip to content

Commit

Permalink
#1623 Updated example 2.18 to new trans parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiker committed Jan 14, 2025
1 parent 7801f27 commit 2e0c905
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,17 @@
from psyclone.gocean1p0 import GOKern, GOLoop


def trans(psy):
def trans(psyir):
'''
Take the supplied psy object, and fuse the first two loops
Take the supplied psyir object, and fuse all loops
:param psy: the PSy layer to transform.
:type psy: :py:class:`psyclone.psyGen.PSy`
:returns: the transformed PSy object.
:rtype: :py:class:`psyclone.psyGen.PSy`
:param psyir: the PSyIR of the PSy-layer.
:type psyir: :py:class:`psyclone.psyir.nodes.FileContainer`
'''
invoke = psy.invokes.get("invoke_compute")
schedule = invoke.schedule

# We know that there is only one schedule
schedule = psyir.walk(InvokeSchedule)[0]

# Inline all kernels to help gfortran with inlining.
inline = KernelModuleInlineTrans()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -----------------------------------------------------------------------------
# BSD 3-Clause License
#
# Copyright (c) 2024, Science and Technology Facilities Council.
# Copyright (c) 2024-2025, Science and Technology Facilities Council.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -40,8 +40,9 @@

from psyclone.domain.common.transformations import KernelModuleInlineTrans
from psyclone.domain.gocean.transformations import GOceanLoopFuseTrans
from psyclone.psyir.transformations import TransformationError
from psyclone.gocean1p0 import GOKern, GOLoop
from psyclone.psyir.transformations import TransformationError
from psyclone.psyGen import InvokeSchedule


def apply_all(node_list, transform):
Expand Down Expand Up @@ -97,19 +98,16 @@ def apply_all(node_list, transform):


# -----------------------------------------------------------------------------
def trans(psy):
def trans(psyir):
'''
Take the supplied psy object, and fuse the first two loops
:param psy: the PSy layer to transform.
:type psy: :py:class:`psyclone.psyGen.PSy`
:returns: the transformed PSy object.
:rtype: :py:class:`psyclone.psyGen.PSy`
Take the supplied psy object, and fuse loops as much as possible.
:param psyir: the PSyIR of the PSy-layer.
:type psyir: :py:class:`psyclone.psyir.nodes.FileContainer`
'''
invoke = psy.invokes.get("invoke_compute")
schedule = invoke.schedule

# We know that there is only one schedule
schedule = psyir.walk(InvokeSchedule)[0]

# Inline all kernels to help gfortran with inlining.
inline = KernelModuleInlineTrans()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -----------------------------------------------------------------------------
# BSD 3-Clause License
#
# Copyright (c) 2024, Science and Technology Facilities Council.
# Copyright (c) 2024-2025, Science and Technology Facilities Council.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -40,8 +40,9 @@

from psyclone.domain.common.transformations import KernelModuleInlineTrans
from psyclone.domain.gocean.transformations import GOceanLoopFuseTrans
from psyclone.psyir.transformations import TransformationError
from psyclone.gocean1p0 import GOKern, GOLoop
from psyclone.psyir.transformations import TransformationError
from psyclone.psyGen import InvokeSchedule


def apply_all(node_list, transform):
Expand Down Expand Up @@ -107,19 +108,16 @@ def apply_all(node_list, transform):
del siblings[0]


def trans(psy):
def trans(psyir):
'''
Take the supplied psy object, and fuse the first two loops
:param psy: the PSy layer to transform.
:type psy: :py:class:`psyclone.psyGen.PSy`
Take the supplied psy object, and fuse all loops as much as possible
:returns: the transformed PSy object.
:rtype: :py:class:`psyclone.psyGen.PSy`
:param psyir: the PSyIR of the PSy-layer.
:type psyir: :py:class:`psyclone.psyir.nodes.FileContainer`
'''
invoke = psy.invokes.get("invoke_compute")
schedule = invoke.schedule
# We know that there is only one schedule
schedule = psyir.walk(InvokeSchedule)[0]

# Inline all kernels to help gfortran with inlining.
inline = KernelModuleInlineTrans()
Expand Down

0 comments on commit 2e0c905

Please sign in to comment.