Syntax Extensions for APEmille

Index:

   This note describes the APEmille-specific syntax extensions supported by the xtc TAO Compiler. For APEmille-specific restrictions and incompatibilities with respect to TAO100 see TAOmille-100.html.




 

1. Declaration of physical registers:

The statement
   physreg <FP-type> <variable-list>
	
declares the variables of Floating-Point type <FP-type> (i.e. real, complex, matrix- or record-types) in <variable-list> as physical registers.

   In contrast to usual registers, physical registers remain allocated across program sections (e.g. do-loops). However, they may become modified durig subroutine calls. For instance, in the following example:


   subroutine sub1()
     physreg real p
     p = node_abs_id
     call sub2()
   end
	

   p may have a value different from node_abs_id AFTER the subroutine call to sub2 !!!

   Only if physical registers are declared globally, i.e. outside and before any subroutine, they remain allocated for the entire rest of the program module (including subsequent subroutines).

   If the registers are declared inside a subroutine, they remain allocated only for the rest of that subroutine.

Back to index

2. Remote communications over arbitrary distances:

The statement
 
   set remote <ident> =
              [integer_expr, integer_expr, integer_expr]
    
initializes the communication network such that ident can be used as a remote magic offset (like e.g. "left") for communications along corresponding distances. For instance,


   set remote pippo = [nx,2,3]
   res = a[5+pippo]
	

will load into "res" the value of a[5] from the neigbour at distance x=nx, y=2, z=3

Notes:

  •    At most 224 user defined remote offsets can be set in a program.
  •    "set remote ..." is a system service with corresponding execution-time cost.
  •    Communication problems with any of the distances nx or ny or nz >= 2 are not yet safely implemented in the microcode (while, for instance,
    [nx,ny,nz] = [1,1,1] is safe).
Back to index

3. System Services:

New statements for system services are:

open for appending "filename" as <int>
      opens the file in append-mode

write ... hex ...
     uses hexadecimal output format (e.g. for bit-wise verification)

write on stderr ...
      writes output on STDERR instead of STDOUT

random seed is <integer> !! std: random_xtc.hzt
random <var> [:<nitems>] !! std: random_xtc.hzt
disk ...   !! needs disk3_xtc.hzt
load ...   !! needs disk3_xtc.hzt
store ... !! needs disk3_xtc.hzt

Back to index

4. Constants as subroutine arguments:

   Names of constants used as arguments to subroutines now need to be prefixed by an explicit "#" in front of the subroutine name to indicate passing by value.

NOTE: In contrast to the reference manual, TAO100 accepted passing-by-value even if the "#" was omitted.

Back to index

5. Local Memory Access Optimizations:

   The keyword ":local" can be used in the LAST index of any array or matrix, to indicate that the corresponding memory access is NEVER remote (such that it can be scheduled with a more aggressive timing in the microcode).

Example:

   matrix complex mtype.[2,4]
   mtype a[100], m
   complex c

   m = a[j:local]
   c = a[j].[1,2:local]
      
Warning:
   Use of the ":local" qualifyer for a memory access which erroneously becomes remote at execution time may cause wrong results or abnormal program crashes with various HW exceptions!

Bugs:
   Due to a not yet fixed compiler problem, the local qualifyer may not work correctly (or cause a compilation error) if it is used within an arithmetic expression, like


   d =  a[j:local]*b + c
      
and not just in a plain assignment (as in the above example)
Back to index

6. Support for on-the-fly complex conjugation:

   The suffix "~" is defined for any floating-point data structure (scalar, matrix, record) and generates safe but expensive complex conjugation via a normal operation.

   A new statement "extract_cc" is supported to enforce complex conjugation on-the-fly during memory access (i.e. using the zero-cost assembly instruction MEMTOJCC). The usage of "extract_cc" is analog to "extract".

   In addition, the suffix "^*" is defined for any floating-point data structure and generates on-the-fly complex conjugation provided that the corresponding data access is really a MEMORY access.

   Otherwise, if the accessed data is already in a register, the usual instruction for complex conjugation is used (which costs as much as an extra normal operation).

   The complex conjugation on-the-fly can usually be enforced by explicit assignment of register variables to memory variables, like:


   mtype m[10,20,30]
   register mtype r
   r = m[i,j,k]^*
    
REMARKS:
   1)Together with the MEMTOJCC, also a second explicit complex conjugation via JVNORM is produced in order to restore the original (non conjugated) values in the registers allocated for the original variable. If these non-conjugated values are not used, they should be removed by the optimisation step of the shaker.

   2) The "~" and "^*" operations are syntactically allowed also for real data types (which internally in xtc are represented as a complex variables with vanishing imaginary part) and produce the semantically correct results.

   3) Due to an implementation problem, the compilation will exit with an error if the total length of the array on the RHS is less or equal than than 18 complex (or real) data words. For instance,


   complex a[18]
   register complex r
   r = a[12]^*
    
will cause the error:

      ERROR[parse]: Unexpected CC length: 18 1
    
Also in other situations such an error may arise, e.g. in the following situation:

   matrix complex su2.[2,2]
   /complex_fun -> "xxx(" su2_expr^a "," su2_expr^b ")" {
      temporary complex res
      res =   a.[0,0]*b.[0,0]^* +a.[0,1]*b.[0,1]^* ...
            + a.[1,0]*b.[1,0]^* +a.[1,1]*b.[1,1]^*
      rreturn res
   }
   su2 u[1000]
   complex c
   c = xxx(u[3], u[4])
    
The simplest workaround which does not loose MEMTOJCC optimization is to change the "xxx" statement as follows:

   /complex_fun -> "xxx(" su2_expr^a "," su2_expr^b ")" {
      temporary complex res
      temporary su2 bcc
      bcc = b^*
      res = a.[0,0]*bcc.[0,0] +a.[0,1]*bcc.[0,1] ...
            + a.[1,0]*bcc.[1,0] +a.[1,1]*bcc.[1,1]
      rreturn res
    }
    
Another possibility is taking "^*" out of the statement and use it explicitly when assigning register variables which are to be passed, e.g.

   register su2 ucc
   ucc = u[4]^*
   c = xxx_without_cc(u[3],ucc)
    
Please complain if this "feature" is a real problem.

Back to index

7. File-Includes on Assembly Level:

   \include "file.exp"

will produce

   \include file.exp

in the assembly file, such that assembly instructions or macros can be included from a TAO source.

Back to index

- BUGS & MISSING...

Bugs:
  • Explicit assignments of .re or .im on the LHS may cause loading of un-initialized memory locations and is inefficient!!
  • On-the-fly complex conjugation "~" and ":local" loading may cause compilation warnings when used together.
  • Nobody is maintaining this page in html!

Missing:


  • local open for ... !! not yet implemented
  • write all ... !! not yet implemented
Back to index

APE Group. DESY Zeuthen 2001.

$Id: TAOmille-newsyntax.html,v 1.1 2001/04/26 08:58:36 noe Exp $