Skip to content

Commit 8b7e238

Browse files
authored
Merge pull request #1745 from stfc/1731_split_loop_class
(towards #1731) Split PSyLoop node from Loop
2 parents 19fdbed + 5e08f21 commit 8b7e238

File tree

23 files changed

+813
-420
lines changed

23 files changed

+813
-420
lines changed

changelog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
1) PR #1747 for #1720. Adds support for If blocks to PSyAD.
2+
23
2) PR #1669 for #450. Remove set_dirty/clean from ACC regions
34

5+
3) PR #1745 towards #1731. Split PSyLoop class from Loop node.
6+
47
release 2.3.0 9th June 2022
58

69
1) PR #1672. Fixes BOZ literal standard incompatibility in the

doc/developer_guide/psyir.rst

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -410,28 +410,17 @@ Annotation Node types Origin
410410
Loop Node
411411
^^^^^^^^^
412412

413-
The `Loop` node is sub-classed in all of the domains supported by
414-
PSyclone. This then allows the class to be configured with a
415-
domain-specific list of valid loop 'types'. For instance, the GOcean
416-
sub-class, `GOLoop`, has "inner" and "outer" while the LFRic
417-
(dynamo0.3) sub-class, `DynLoop`, has "dofs", "colours", "colour", ""
418-
and "null". The default loop type (iterating over cells) is here
419-
indicated by the empty string. The concept of a "null" loop type is
420-
currently required because the dependency analysis that determines the
421-
placement of halo exchanges is handled within the `Loop` class. As a
422-
result, every `Kernel` call must be associated with a `Loop` node.
423-
However, the LFRic domain has support for kernels which operate on the
424-
'domain' and thus do not require a loop over cells or dofs in the
425-
generated PSy layer. Supporting a `DynLoop` of "null" type allows us
426-
to retain the dependence-analysis functionality within the `Loop`
427-
while not actually producing a loop in the generated code. When
428-
`#1148 <https://github.com/stfc/PSyclone/issues/1148>`_ is tackled,
429-
the dependence-analysis functionality will be removed from
430-
the `Loop` class and this concept of a "null" loop can be dropped.
413+
The `Loop` node is the cannonical representation of a bounded loop, it
414+
has the start, stop, step and loop_body of the loop as its children. The
415+
node has the same semantics than the Fortran do construct: the boundary
416+
values are inclusive (both are part of the iteration space) and the start,
417+
stop and step expressions are evaluated just once at the beginning of the
418+
loop.
431419

432420
For more details on the `Loop` node, see the full API in the
433421
:ref_guide:`reference guide psyclone.psyir.nodes.html#psyclone.psyir.nodes.Loop`.
434422

423+
435424
Ranges
436425
------
437426

@@ -790,11 +779,53 @@ symbols, transformations, front-ends and back-ends. None of this is
790779
domain specific.
791780

792781
To obtain domain-specific concepts the language-level PSyIR can be
793-
specialised or extended. In LFRic there are specialisations for
782+
specialised or extended. All domains follow the PSyKAl separation of
783+
concerns with the Algorithm-layer and the PSy-layer having its own
784+
domain-specific concepts, this can be found in
785+
``psyclone.domain.common.algorithm`` and ``psyclone.domain.common.psylayer``
786+
respectively (some concepts are still on ``psyclone.psyGen`` for legacy
787+
reasons but will be moved to the new locations over time).
788+
789+
PSy-layer concepts
790+
------------------
791+
792+
* The `PSyLoop` is a `Loop` where the boundaries are given by the domain
793+
specific iteration space that the kernels are applied to. In turn it is
794+
sub-classed in all of the domains supported by PSyclone. This then allows
795+
the class to be configured with a list of valid loop 'types'. For instance,
796+
the GOcean sub-class, `GOLoop`, has "inner" and "outer" while the LFRic
797+
(dynamo0.3) sub-class, `DynLoop`, has "dofs", "colours", "colour", ""
798+
and "null". The default loop type (iterating over cells) is here
799+
indicated by the empty string. The concept of a "null" loop type is
800+
currently required because the dependency analysis that determines the
801+
placement of halo exchanges is handled within the `Loop` class. As a
802+
result, every `Kernel` call must be associated with a `Loop` node.
803+
However, the LFRic domain has support for kernels which operate on the
804+
'domain' and thus do not require a loop over cells or dofs in the
805+
generated PSy layer. Supporting a `DynLoop` of "null" type allows us
806+
to retain the dependence-analysis functionality within the `Loop`
807+
while not actually producing a loop in the generated code. When
808+
`#1148 <https://github.com/stfc/PSyclone/issues/1148>`_ is tackled,
809+
the dependence-analysis functionality will be removed from
810+
the `Loop` class and this concept of a "null" loop can be dropped.
811+
* The `Kern`, which can be of type `CodedKern`, `InlinedKern` or `BuiltIn`
812+
are the singular units of computation that can be found inside a
813+
`PSyLoop`.
814+
* The `HaloExchange` is a distributed-memory concept in the PSy-layer.
815+
* The `GlobalSum` is a distributed-memory concept in the PSy-layer.
816+
817+
818+
Other specializations
819+
---------------------
820+
821+
In LFRic there are specialisations for
794822
kernel-layer datatypes and symbols. For the algorithm layer in both
795823
GOcean1.0 and LFRic there are specialisations for invokes and kernel
796824
calls. This is discussed further in the following sections.
797825

826+
827+
828+
798829
The LFRic PSyIR
799830
===============
800831

psyclone.pdf

-3 Bytes
Binary file not shown.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# -----------------------------------------------------------------------------
2+
# BSD 3-Clause License
3+
#
4+
# Copyright (c) 2022, Science and Technology Facilities Council
5+
# All rights reserved.
6+
#
7+
# Redistribution and use in source and binary forms, with or without
8+
# modification, are permitted provided that the following conditions are met:
9+
#
10+
# * Redistributions of source code must retain the above copyright notice, this
11+
# list of conditions and the following disclaimer.
12+
#
13+
# * Redistributions in binary form must reproduce the above copyright notice,
14+
# this list of conditions and the following disclaimer in the documentation
15+
# and/or other materials provided with the distribution.
16+
#
17+
# * Neither the name of the copyright holder nor the names of its
18+
# contributors may be used to endorse or promote products derived from
19+
# this software without specific prior written permission.
20+
#
21+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25+
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
# POSSIBILITY OF SUCH DAMAGE.
33+
# -----------------------------------------------------------------------------
34+
# Authors S. Siso, STFC Daresbury Lab
35+
36+
'''A package module for psyclone.domain.common.psylayer'''
37+
38+
from psyclone.domain.common.psylayer.psyloop import PSyLoop
39+
40+
__all__ = ["PSyLoop"]

0 commit comments

Comments
 (0)