Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dcb25dc
#3398 mv redundant trans to own file
arporter Apr 20, 2026
3d9d608
#3398 fix remaining imports
arporter Apr 20, 2026
bdb9088
#3398 mv tests to own file
arporter Apr 20, 2026
0f2dd7b
#3398 WIP modernising options on transformation [skip ci]
arporter Apr 20, 2026
33901fd
#3398 fix linting [skip ci]
arporter Apr 20, 2026
8bded09
Merge branch 'master' into 3398_move_redun_trans
arporter Apr 27, 2026
b1828de
#3398 fix import path in docs
arporter Apr 27, 2026
ad49962
#3398 update to use kwargs
arporter Apr 27, 2026
2f62a96
#3398 update example scripts
arporter Apr 28, 2026
2a5db02
Merge branch 'master' into 3398_move_redun_trans
arporter Apr 28, 2026
2ae68a3
Merge branch 'master' into 3398_move_redun_trans
arporter Apr 29, 2026
77cf280
Merge branch 'master' into 3398_move_redun_trans
arporter Jun 2, 2026
c3d62d6
#3398 fix imports after merge
arporter Jun 2, 2026
a5b6f0a
#3398 move to relative imports
arporter Jun 2, 2026
4e881d3
#3398 fix implementation and begin updating tests [skip ci]
arporter Jun 2, 2026
acc71d4
#3398 fix linting [skip ci]
arporter Jun 2, 2026
24c8774
#3398 update tests and move more rc-specific ones out of lfric_transf…
arporter Jun 3, 2026
870b875
Merge branch 'master' into 3398_move_redun_trans
arporter Jun 3, 2026
43fb32e
#3398 fix linting in eg script
arporter Jun 3, 2026
afbc0cb
#3398 make test work with 3.9
arporter Jun 3, 2026
266114f
#3398 fix circular dep on Transformations import in utils.py
arporter Jun 4, 2026
3a01f80
#3398 fix text in type-check test
arporter Jun 4, 2026
d8050ab
Update changelog
LonelyCat124 Jun 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
28) PR #3417 towards #3398. Move LFRicRedundantComputationTrans into the
LFRic transformations module.

27) PR #3438 for #3435. Add support for sub_transformations in the kwargs
documentation functionality.

Expand Down
2 changes: 1 addition & 1 deletion doc/user_guide/lfric.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4160,7 +4160,7 @@ transformations have not yet been migrated to this directory.
:members:
:noindex:

.. autoclass:: psyclone.transformations.LFRicRedundantComputationTrans
.. autoclass:: psyclone.domain.lfric.transformations.LFRicRedundantComputationTrans
:members:
:noindex:

Expand Down
14 changes: 7 additions & 7 deletions examples/lfric/eg11/async_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@

'''

from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)
from psyclone.psyir.nodes import FileContainer
from psyclone.psyir.transformations import MoveTrans
from psyclone.transformations import LFRicAsyncHaloExchangeTrans

def trans(psyir):

def trans(psyir: FileContainer) -> None:
'''A sample transformation script to demonstrate the use of asynchronous
halo exchanges with overlapping compute and communication for the
most costly halo exchanges in the (current version of the) LFRic model.

:param psyir: the PSyIR of the PSy-layer.
:type psyir: :py:class:`psyclone.psyir.nodes.FileContainer`

'''
from psyclone.transformations import \
LFRicRedundantComputationTrans, \
LFRicAsyncHaloExchangeTrans
from psyclone.psyir.transformations import MoveTrans

# Get first subroutine of the first module
schedule = psyir.children[0].children[0]
print(schedule.view())
Expand Down
10 changes: 6 additions & 4 deletions examples/lfric/eg8/redundant_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,20 @@
repository but an operator has been replaced with a field in one of
the kernels to allow redundant computation'''

from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)
from psyclone.psyir.nodes import FileContainer
from psyclone.psyir.transformations import MoveTrans

def trans(psyir):

def trans(psyir: FileContainer) -> None:
'''Removes the grad_p halo exchanges by redundant computation then
moves the remaining halo exchanges to the beginning of the invoke
call.

:param psyir: the PSyIR of the PSy-layer.
:type psyir: :py:class:`psyclone.psyir.nodes.FileContainer`

'''
from psyclone.transformations import LFRicRedundantComputationTrans
from psyclone.psyir.transformations import MoveTrans
rc_trans = LFRicRedundantComputationTrans()
m_trans = MoveTrans()

