Skip to content

Commit c677e59

Browse files
authored
'dmap', "domain map", and 'dmapped' updates in the spec (#23522)
This PR makes the following changes to the language spec: * Rename "domain map" to "distribution", based on a group discussion. * Remove the `dmap` type, since we are moving away from it. * Indicate that `dmapped` is unstable. * Switch from "domain map class" to "distribution record". * Switch from `Block` to `blockDist`. * General text and link improvements. r: @dlongnecke-cray
2 parents 00917d5 + c2796ec commit c677e59

File tree

6 files changed

+95
-111
lines changed

6 files changed

+95
-111
lines changed

doc/rst/language/spec/arrays.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ of homogeneous type. Since Chapel domains support a rich variety of
1111
index sets, Chapel arrays are also richer than the traditional linear or
1212
rectilinear array types in conventional languages. Like domains, arrays
1313
may be distributed across multiple locales without explicitly
14-
partitioning them using Chapel’s Domain
15-
Maps (:ref:`Chapter-Domain_Maps`).
14+
partitioning them using Chapel’s :ref:`distributions <Chapter-Domain_Maps>`.
1615

17-
Parallel Safety with respect to Arrays (and Domains)
18-
----------------------------------------------------
16+
Parallel Safety with respect to Arrays
17+
--------------------------------------
1918

2019
Users must take care when applying operations to arrays and domains
21-
concurrently from distinct tasks. For more information see the parallel safety
22-
section for domains (:ref:`Domain_and_Array_Parallel_Safety`).
20+
concurrently from distinct tasks. For more information see
21+
:ref:`the Parallel Safety section for domains <Domain_and_Array_Parallel_Safety>`.
2322

2423
.. _Array_Types:
2524

@@ -314,7 +313,7 @@ Runtime Representation of Array Values
314313
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315314

316315
The runtime representation of an array in memory is controlled by its
317-
domain’s domain map. Through this mechanism, users can reason about and
316+
domain’s distribution. Through this mechanism, users can reason about and
318317
control the runtime representation of an array’s elements. See
319318
 :ref:`Chapter-Domain_Maps` for more details.
320319

@@ -825,7 +824,7 @@ in :ref:`Formal_Arguments_of_Generic_Array_Types`.
825824
If a formal array argument specifies a domain as part of its type
826825
signature, the domain of the actual argument must represent the same
827826
index set. If the formal array’s domain was declared using an explicit
828-
domain map, the actual array’s domain must use an equivalent domain map.
827+
distribution, the actual array’s domain must use an equivalent distribution.
829828

830829
.. _Array_Promotion_of_Scalar_Functions:
831830

doc/rst/language/spec/domain-maps.rst

Lines changed: 76 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,88 +2,76 @@
22

33
.. _Chapter-Domain_Maps:
44

5-
===========
6-
Domain Maps
7-
===========
5+
=============
6+
Distributions
7+
=============
88

9-
A domain map specifies the implementation of the domains and arrays that
9+
A distribution, also called a *domain map*,
10+
specifies the implementation of the domains and arrays that
1011
are *mapped* using it. That is, it defines how domain indices and array
1112
elements are mapped to locales, how they are stored in memory, and how
1213
operations such as accesses, iteration, and slicing are performed. Each
13-
domain and array is mapped using some domain map.
14+
domain and array is mapped using some distribution.
1415

15-
A domain map is either a *layout* or a *distribution*. A layout
16-
describes domains and arrays that exist on a single locale, whereas a
17-
distribution describes domains and arrays that are partitioned across
18-
multiple locales.
16+
In general, a distribution describes domains and arrays
17+
that are partitioned across multiple locales.
18+
A *layout* is a distribution that describes domains and arrays
19+
that exist on a single locale.
1920

20-
A domain map is represented in the program with an instance of a *domain
21-
map class*. Chapel provides a set of standard domain map classes. Users
22-
can create domain map classes as well.
21+
A distribution is represented in the program with an instance of a
22+
*distribution record*. Chapel provides a set of standard distributions.
23+
Users can create distributions as well.
2324

24-
Domain maps are presented as follows:
25+
Distributions are presented as follows:
2526

26-
- domain maps for domain types :ref:`Domain_Maps_For_Types`,
27-
domain values :ref:`Domain_Maps_For_Values`, and arrays
28-
:ref:`Domain_Maps_For_Arrays`
27+
- distributions for
28+
:ref:`domain types <Domain_Maps_For_Types>`,
29+
:ref:`domain values <Domain_Maps_For_Values>`,
30+
:ref:`arrays <Domain_Maps_For_Arrays>`
2931

30-
- domain maps are not retained upon domain assignment
31-
:ref:`Domain_Maps_Not_Assigned`
32+
- :ref:`distributions are not retained upon domain assignment <Domain_Maps_Not_Assigned>`
3233

33-
- standard layouts and distributions, such as Block and Cyclic, are
34-
documented under
35-
:ref:`Standard Layouts and Distributions <layouts_and_distributions>`
34+
- :ref:`Standard Layouts and Distributions <layouts_and_distributions>`,
35+
such as Block and Cyclic
3636

37-
- specification of user-defined domain maps is forthcoming; please
37+
- specification of user-defined distributions is forthcoming; please
3838
refer to the
3939
:ref:`Domain Map Standard Interface technical note <readme-dsi>`
4040

4141
.. _Domain_Maps_For_Types:
4242

43-
Domain Maps for Domain Types
44-
----------------------------
43+
Distributions for Domain Types
44+
------------------------------
4545

46-
Each domain type has a domain map associated with it. This domain map is
46+
Each domain type has a distribution associated with it. This distribution is
4747
used to map all domain values of this type
48-
(:ref:`Domain_Maps_For_Values`).
48+
(see :ref:`Domain_Maps_For_Values`).
4949

50-
If a domain type does not have a domain map specified for it explicitly
51-
as described below, a default domain map is provided by the Chapel
52-
implementation. Such a domain map will typically be a layout that maps
53-
the entire domain to the locale on which the domain value is created or
50+
If a domain type does not have a distribution specified for it explicitly
51+
as described below, a default distribution is provided by the Chapel
52+
implementation. Such a distribution will typically be a layout that maps
53+
the entire domain to the locale on which the current task is executed or
5454
the domain or array variable is declared.
5555

56-
A domain map can be specified explicitly by providing a *dmap value* in
57-
a ``dmapped`` clause:
58-
59-
56+
A distribution can be specified explicitly using a ``dmapped`` clause:
6057

6158
.. code-block:: syntax
6259
6360
mapped-domain-type:
64-
domain-type 'dmapped' dmap-value
61+
domain-type 'dmapped' distribution-record
6562
66-
dmap-value:
63+
distribution-record:
6764
expression
6865
69-
A dmap value consists of an instance of a domain map class wrapped in an
70-
instance of the predefined record ``dmap``. The domain map class is
71-
chosen and instantiated by the user. ``dmap`` behaves like a generic
72-
record with a single generic field, which holds the domain map instance.
73-
74-
*Example*.
66+
where the ``distribution-record`` expression produces
67+
an instance of a distribution record.
7568

76-
The code
69+
.. warning::
7770

78-
.. code-block:: chapel
79-
80-
use BlockDist;
81-
var MyBlockDist: dmap(Block(rank=2));
82-
83-
declares a variable capable of storing dmap values for a
84-
two-dimensional Block distribution. The Block distribution is
85-
described in more detail in the standard library documentation.
86-
See the module documentation for :mod:`BlockDist`.
71+
The ``dmapped`` keyword and the ``dmapped`` clause
72+
are currently unstable and may change in the future.
73+
Factory functions provided by the desired distribution,
74+
when available, should be used instead.
8775

8876
..
8977
@@ -94,9 +82,10 @@ record with a single generic field, which holds the domain map instance.
9482
.. code-block:: chapel
9583
9684
use BlockDist;
97-
var MyBlockDist: dmap(Block(rank=2)) = new dmap(new Block({1..5,1..6}));
85+
var MyBlockDist = new blockDist({1..5,1..6});
9886
99-
creates a dmap value wrapping a two-dimensional Block distribution
87+
creates an instance of the Block distribution record
88+
for two-dimensional domains and arrays
10089
with a bounding box of ``{1..5, 1..6}`` over all of the locales.
10190

10291
*Example*.
@@ -106,17 +95,16 @@ record with a single generic field, which holds the domain map instance.
10695
.. code-block:: chapel
10796
10897
use BlockDist;
109-
var MyBlockDist = new dmap(new Block({1..5,1..6}));
98+
var MyBlockDist = new blockDist({1..5,1..6});
11099
type MyBlockedDom = domain(2) dmapped MyBlockDist;
111100
112-
defines a two-dimensional rectangular domain type that is mapped
113-
using a Block distribution.
101+
defines the type of two-dimensional rectangular domains
102+
that are mapped using a Block distribution.
114103

115104
The following syntactic sugar is provided within the ``dmapped`` clause.
116-
If a ``dmapped`` clause starts with the name of a domain map class, it
105+
If a ``dmapped`` clause starts with the name of a distribution record, it
117106
is considered to be an initialization expression as if preceded by
118-
``new``. The resulting domain map instance is wrapped in a newly-created
119-
instance of ``dmap`` implicitly.
107+
``new``.
120108

121109
*Example*.
122110

@@ -125,23 +113,23 @@ instance of ``dmap`` implicitly.
125113
.. code-block:: chapel
126114
127115
use BlockDist;
128-
type BlockDom = domain(2) dmapped Block({1..5,1..6});
116+
type BlockDom = domain(2) dmapped blockDist({1..5,1..6});
129117
130118
is equivalent to
131119

132120
.. code-block:: chapel
133121
134122
use BlockDist;
135-
type BlockDom = domain(2) dmapped new dmap(new Block({1..5,1..6}));
123+
type BlockDom = domain(2) dmapped new blockDist({1..5,1..6});
136124
137125
.. _Domain_Maps_For_Values:
138126

139-
Domain Maps for Domain Values
140-
-----------------------------
127+
Distributions for Domain Values
128+
-------------------------------
141129

142-
A domain value is always mapped using the domain map of that values
130+
A domain value is always mapped using the distribution of that value's
143131
type. The type inferred for a domain literal
144-
(:ref:`Rectangular_Domain_Values`) has a default domain map.
132+
(see :ref:`Rectangular_Domain_Values`) has a default distribution.
145133

146134
*Example*.
147135

@@ -151,22 +139,19 @@ type. The type inferred for a domain literal
151139
152140
use BlockDist;
153141
var MyDomLiteral = {1..2,1..3};
154-
var MyBlockedDom: domain(2) dmapped Block({1..5,1..6}) = MyDomLiteral;
155-
156-
``MyDomLiteral`` is given the inferred type of the domain literal and
157-
so will be mapped using a default map. MyBlockedDom is given a type
158-
explicitly, in accordance to which it will be mapped using a Block
159-
distribution.
160-
161-
A domain value’s map can be changed explicitly with a ``dmapped``
162-
clause, in the same way as a domain type’s map.
142+
var MyBlockedDom: domain(2) dmapped blockDist({1..5,1..6}) = MyDomLiteral;
163143
144+
``MyDomLiteral`` is a domain literal and so will be mapped using
145+
a default distribution. MyBlockedDom is given a type explicitly,
146+
therefore it will be mapped using a Block distribution.
164147

148+
A domain value's distribution can be specified explicitly with a ``dmapped``
149+
clause, in the same way as a domain type's distribution.
165150

166151
.. code-block:: syntax
167152
168153
mapped-domain-expression:
169-
domain-expression 'dmapped' dmap-value
154+
domain-expression 'dmapped' distribution-record
170155
171156
..
172157
@@ -177,18 +162,18 @@ clause, in the same way as a domain type’s map.
177162
.. code-block:: chapel
178163
179164
use BlockDist;
180-
var MyBlockedDomLiteral1 = {1..2,1..3} dmapped new dmap(new Block({1..5,1..6}));
181-
var MyBlockedDomLiteral2 = {1..2,1..3} dmapped Block({1..5,1..6});
165+
var MyBlockedDomLiteral1 = {1..2,1..3} dmapped new blockDist({1..5,1..6});
166+
var MyBlockedDomLiteral2 = {1..2,1..3} dmapped blockDist({1..5,1..6});
182167
183168
both ``MyBlockedDomLiteral1`` and ``MyBlockedDomLiteral2`` will be
184169
mapped using a Block distribution.
185170

186171
.. _Domain_Maps_For_Arrays:
187172

188-
Domain Maps for Arrays
189-
----------------------
173+
Distributions for Arrays
174+
------------------------
190175

191-
Each array is mapped using the domain map of the domain over which the
176+
Each array is mapped using the distribution of the domain over which the
192177
array was declared.
193178

194179
*Example*.
@@ -198,20 +183,20 @@ array was declared.
198183
.. code-block:: chapel
199184
200185
use BlockDist;
201-
var Dom: domain(2) dmapped Block({1..5,1..6}) = {1..5,1..6};
186+
var Dom: domain(2) dmapped blockDist({1..5,1..6}) = {1..5,1..6};
202187
var MyArray: [Dom] real;
203188
204-
the domain map used for ``MyArray`` is the Block distribution from
189+
the distribution used for ``MyArray`` is the Block distribution from
205190
the type of ``Dom``.
206191

207192
.. _Domain_Maps_Not_Assigned:
208193

209-
Domain Maps Are Not Retained upon Domain Assignment
210-
---------------------------------------------------
194+
Distributions Are Not Retained upon Domain Assignment
195+
-----------------------------------------------------
211196

212-
Domain assignment (:ref:`Domain_Assignment`) transfers only the
197+
:ref:`Domain assignment <Domain_Assignment>` transfers only the
213198
index set of the right-hand side expression. The implementation of the
214-
left-hand side domain expression, including its domain map, is
199+
left-hand side domain expression, including its distribution, is
215200
determined by its type and so does not change upon a domain assignment.
216201

217202
*Example*.
@@ -221,10 +206,10 @@ determined by its type and so does not change upon a domain assignment.
221206
.. code-block:: chapel
222207
223208
use BlockDist;
224-
var Dom1: domain(2) dmapped Block({1..5,1..6}) = {1..5,1..6};
209+
var Dom1: domain(2) dmapped blockDist({1..5,1..6}) = {1..5,1..6};
225210
var Dom2: domain(2) = Dom1;
226211
227-
``Dom2`` is mapped using the default distribution, despite ``Dom1``
212+
``Dom2`` is mapped using a default distribution, despite ``Dom1``
228213
having a Block distribution.
229214

230215
..
@@ -236,11 +221,11 @@ determined by its type and so does not change upon a domain assignment.
236221
.. code-block:: chapel
237222
238223
use BlockDist;
239-
var Dom1: domain(2) dmapped Block({1..5,1..6}) = {1..5,1..6};
224+
var Dom1: domain(2) dmapped blockDist({1..5,1..6}) = {1..5,1..6};
240225
var Dom2 = Dom1;
241226
242227
``Dom2`` is mapped using the same distribution as ``Dom1``. This is
243228
because the declaration of ``Dom2`` lacks an explicit type specifier
244229
and so its type is defined to be the type of its initialization
245230
expression, ``Dom1``. So in this situation the effect is that the
246-
domain map does transfer upon an initializing assignment.
231+
distribution does transfer upon initialization.

doc/rst/language/spec/domains.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ domain’s relationship with subdomains, index
7272
types (:ref:`Index_Types`), and
7373
arrays (:ref:`Association_of_Arrays_to_Domains`).
7474

75-
The runtime representation of a domain is controlled by its domain map.
76-
Domain maps are presented in :ref:`Chapter-Domain_Maps`.
75+
The runtime representation of a domain is controlled by its distribution,
76+
see :ref:`Distributions <Chapter-Domain_Maps>`.
7777

7878
.. _Domain_and_Array_Parallel_Safety:
7979

@@ -427,7 +427,7 @@ Simple Subdomain Types and Values
427427
A subdomain is a domain whose indices are guaranteed to be a subset of
428428
those described by another domain known as its *parent domain*. A
429429
subdomain has the same type as its parent domain, and by default it
430-
inherits the domain map of its parent domain. All domain types support
430+
inherits the distribution of its parent domain. All domain types support
431431
subdomains.
432432

433433
Simple subdomains are subdomains which are not sparse. Sparse subdomains
@@ -446,7 +446,7 @@ subdomains, unless it is specifically distinguished as one or the other.
446446
Subdomains are provided in Chapel for a number of reasons: to
447447
facilitate the ability of the compiler or a reader to reason about
448448
the inter-relationship of distinct domain variables; to support the
449-
author’s ability to omit redundant domain mapping specifications; to
449+
author’s ability to omit redundant distribution specifications; to
450450
support the compiler’s ability to reason about the relative alignment
451451
of multiple domains; and to improve the compiler’s ability to prove
452452
away bounds checks for array accesses.
@@ -811,7 +811,7 @@ be defined with either a domain or a list of ranges.
811811
812812
The result of slicing, or a *slice*, is a new domain value that
813813
represents the intersection of the index set of the domain being sliced
814-
and the index set being applied. The type and domain map of the slice
814+
and the index set being applied. The type and distribution of the slice
815815
match the domain being sliced.
816816

817817
Slicing can also be performed on an array, resulting in aliasing a
@@ -881,7 +881,7 @@ The ``#`` operator can be applied to dense rectangular domains with a
881881
tuple argument whose size matches the rank of the domain (or optionally
882882
an integer in the case of a 1D domain). The operator produces a new domain
883883
obtained by applying the ``#`` operator to each of the component ranges
884-
of the argument domain, with the same domain map as the argument.
884+
of the argument domain, with the same distribution as the argument.
885885

886886
.. _Adding_and_Removing_Domain_Indices:
887887

doc/rst/language/spec/expressions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ Precedence and Associativity
348348
| ``**`` | right | exponentiation |
349349
+--------------------+----------------+--------------------------------------+
350350
| | ``reduce`` | left | | reduction |
351-
| | ``scan`` | scan | | scan |
352-
| | ``dmapped`` | | | domain map application |
351+
| | ``scan`` | | | scan |
352+
| | ``dmapped`` | | | application of a distribution |
353353
| | | |
354354
+--------------------+----------------+--------------------------------------+
355355
| | prefix ``!`` | right | | logical negation |

0 commit comments

Comments
 (0)