Subject: hpff-doc: Comments on Mapping in Subprogram Calls

From: Thomas Brandes <[email-masked]>
Date: Fri, 13 Sep 1996 11:05:39 +0200

---------------------------------------------------------------------------
[email-masked] is a mailing list for HPF 2.0 language specification
authors and editors.  Instructions for adding or deleting yourself from this
list appear at the bottom of this message.
---------------------------------------------------------------------------

I am not happy with this chapter at all. The understanding of all this
stuff was not really easy, but now the confusion is complete.

a) PRESCRIPTIVE / DESCRIPTIVE

   Section 3.1, p. 43,  says:

   ..., it is fair to say that the descriptive syntax is at this point
   maintained only for backwards compatibility.

   Does this imply that this is all the same (oh please let it be) as
   far as INTERFACE blocks are provided ?

   My understanding says : yes

   !HPF$ DISTRIBUTE (BLOCK,BLOCK) ONTO P :: A
   !HPF$ DISTRIBUTE *(BLOCK,BLOCK) ONTO P :: A
   !HPF$ DISTRIBUTE (BLOCK,BLOCK) ONTO *P :: A
   !HPF$ DISTRIBUTE *(BLOCK,BLOCK) ONTO *P :: A

   I think that there was only a difference for the implementors. For
   prescriptive distributions the called routine will make the 
   redistribution, for descriptive distributions the calling routine
   must do it (and therefore INTERFACE blocks were required).

   As INTERFACES are now always required, the implementors can choose
   (if they have really supported both possibilities). But I think
   there should be later a compiler flag and no longer this confusing
   syntax.

b) Underspecified Distributions

      REAL D1(N,N), D2(N,N)
!HPF$ DISTRIBUTE D1(BLOCK,CYCLIC) ONTO P1
!HPF$ DISTRIBUTE D2(BLOCK,CYCLIC) ONTO P2
      call SUB (D1, N)
      call SUB (D2, N)
  
The subroutine SUB should be written in such a way that it can deal
with both mappings without redistributions. A first attempt would be:

      SUBROUTINE SUB (A, N)
      REAL A(N,N)
!HPF$ DISTRIBUTE A(BLOCK,BLOCK)

The distribution of A is underspecified. The compiler might choose a
processor array or will take the default processor arrangement. 
This implies that there might be redistributions for
both arrays, D1 and D2. So the following one would be more correct:

      SUBROUTINE SUB (A, N)
      REAL A(N,N)
!HPF$ DISTRIBUTE A(BLOCK,BLOCK) ONTO *

Here, the compiler must generate code that can deal with every processor array.
No redistributions will be necessary.

I think that this should be pointed out more clearly. Or has underspecified
mapping another meaning for dummy arguments?

Same issue (my understanding says there is a difference between the 
following directives as in the first two cases the compiler can chosse
and in the other two cases the compiler has to accept everything):

   !HPF$ DISTRIBUTE ONTO P
   !HPF$ DISTRIBUTE ONTO *P
   !HPF$ DISTRIBUTE * ONTO P
   !HPF$ DISTRIBUTE * ONTO *P

Who can explain this stuff to an user ? 

c) Confusion about transcriptive distribution and transcriptive alignment

   !HPF$ TEMPLATE T(N)
   !HPF$ DISTRIBUTE T(CYCLIC(M))
         REAL A(N)
   !HPF$ ALIGN A(I) WITH T(a*I+b)
         CALL SUB (A)

         SUBROUTINE SUB (X)
         REAL X(:)
   !HPF$ DISTRIBUTE X * ONTO *

   The subroutine specifies a transcriptive distribution. The actual argument
   is aligned (and not distributed).

   Have I to expect a redistribution ?

   Page 45, line 33 says: The mapping should not be changed !

   This will imply that the compiler has to treat it like 'INHERITED X'.

d) aligned actual array, distributed dummy (compatibility of mappings)

   Writing subroutines with distribute directives for the dummies seems
   to be more general as the code will be more flexible.

   But what happens if the actual array is aligned. 

   Alignment allows permutation, embedding, replication. 

   1. permuted dimensions
   
   !HPF$ TEMPLATE T(N,N)
   !HPF$ DISTRIBUTE T(BLOCK,CYCLIC)
         REAL A(N,N)
   !HPF$ ALIGN A(I,J) WITH T(J,I)
         call SUB (A,N)

         subroutine SUB (A, N)
         REAL A(N,N)
   !HPF$ DISTRIBUTE A(CYCLIC,BLOCK) ONTO *

   2. replicated dimensions:

   !HPF$ TEMPLATE T(N,N)
   !HPF$ DISTRIBUTE T(BLOCK,CYCLIC)
         REAL A(N)
   !HPF$ ALIGN A(I) WITH T(I,*)
         call SUB (A,N)

         subroutine SUB (A, N)
         REAL A(N)
   !HPF$ DISTRIBUTE A(CYCLIC) ONTO *

   3. embedding

   !HPF$ TEMPLATE T(N,N)
   !HPF$ DISTRIBUTE T(BLOCK,CYCLIC)
         REAL A(N)
   !HPF$ ALIGN A(I) WITH T(I,2)
         call SUB (A,N)

         subroutine SUB (A, N)
         REAL A(N)
   !HPF$ DISTRIBUTE A(CYCLIC) ONTO *

   Must I assume redistributions in any case ? What would do a good
   compiler ? 

   In other words: there should be more clarity about compatible 
   mappings. 

e) Proposal

   With a further e-mail I will put forward a proposal for Mapping  and
   Mapping in Subprogram Calls. Thought it is not full detailed, it might
   contain some ideas which could be taken over.

---------------------------------------------------------------------------
To (un)subscribe to this list, send mail to [email-masked].
Leave the subject line blank, and in the body put the line
(un)subscribe <email-address>
---------------------------------------------------------------------------