Changes between Version 3 and Version 4 of DataParallel/VectPragma


Ignore:
Timestamp:
Jun 21, 2011 1:32:00 PM (3 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/VectPragma

    v3 v4  
    88Given a function `f`, the vectoriser generates a vectorised version `f_v`, which comprises the original, scalar version of the function and a second version lifted into array space.  The lifted version operates on arrays of inputs and produces arrays of results in one parallel computation.  The original function name is, then, rebound to use the scalar version referred to by `f_v`.  This differs from the original in that it uses vectorised versions for any embedded parallel array computations. 
    99 
    10 However, if a function `f` is accompanied by a pragma of the form 
     10However, if a variable `f` is accompanied by a pragma of the form 
    1111{{{ 
    1212{-# VECTORISE f = e #-} 
     
    1717== The NOVECTORISE pragma == 
    1818 
    19 If a function `f` is accompanied by a pragma 
     19If a variable `f` is accompanied by a pragma 
    2020{{{ 
    2121{-# NOVECTORISE f #-} 
     
    2626 
    2727== VECTORISE SCALAR == 
     28 
     29Functions that contain no array computations, especially if they are cheap (such as `(+)`), should not be vectorised, but applied by simply mapping them over an array.  This could be achieved by using the `VECTORISE` pragma with an appropriate right-hand side, but leads to repetitive code that we rather like the compiler to generate. 
     30 
     31If a unary function `f` is accompanied by a pragma 
     32{{{ 
     33{-# VECTORISE SCALAR f #-} 
     34}}} 
     35then the vectoriser generates  
     36{{{ 
     37f_v = closure1 f (scalar_map f) 
     38}}} 
     39and keeps `f` unchanged. 
     40 
     41For a binary function, it generates 
     42{{{ 
     43f_v = closure2 f (scalar_zipWith f) 
     44}}} 
     45for a tertiary function, it generates 
     46{{{ 
     47f_v = closure3 f (scalar_zipWith3 f) 
     48}}} 
     49and so on.  (The variable `f` must have a proper function type.)