HAL Id: hal-02101781
https://hal-lara.archives-ouvertes.fr/hal-02101781 Submitted on 17 Apr 2019
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-entific research documents, whether they are
pub-L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non,
A Characterization of One-to-One Modular Mappings
Alain Darte, Michèle Dion, Yves Robert
To cite this version:
Alain Darte, Michèle Dion, Yves Robert. A Characterization of One-to-One Modular Mappings. [Research Report] LIP RR-1995-09, Laboratoire de l’informatique du parallélisme. 1995, 2+13p. �hal-02101781�
Laboratoire de l’Informatique du Parallélisme
Ecole Normale Supérieure de Lyon
Unité de recherche associée au CNRS n°1398
A Characterization of One-to-One Modular Mappings Alain Darte Michele Dion Yves Robert
April 1995
Research Report No 95-09
Alain Darte
Michele Dion
Yves Robert
April 1995
Abstract
In this paper, we deal with modular mappings as introduced by Lee and Fortes 14, 13, 12], and we build upon their results. Our main contribution is a characterization of one-to-one modular mappings that is valid even when the source domain and the target domain of the transformation have the same size but not the same shape. This characterization is constructive, and a procedure to test the injectivity of a given trans-formation is presented.
Keywords:
automatic parallelization, loop nests, time-space transformation, modular mapping, injectivity, characterizationResume
Nous etudions dans ce rapport les placements modulaires tels qu'ils ont et e introduits par Lee et Fortes 14, 13, 12], et nous d eveloppons les r esultats qu'ils ont obtenus. Notre apport principal consiste en une caract erisation des placements modulaires bijectifs qui reste valide m^eme lorsque les domaines source et cible de la transformation contien-nent le m^eme nombre de points mais n'ont pas la m^eme forme. La caract erisation est constructive et nous pr esentons une proc edure qui permet de tester l'injectivit e d'une transformation.
Mots-cles:
parall elisation automatique, nids de boucles, transformation temps-espace, placement modulaire, injectivit e, caract erisationAlain Darte, Michele Dion and Yves Robert
Laboratoire LIP, URA CNRS 1398
Ecole Normale Sup erieure de Lyon, F - 69364 LYON Cedex 07
e-mail: Alain.Darte,Michele.Dion,Yves.Robert]@lip.ens-lyon.fr
Abstract
In this paper, we deal withmodular mappingsas introduced by Lee and Fortes 14, 13, 12], and we build upon their results. Our main contribution is a characterization of one-to-one modular mappings that is valid even when the source domain and the target domain of the transformation have the same size but not the same shape. This characterization is constructive, and a procedure to test the injectivity of a given transformation is presented.
1 Introduction
Recently, Lee and Fortes 14, 13, 12] have introduced modular mappings in the context of systolic array design methodologies and parallelizing compilation. Their idea is to extend ane mapping techniques by using linear transformations modulo a constant vector. Ane mappings are time-space transformations that have been used extensively by a variety of researchers to derive ecient time-space transformations for loop nest programs (see 1, 17, 6, 5, 7, 8, 20, 11, 15, 19, 21] among others).
However, the systematic derivation of programs that can take advantage of wraparound connec-tivity in networks such as rings and 2D- or 3D-torus remains out of the scope of ane mappings. A typical example is Cannon's matrix-matrix product algorithm on a 2D-torus of processors 3]: this well-known algorithm (whose counterpart in the systolic eld is the Preparata-Vuillemin 2D-systolic array 18]) cannot be synthesized using ane transformations, whereas Lee and Fortes 14, 13] demonstrate how to synthesize it, as well as many interesting variants, using one-to-one modular mappings. We point out that many other BLAS3-like kernels have been implemented onto 2D processor meshes using wraparound connections (e.g. the scientic library of the MasPar 2, 4]). We refer to Section 2 for the automatic synthesis of Cannon's algorithm using modular mappings, thereby providing the reader with a complete example to demonstrate the usefulness of modular mappings.
This paper deals with the automatic derivation of one-to-one modular mappings. We build upon the results of Lee and Fortes, which we summarize in Section 3. In a word, Lee and Fortes give several sucient conditions for a modular mapping to be one-to-one. Injectivity plays a key role as modular mappings represent a time-space transformation from an index domain (computation points) to a target domain: clearly, the number of computation points must be preserved by the mapping. There are two major limitations in the results of Lee and Fortes:
i/j 0 1 2 3 4 0
d
0 0=e
0 0d
0 1=e
1 1d
0 2=e
2 2d
0 3=e
3 3d
0 4=e
4 4 1d
1 1=e
1 0d
1 2=e
2 1d
1 3=e
3 2d
1 4=e
4 3d
1 0=e
0 4 2d
2 2=e
2 0d
2 3=e
3 1d
2 4=e
4 2d
2 0=e
0 3d
2 1=e
1 4 3d
3 3=e
3 0d
3 4=e
4 1d
3 0=e
0 2d
3 1=e
1 3d
3 2=e
2 4 4d
4 4=e
4 0d
4 0=e
0 1d
4 1=e
1 2d
4 2=e
2 3d
4 3=e
3 4Figure 1: Initial data alignement
they only deal with modular transformations that map an index domain onto itself. In other words, the target domain is assumed to be the same as the index domain. Clearly, if the transformation is one-to-one, the index domain and the target domain should have the same size, but not necessarily the same shape,
they only give sucient conditions for a transformation to be one-to-one. Given an arbitrary modular mapping (possibly given by the programmer), it is not always possible to decide from their results whether the transformation is one-to-one or not. Necessary and sucient conditions would be necessary. Also, a procedure to determine whether a given transformation is one-to-one would be highly desirable.
Our paper overcomes both limitations. Our main result is a necessary and sucient condition for a modular mapping to be one-to-one. The condition is rather technical, but the proof is constructive, hence a procedure to accompany the systematic derivation of one-to-one modular mappings. The condition extends to mappings for which the index domain and the target domain have the same size but not the same shape.
The rest of the paper is organized as follows: in Section 2 we detail the use of modular mappings through the matrix-matrix product example. In Section 3 we formally dene modular mappings, and we review the results obtained by Lee and Fortes. In Section 4 we give a necessary and sucient condition for a modular mapping to be one-to-one. We discuss several extensions in Section 4.2. Section 5 is devoted to some nal remarks and conclusions.
2 Why modular mappings ?
Several basic computational kernels require other type of transformations than ane time-space mappings. A well-known example is Cannon's algorithm for matrix-matrix multiplication (see 3]): DO
i
= 04DO
j
= 04 DOk
= 04c
(ij
) =c
(ij
)+d
(ik
)e
(kj
)CONTINUE
In Cannon's algorithm, the data arrays
d
ande
are rst aligned and multiplied (elementwise) by each other as shown in Figure 1. The result of each mutiplication is stored inc
(ij
). At the next step, matrixd
is shifted to the left and matrixe
is shifted up. Elementwise multiplication takesplace and the result is added to the values of
c
(ij
). The processus is repeated until all elements in a row ofd
are multiplied by all elements in a column ofe
.Let us consider the following transformation
T
b:T
b((ijk
)t) = ( 0 B @ ;1 ;1 1 1 0 0 0 1 0 1 C A 0 B @i
j
k
1 C A)mod(5 5 5)= 0 B @ ;i
;j
+k
mod 5i
mod 5j
mod 5 1 C AThis transformation, called modular mapping in 14, 13], transforms the previously described program into an equivalent one:
DO
t
= 04 DOALLp
1= 04 DOALLp
2= 04i
=p
1j
=p
2k
= (t
+p
1+p
2)mod5c
(ij
) =c
(ij
)+d
(ik
)e
(kj
)MOVE WEST(d) MOVE NORTH(e) CONTINUE
Cannon's algorithm (except data movement) can therefore be described by a modular transfor-mation applied to the original program. We refer the reader to the original papers of Lee and Fortes 14, 13] for several interesting variants of this standard parallelization, as well as for a method to derive data communications.
3 Review of Lee and Fortes results
3.1 Denitions
In this section, we use the same denitions and notations as in Lee and Fortes 14, 13]. Let
u
= (u
1:::u
n)t 2 Zn be a vector withn
integer components, and letm
= (m
1:::m
n)t 2(N )n be a vector with
n
positive integer components. The notationu
modm denotes the vector(
u
1modm
1:::u
nmodm
n)t.Denition 1
(Modular function) A modular functionT
m : Zn ;! Zn is dened asT
m(p
) =(
Tp
)modm forp
2Zn, whereT
is an
n
integer matrix (thetransformation matrix) andm
2(N )nis a
n
-vector (the modulus vector).Denition 2
(Modular time-space transformation of an index domain) A modular time-space transformation,T
m, is a modular function that is injective when its domain is restricted to the index setJ
of an algorithm, i.e,T
m :J
!Znis injective.Denition 3
(Rectangular index set and boundary vector) An index setJ
is rectangular and de-notedJ
b ifJ
=fp
2Zn0p < b
g, where inequalities betweenn
-vectors are taken componentwise.The vector
b
is called the boundary vector ofJ
b.Denition 4
(Smith normal form) For every matrixA
ofZn, there exist two unimodular matricesS
=diag(s
1s
2s
r000)where
r
is the rank ofA
,s
1s
2s
r are non-zero elements ofZands
ijs
i+11i < r
.A
=Q
1SQ
2The matrix
S
is then denoted byS
(A
).Denition 5
(Left Hermite form) For every non singular matrixA
ofZn, there exist a unimodularmatrix
Q
and a lower triangular matrixH
such that:8(
ij
)h
ij>
= 0,each non-diagonal element is lower than the diagonal element of the same row,
A
=HQ
.Besides, this decomposition is unique up to a permutation of the rows. In fact, the row order used to \triangularize"
A
intoH
is arbitrary, hence there aren
! left Hermite forms.An important remark
Consider the modular transformationT
m with transformation matrixT
and modulus vectorm
. It is important to point out that the coecients ofT
are dened only up to a modulus operation. More precisely, letT
0 be the new transformation matrix dened byT
0 = (t
0ij) where
t
0ij =
t
ij modm
i: thenT
0m =
T
m. The proof is immediate: 8(x
1x
n) 2 ZnP
j
t
ijx
j modm
i =Pj
t
0ij
x
j modm
i.Similarly, the determinant of
T
is dened modulo the productd
=Qni=1
m
i. In particular, we can always assume thatT
is non singular (add a suitable multiple ofd
to each diagonal elementt
ii, say, to get an equivalent non singular transformation matrix).3.2 Main results of Lee and Fortes
In 14, 13], Lee and Fortes restrict themselves to the study of modular mappings for which the modulus vectoris equal to the boundary vector, i.e.
m
=b
. The case wherem
=b
is very important in practice, as the matrix-matrix product example demonstrates.Lee and Fortes start with the following lemma:
Lemma 1
LetJ
b =fp
2Zn 0j < b
g be a rectangular domain and dene ^J
b =fp
2Zn ;b <
p < b
g. A modular functionT
b:J
b ;!Znis injective if and only ifT
b(p
)6= 0 for allp
2J
^b exceptp
= 0.Proof
See 13]. IfT
b is not injective, there exist two distinct pointspq
2J
b such thatT
b(p
) =T
b(q
). Thenr
=p
;q
2J
^b,r
6= 0 andT
b(r
) = 0.Conversely, if there exists
r
2J
^b,r
6= 0 andT
b(r
) = 0, letp
be dened as follows:p
i =r
i if0
r
i< b
i andp
i = 0 if ;b
i< r
i<
0. Letq
=p
;r
. Thenpq
2J
b,p
6=q
andT
b(p
) =T
b(q
),hence
T
b is not injective.Then, Lee and Fortes deal with generator matrices. They consider the set of integer points that are equivalent to zero, i.e, the equivalence class
S
0=They prove that
S
0 is a module, and that there exists an
n
integer matrixG
that generatesS
0: this means that every element ofS
0 can be represented as an integer linear combination ofthe columns of
G
. Of course, there are several matrices that generateS
0, but they all are rightequivalent. Indeed, let
G
be a generator matrix, then a matrixG
0 will generateS
0 if and only ifthere exists a
n
n
unimodular matrixU
such thatG
0=
GU
.The main contribution of 14, 13] on generators is a sucient condition on the generators of
S
0that guarantees the injectivity of the transformation:
Lemma 2
LetJ
b be a rectangular index set with boundary vectorb
. LetT
b be a modular mapping and letG
be a generator ofS
0. Let be an arbitrary order on the set f12n
g.T
b is injectiveif
G
satises the following equations: 1.g
ii=b
ii,2.
g
ij = 0 ifi
j
.From this sucient condition on generators, Lee and Fortes investigate the relationship be-tween generator matrices
G
and transformation matricesT
. They deduce the following sucient conditions for a modular mappingT
b to be injective:Theorem 1
LetJ
bbe a rectangular index set with boundary vectorb
. LetT
b be a modular mapping. Let be an arbitrary order on the set f12n
g.T
b :J
b ;! Zn is injective if the matrixT
satises to the following equations: 1.
t
ii^b
i = 112.
t
ij = 0 ifi
j
We restate Theorem 1 as follows: if
T
is triangular up to a permutation, and if itsi
-th diagonal entry is relatively prime withb
i for all 1i
n
, thenT
b is a time-space transformation ofJ
b.It turns out that Theorem 1 can be proven without making use of generators, as shown by the following direct proof.
Another proof of Theorem 1
LetT
be upper triangular (without loss of generality). We solve the systemTx
= 0 modb
forx
2J
^b, whereT
is upper triangular. The last equation ist
nnx
n= 0 modb
nhence
b
n dividest
nnx
n. Sinceb
n is relatively prime witht
nn,b
n dividesx
n, which impliesx
n = 0 asx
2J
^b. The (n
;1)-th equation givest
n;1n;1x
n;1+
t
n;1n0 = 0 mod
b
n ;1hence
x
n;1= 0 just as before, and continuing the process we ndx
= 0.Therefore we do not need to make use of generator matrices to prove Theorem 1. However, generator matrices will enable us to characterize one-to-one modular mappings, i.e. to give a necessary and sucient condition for injectivity, as we show below in Section 4.
Finally, Lee and Fortes give a necessary and sucient condition in the case where all entries of the boundary vector
b
have the same value: in this particular case, they show thatT
bis injective onJ
b if and only if the determinant ofT
and are relatively prime. We extend this result in Section 4.2.1.4 New results
4.1 Characterization when
m = b
In this section, we consider as Lee and Fortes that
m
=b
(the modulus vector is equal to the boundary vector). For the general case, see Section 4.2.As we have seen in Lemma 2, Lee and Fortes 14] exhibit sucient conditions on generator matrices
G
to obtain one-to-one modular mappings. We prove here that these conditions are also sucient, and we give a constructive method to check the injectivity of a given modular mapping. In the following, we denote by the matrixdiag(b
1b
n).Lemma 3
IfG
is a generator matrix ofS
0, then det(G
) divides det() =b
1b
2b
n.Proof
We are going to exhibit a generator matrix forS
0. Let us consider a pointp
2S
0: 9k
2Znsuch that
Tp
=k
. Let =diag(i) be the comatrix of andd
= det = Qni=1
b
i ( is denedsuch that =
d
I
nwhereI
nis the identity matrix of ordern
, i = Qj6=i
b
j). We have:Tp
=k
Tp
=dk
Q
1S
(T
)Q
2p
=dk
where
Q
1,Q
2 are two unimodular matrices andS
(T
) is the Smith normal form of matrixT
.S
(T
)Q
2p
=dQ
1;1k
S
(T
)Q
2p
=dk
0 wherek
0 2Zn(Q
1is unimodular). LetS
(T
) =diag(s
i) :s
i(Q
2p
)i =dk
0 iWe want only integer values for the components of
p
, therefore (Q
2p
)i= gcd(d
ds
i)k
00 i wherek
00 2Zn.p
=Q
2;1S
0k
00 whereS
0= diag(gcd(dd s i)). The matrixQ
2 ;1S
0generatesS
0.Besides, if we let
S
() =diag( 0 i) andS
() = diag( 0 i), we know that 0 i0 n;i+1 =d
(see 16] p.40) and that 0i divides
s
i (ifA
andB
are two nonsingular integern
n
matrices, then thek
-thelement
s
k(AB
) of the Smith normal form ofAB
is divisible bys
k(A
) ands
k(B
), see 16] p.33). 0 i dividess
i andd
, so gcd(ds
i) = 0 iu
i whereu
i 2Zands
0 i = 0d iu i. Therefore det(S
0) = Q d 0 iu i det(S
0) = d n det()Q uidet(
S
0) = Q
d
u
iSince all generator matrices are right equivalent, they all have the same determinant as
Q
2;1S
0,hence as
S
0.Lemma 4
LetG
be a nite abelian group. Letg
]q be the subset f0g:::
(q
;1)g
g withg
2G
and 1
< q
order
(g
). LetS
1:::S
k bek
subsets ofG
.G
is said to be the direct sum of theS
i,which we denote as
G
=S
1S
k, if the mapping (g
1:::g
k)7!g
1++g
k fromS
1S
kto
G
is one-to-one. IfG
=g
1]k1g
r]kr then at least one of the
g
i]ki is a subgroup ofG
.Proof
This result has been proved by Haj os in its works on one of the Minkowski's conjecture, see 9].Lemma 5
IfT
b is a one-to-one modular mapping onJ
b, then8x
2Zn, there exists(x
1x
2)2S
0J
bsuch that
x
=x
1+x
2, and this decomposition is unique.Proof
We rst prove the existence of such a decomposition and then its uniqueness.Existence
Let us consider the nite abelian groupA
=Zn=S
0. The matrixQ
2 ;1S
0 generates
S
0(see Lemma 3), so the number of elements of
A
is det(Q
2;1S
0) = det(
S
0). Forx
2Zn, we denote
by
x
the canonical image ofx
inA
.Let us consider two distinct elements of
J
b,x
andy
, thenx
6=y
. Indeed,x
;y
2J
^b, ifx
=y
,x
;y
2S
0andT
bwould be not injective (see Lemma 1). All elements ofJ
b have distinct canonicalimages in
A
.The number of elements in
J
b is det(), there are more elements inJ
b than inA
(det(S
0)det(), see Lemma 3). So, for all
x
2A
, there existsy
2J
b such thatx
is the canonical image ofy
(otherwise, two elements in
J
b would have the same canonical image inA
, and this is impossible). Besides, this also means that ifT
b is injective, we have detS
0= det.Consider
x
2 Zn.x
is the canonical image ofx
inA
there existsx
2 2J
b such thatx
2 =x
,x
;x
22S
0. So, there exists (x
1x
2)2S
0J
b such thatx
=x
1+x
2.Uniqueness
If there exists (x
1x
2) and (x
01
x
0 2) inS
0J
b such thatx
=x
1+x
2=x
0 1+x
0 2 then,x
2;x
0 2 =x
1;x
0 12S
0.x
2;x
0 22J
^b andT
b is injective, sox
2 =x
0 2 andx
1=x
0 1.Lemma 6
IfT
b is a one-to-one modular transformation then there existsi
, 1i
n
, such thatO
+b
i~e
i2S
0 (where
e
i is thei
-th vector of the canonical basis ofZn).
Proof
Letf
1f
2:::f
nbe the canonical images ofO
+~e
1O
+~e
2:::O
+~e
ninA
. IfT
bis injective, for allx
2Zn, there exista
2S
0 and integers i, 0i< b
i, such thatx
=a
+1~e
1++n~e
nand this decomposition is unique, see lemma 5. This means exactly that
A
=f
1]b1f
n]b n.Lemma 4 shows that one of the
f
i satisesb
if
i= 0, i.e, 0 +b
i~e
i 2S
0.Theorem 2
A transformationT
b is one-to-one if and only if there exists a left Hermite form of a generator matrixG
ofS
0 with diagonalb
1b
2:::b
n.Proof
The sucient condition has already been proved in 14], see Lemma 2.Necessary condition
Let us consider a one-to-one modular mappingT
b. Lemma 6 gives an indexi
such thatO
+b
i~e
i 2S
0.Let us consider
f
i]bi, subgroup ofA
. LetB
be the nite abelian groupB
=A=
f
i]bi. Wealso know that
A
=f
1]b1f
n]b n. Letf
0 1f
0 2f
0 i;1f
0 i+1f
0nbe the canonical images of
f
1f
2f
i;1
f
i+1f
n inB
(the canonical image off
i inB
is 0).Let us consider
x
2B
, there existsy
2A
such thatx
is the canonical image ofy
inB
. Besides,y
=m
1f
1++m
nf
nand this decomposition is unique. So,x
=m
1f
0 1++m
i ;1f
0 i;1+m
i+1f
0 i+1+ +m
nf
0n and the decomposition is also unique. This means that
B
=f
01]b1
f
0 i;1]bi;1f
0 i+1]bi+1f
0 n]bn. There existsj
6 =i
such thatb
jf
0j = 0, i.e, there exists
t
, 0t < b
i suchthat 0 +
b
j~e
j+t~e
i 2S
0.
By repeating this process, we obtain
n
vectors inS
0and the matrixH
formed by these vectorsis upper triangular with diagonal
b
1b
2b
n(up to a permutation of indices).Furthermore, these vectors form a basis of the module generated by
G
. By adding suitable com-binations of the vector columns ofH
to any vectorx
2S
0, we getx
=H
+a
where8a
i0a
i< b
i.Because there is only one element of
S
0 inJ
b (which is 0), we havea
= 0 and thus,x
is a linearcombination of the column vectors of
H
. Furthermore, this decomposition is unique becauseH
is non-singular. So,
H
is the matrix of a basis ofS
0, this means that there exists a unimodularmatrix
Q
such thatG
=HQ
, and this completes the proof.Given a transformation matrix
T
and a modulus vectorb
, Theorem 2 gives a constructive method to check whetherT
b is a time-space transformation or not. We sketch the procedure and run it on an example.Procedure
From Theorem 2, a procedure to know whether a modular transformation is injective or not can be deduced:1. Calculate the Smith normal form
T
and then deduce the matrixQ
;12
S
0 that generatesS
0(we use the same notations as in lemma 3).
2. Calculate the
n
! left Hermite normal forms (by permuting the rows) ofQ
;12
S
0.3. If there exists a left Hermite normal form of
Q
;12
S
0with diagonalb
1
b
2b
n, thetransfor-mation
T
b is injective.Example
Let us consider the matrixT
=0 B @ 1 0 3 1 1 2 3 3 1 1 C
A and the vector
b
= 0 B @ 5 4 6 1 C A.We calculate the Smith normal form of
T
and we deduce the two matricesS
0 andQ
;1 2 :S
0= 0 B @ 60 0 0 0 2 0 0 0 1 1 C AandQ
;1 2 = 0 B @ 3 152 ;613 0 0 1 1 51 ;204 1 C A,Q
;1 2S
0= 0 B @ 180 304 ;613 0 0 1 60 102 ;204 1 C A.We calculate the 6 left Hermite forms of
Q
;12
S
0 by permuting the rows. The left Hermite formof 0 B @ 60 102 ;204 180 304 ;613 0 0 1 1 C Ais 0 B @ 6 0 0 2 5 0 2 3 4 1 C A.
T
b is injective.In this section, we start by proving a useful property that allows to restrict the search of one-to-one modular mappings to a more restricted set: we show that a transformation
T
b is injective onJ
b if and only ifT
b in injective onJ
b anddet
(T
)^= 1. Then, we consider the particular case where 8(ij
)b
i^b
j = 1. In this particular case, we have a necessary and sucient condition directly withthe transformation matrix. Finally, we extend the results given in Section 4 to a more general case:
m
6=b
, but Qm
i =Qb
i.4.2.1 Injectivity of
T
bIn this section, let
T
be a transformation matrix andb
a modulus vector. We still assume that the source domain and the target domain are the same. We will prove a \scalability property". Beforehand, we prove the following lemma as a prerequisite for Theorem 3.Lemma 7
det(T
)^6= 1)T
bis not injective onJ
b.Proof
We use the notations of lemma 3. Letd
= det = Qni=1
b
i,S
(T
) = diag(s
i),S
() = diag(0
i) and
S
() = diag( 0i). Let
Q
2 andS
0 be the matrices such thatQ
2;1
S
0 generates the
module
S
0 forT
b,Q
02 and
S
00 the matrices such thatQ
02;1
S
00 generates the module
S
0forT
b(
Q
2,S
0,Q
02 and
S
00 are calculated as in the proof of lemma 3).Let
S
0= diag(s
0 i) andS
00= diag(s
00 i).S
(n;1T
) =n;1S
(T
), so we have:s
00 i = gcd(n
d
nd
n;1s
i)s
00 i = gcd(d
ds
i) We have seen in the proof of lemma 3 that 0i divides
s
i. So, we can writes
i = 0i
x
i with Qx
i =det
(T
) (Qs
i= det(T
) =d
n;1 det(T
) = Q 0 iQx
i =d
n;1 Qx
i). Besides, 0 i= 0 d n;i+1. Thus,s
00 i = 0d
igcd(0 n;i+1x
i)There exists
i
such that gcd(x
i) 6= 1 ( Qx
i =det
(T
) and det(T
)^ 6= 1). Thus, Qs
00 i<
Qb 0 i=
nd
. Hence,T
bcannot be injective (we see in the proof of Lemma 5 that ifT
bis injective, we must havedet
(S
00) = det() =nd
).Theorem 3
Let 2 N. The modular mappingT
b is a time-space transformation ofJ
b if andProof
Assume thatT
b is injective. Letp
2J
^b such thatT
b(p
) = 0. Equivalently,Tp
=k
forsome
k
2Zn. ThenTp
=k
andp
2J
^b. AsT
p is injective, Lemma 1 implies thatp
= 0.Hence,
T
b is injective. Besides, we know from Lemma 7 that det(T
)^= 1.Conversely, assume now that
T
b is injective and det(T
)^ = 1. If det(T
) = 0, the proof isimmediate (det(
T
) = 0 and det(T
)^= 1) = 1). Consider now the case det(T
)6= 0.Let
p
in ^J
b such thatTp
=k k
2ZnLet
U
be the comatrix ofT
(UT
= det(T
)I
n). We have: det(T
)p
=U
k
det(
T
)p
i=(U
k
)iSo,
divides det(T
)p
i. But, we also have det(T
)^= 1. Hence, dividesp
i. Let us considerq
such thatp
i=q
i.det(
T
)q
=U
k
det(
T
)q
=U
k
So, det(
T
)Tq
= det(T
)k
andTq
=k
. Besides, ;b < p < b
implies ;b < q < b
.T
b isinjective, thus
q
= 0 andp
= 0.Remark
The previous theorem leads to another proof of the following result of Lee and Fortes: in the case where all entries of the boundary vectorb
have the same value,T
b is injective onJ
b if and only if the determinant ofT
and are relatively prime. Indeed, ifb
= (11)t,J
b containsonly the point (0
0) andT
b is always injective. ThereforeT
bis injective i det(T
)^= 1.4.2.2 When
8(ij
)b
i^b
j = 1We know (see Section 3.1) that for any transformation
T
m, there exists an equivalent transformation denoted asT
0m and such that8(
ij
)0t
0ij
< b
i. We still assumem
=b
here. We prove that if8(
ij
)b
i^b
j = 1, thenT
b is one-to-one iT
is triangular (up to a permutation) with \good"diagonal coecients: in this particular case, the characterization of one-to-one mappings is quite simple.
Theorem 4
If8(ij
)b
i^b
j = 1, thenT
b is injective onJ
b if and only ifT
0b is an upper triangular matrix (up to a permutation on row and column indices) with 8i
t
ii^b
i= 1 .Proof
The sucient condition has been proved in 13] (see Theorem 1) .Necessary condition
Assume that the transformationT
b is injective. The proof uses the same lemma as Theorem 2. Let us considert
0j
1j
n
, the columns ofT
0 and let
A
be the group Z=b
1ZZ=b
2ZZ=b
nZ. The restriction ofT
b toJ
b denes an injective application. The twosets have the same number of elements, so it is also bijective, i.e,8
x
2A
9!y
2J
b= x
=T
b(y
) =(
Ty
)modb. This means exactly thatA
=t
01]b1 b
t
0 2]b2 bbt
0 n]bn.Lemma 4 shows that there exists
j
such thatt
0j]bj is a subgroup of
A
. There existsj
suchthat
t
0j
b
j = 0modb, i.e 8it
0ij
b
j = 0 modb
i. So, we must have 8i
6=jt
0ij = 0 since
b
i^b
j = 1 andt
0jj^
b
j = 1 (otherwise the transformation would not be injective).Up to a permutation on rows and columns, the matrix
T
0 is now: 0 B B B @t
0 jju
0:
T
00 0 1 C C C A (whereu
is a row vector ofn
;1 elements). Consider the new modular transformationT
00b0, where
b
0 =(
b
1b
j;1
b
j+1b
n)t. Let us prove thatT
00b0 is an injective modular transformation on
J
b 0. Let us considerx
= (x
1x
j ;1x
j+1x
n)2J
^b 0 such thatT
00x
= 0 modb0. The elementt
0 jj has an inverse in Z=b
jZ(t
0jj^
b
j= 1). Let 2Z=b
jZbe the value ;t
0 jj;1u:x
, wheret
0 jj;1 is the inverse oft
0 jj in Z=b
jZ. We havet
0jj
+u:x
= 0 modb
j. So, the vector (x
1x
j;1
x
j+1x
n)2S
0 and we have8i
6=jx
i= 0 (T
b is injective).We have just proved that
T
00b0 is injective. So, in the same way, there exists
k
such thatT
00 = 0 B B B @t
0 kk: : :
0:
T
000 0 1 C C C A witht
0 kk^b
k = 1, up to a permutation.By repeating this process, we obtain that
T
0is triangular up to a permutation, and each elementt
0ii on the diagonal satises
t
0ii^
b
i= 1.4.2.3 Extension to the general case:
m
6=b
In this section, we consider a modular transformation
T
m and a rectangular index setJ
b and we prove that general results can be easily derived from the particular casem
=b
.First, Lemma 1 remains satised in the general case.
Lemma 8
A modular functionT
m :J
b ;! Znis injective if and only ifT
m(p
) 6= 0 for allp
2J
^bexcept
p
= 0.Proof
The proof is immediate from the proof of Lemma 1.Besides, if we consider the set of integer points that are equivalent to zero,
S
0 = fp
2 ZnT
m(p
) = 0g, we can nd in the same way a generator matrix forS
0. Let = diag(m
i).As in Section 4 and with the notations of lemma 1, we obtain a matrix
Q
2;1S
0that generates
S
0and that satises det(
Q
;12
S
0)jdet() (simply replace
b
bym
in Lemma 3).Lemma 9
IfQni=1
m
i=Qn
i=1
b
i, then Theorem 2 remains valid: a transformationT
m is one-to-oneif and only if there exists a left Hermite form of a generator
G
ofS
0 with diagonalb
1b
n.Proof
The proof is immediate from the proof of lemma 2. The condition thatQni=1
m
i =Qni=1
b
i is needed to prove that the sum of subsets used in Lemma 5 is a direct sum. Of course, ifT
m is one-to-one fromJ
b ontoJ
m, both domains must have the same number of integer points.In 13], Lee and Fortes dealt with the particular case when the modulus vector results from a permutation of the entries of the boundary vector. Lemma 9 is an extension of this particular case.
Example
Let us consider the matrix transformationT
=
1 1 1 2
!
and the modulus vector
m
= 2 3 ! . We haveQ
2;1S
0 = 6 1 0 1 !. Thus,
T
m is injective on the rectangular index setJ
(6 1)t but is not injective onJ
(2 3)t.Lemma 9 is very useful as it enables to check injectivity for transformations that map a given rectangular domain onto a domain of dierent shape (but of the same size).
5 Conclusion
In this paper, we have considered modular mappings as introduced by Lee and Fortes 14, 13, 12]. Our main contribution is a characterization of one-to-one modular mappings that is valid even when the source domain and the target domain of the transformation have the same size but not the same shape. This characterization is constructive, and a procedure to test the injectivity of a given transformation has been presented.
We believe the study of modular mappings to be very promising in the context of automatic parallelization techniques. Indeed, mapping techniques usually proceed in two steps: rst the input domain (computation points) is mapped onto a time-space domain where a virtual processor is assigned to each computation. Then virtual processors are mapped onto physical processors, most often using a block-cyclic allocation a la HPF 10]. Characterizing valid modular mappings from input domains onto target domains of larger dimension would enable to fully automatize the mapping procedure.
References
1] Jennifer M. Anderson and Monica S. Lam. Global optimizations for parallelism and locality on scalable parallel machines. ACM Sigplan Notices, 28(6):112{125, June 1993.
2] T. Blank. The MasPar MP-1 architecture. In Compcon Spring, pages 20{24. IEEE Press, February 1990.
3] L.E. Cannon. A cellular computer to implement the Kalman lter algorithm. PhD thesis, Montana State University, 1969.
4] P. Christy. Software to support massively parallel computing on the MasPar MP-1. In Compcon Spring, pages 29{33. IEEE Press, February 1990.
5] Alain Darte and Yves Robert. Constructive methods for scheduling uniform loop nests. IEEE Trans. Parallel Distributed Systems, 5(8):814{822, 1994.
6] Alain Darte and Yves Robert. Mapping uniform loop nests onto distributed memory architec-tures. Parallel Computing, 20:679{710, 1994.
7] Paul Feautrier. Some ecient solutions to the ane scheduling problem, part I, one-dimensional time. Int. J. Parallel Programming, 21(5):313{348, October 1992. Available as Technical Report 92-28, Laboratoire MASI, Universit e Pierre et Marie Curie, Paris, May 1992.
8] Paul Feautrier. Towards automatic distribution. Parallel Processing Letters, 4(3):233{244, 1994.
9] G. Hajos. Uber einfache und mehrfache bedeckung des n-dimensionalen raumes mit einem wurfelgitter. Math. Zeitschrift, 47:427{467, 1942.
10] Charles H. Koelbel, David B. Loveman, Robert S. Schreiber, Guy L. Steele Jr., and Mary E. Zosel. The High Performance Fortran Handbook. The MIT Press, 1994.
11] S.Y. Kung. VLSI array processors. Prentice-Hall, 1988.
12] Hyuk J. Lee and Jos e A.B. Fortes. Data distribution independent parallel programs for ma-trix multiplication. Technical Report TR-EE 94-32, School of Electrical Engineering, Purdue University, October 1994.
13] Hyuk J. Lee and Jos e A.B. Fortes. Modular mappings of rectangular algorithms. Technical Report TR-EE 94-22, School of Electrical Engineering, Purdue University, June 1994.
14] Hyuk J. Lee and Jos e A.B. Fortes. On the injectivity of modular mappings. In Peter Cappello, Robert M. Owens, Jr Earl E. Swartzlander, and Benjamin W. Wah, editors, Application Spe-cic Array Processors, pages 237{247, San Francisco, California, August 1994. IEEE Computer Society Press.
15] D.I. Moldovan and J.A.B. Fortes. Partitioning and mapping algorithms into xed-size systolic arrays. IEEE Transactions on Computers, 35(1):1{12, January 1986.
16] Morris Newman. Integral Matrices. Academic Press, 1972.
17] Michael O'Boyle and G.A. Hedayat. Data alignment: Transformations to reduce communica-tions on distributed memory architectures. In Scalable High-performance Computing Confer-ence SHPCC-92, pages 366{371. IEEE Computer Society Press, 1992.
18] F.P. Preparata and J.E. Vuillemin. Area-time optimal VLSI networks for multiplying matrices. Information Processing Letters, 11(2):77{80, 1980.
19] Patrice Quinton and Yves Robert. Systolic Algorithms and Architectures. Prentice Hall, 1991. Translated from French, Masson (1989).
20] Weijia Shang and A.B. Fortes. Time optimal linear schedules for algorithms with uniform dependencies. IEEE Transactions on Computers, 40(6):723{742, June 1991.
21] Michael E. Wolf and Monica S. Lam. A loop transformation theory and an algorithm to maximize parallelism. IEEE Trans. Parallel Distributed Systems, 2(4):452{471, October 1991.