Expand Down
8 changes: 4 additions & 4 deletions examples/lfric/scripts/everything_everywhere_all_at_once.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
'''
from psyclone.domain.common.transformations import KernelModuleInlineTrans
from psyclone.domain.lfric import LFRicConstants
from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)
from psyclone.lfric import LFRicHaloExchange, LFRicHaloExchangeStart
from psyclone.psyir.transformations import Matmul2CodeTrans, OMPParallelTrans
from psyclone.psyir.nodes import IntrinsicCall, KernelSchedule
from psyclone.psyGen import InvokeSchedule
from psyclone.transformations import LFRicColourTrans, \
LFRicOMPLoopTrans, \
LFRicRedundantComputationTrans, \
LFRicAsyncHaloExchangeTrans
from psyclone.transformations import (
LFRicColourTrans, LFRicOMPLoopTrans, LFRicAsyncHaloExchangeTrans)
from psyclone.psyir.transformations import MoveTrans, TransformationError

ENABLE_REDUNDANT_COMPUTATION = True
Expand Down
7 changes: 3 additions & 4 deletions examples/lfric/scripts/extract_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
# Author: J. Henrichs, Bureau of Meteorology

'''
PSyclone transformation script for the LFRic (Dynamo0p3) API to apply
PSyclone transformation script for the LFRic API to apply
redundant computation and then extract all kernels.

'''

from psyclone.domain.lfric import LFRicLoop
from psyclone.domain.lfric.transformations import LFRicExtractTrans

from psyclone.transformations import LFRicRedundantComputationTrans
from psyclone.domain.lfric.transformations import (
LFRicExtractTrans, LFRicRedundantComputationTrans)

SETVAL_BUILTINS = ["setval_c"]

Expand Down
3 changes: 2 additions & 1 deletion examples/lfric/scripts/gpu_offloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@
from psyclone.domain.common.transformations import KernelModuleInlineTrans
from psyclone.domain.lfric import LFRicConstants
from psyclone.domain.lfric.lfric_builtins import LFRicBuiltIn
from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)
from psyclone.psyir.nodes import (
Call, Directive, IntrinsicCall, Loop, Routine, Schedule)
from psyclone.psyir.transformations import (
ACCKernelsTrans, Matmul2CodeTrans, OMPTargetTrans, TransformationError,
OMPDeclareTargetTrans, OMPParallelTrans, ACCLoopTrans)
from psyclone.transformations import (
LFRicColourTrans, LFRicOMPLoopTrans,
LFRicRedundantComputationTrans,
ACCParallelTrans, ACCRoutineTrans,
OMPLoopTrans)

Expand Down
3 changes: 2 additions & 1 deletion examples/lfric/scripts/redundant_dofs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
iterate over dofs and do not contain a reduction.

'''
from psyclone.transformations import LFRicRedundantComputationTrans
from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)

ITERATION_SPACES = ["dofs"]
DEPTH = 1
Expand Down
3 changes: 2 additions & 1 deletion examples/lfric/scripts/redundant_setval_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
of loops that iterate over dofs and contain the setval_c builtin.

'''
from psyclone.transformations import LFRicRedundantComputationTrans
from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)

# We don't include "owned_dofs" here as we only want loops that
# are permitted to perform redundant computation.
Expand Down
19 changes: 7 additions & 12 deletions src/psyclone/domain/lfric/transformations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,10 @@
'''

# pylint: disable=unused-import
from psyclone.domain.lfric.transformations.lfric_alg_trans \
import LFRicAlgTrans
from psyclone.domain.lfric.transformations.lfric_alg_invoke_2_psy_call_trans \
import LFRicAlgInvoke2PSyCallTrans
from psyclone.domain.lfric.transformations.lfric_extract_trans \
import LFRicExtractTrans
from psyclone.domain.lfric.transformations.raise_psyir_2_lfric_alg_trans \
import RaisePSyIR2LFRicAlgTrans
from psyclone.domain.lfric.transformations.lfric_loop_fuse_trans \
import LFRicLoopFuseTrans
from psyclone.domain.lfric.transformations.raise_psyir_2_lfric_kern_trans \
import RaisePSyIR2LFRicKernTrans
from .lfric_alg_trans import LFRicAlgTrans
from .lfric_alg_invoke_2_psy_call_trans import LFRicAlgInvoke2PSyCallTrans
from .lfric_extract_trans import LFRicExtractTrans
from .raise_psyir_2_lfric_alg_trans import RaisePSyIR2LFRicAlgTrans
from .lfric_loop_fuse_trans import LFRicLoopFuseTrans
from .lfric_redundant_computation_trans import LFRicRedundantComputationTrans
from .raise_psyir_2_lfric_kern_trans import RaisePSyIR2LFRicKernTrans
Loading
Loading