Changes between Version 4 and Version 5 of DataParallel/Vectorisation


Ignore:
Timestamp:
May 24, 2007 2:19:30 PM (7 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/Vectorisation

    v4 v5  
    2929Vectorisation transforms all uses of functions from `GHC.PArr` into uses of package ndp.  It can obviously only do that for computations manipulating values for whose type we have `PA` instances. 
    3030 
     31=== Basic data types === 
     32 
     33In the generated code, we need closures, array families, array closure, and so forth.  We define closure as: 
     34{{{ 
     35data a :-> b = forall e. !(e -> a -> b) :$ e 
     36}}} 
     37with basic closure cosntruction and application as 
     38{{{ 
     39lam :: (a -> b) -> (a :-> b) 
     40lam f = const f :$ () 
     41 
     42($:) :: (a :-> b) -> a -> b 
     43(f :$ e) $: x = f e x 
     44}}} 
     45 
     46Moreover, we have a type class `PA` determining the types of values that may occur as array elements in flattened arrays.  The array type family `PArr` is associated with `PA`: 
     47{{{ 
     48class PA a where 
     49  data PArr a 
     50  replicateP :: Int -> a -> PArr a 
     51  mapP       :: PA b => (a -> b) -> PArr a -> PArr b 
     52  ..and so on.. 
     53}}} 
     54 
     55A crucial element in the transformation is the representation of arrays of closures as ''array closures'': 
     56{{{ 
     57data a :=> b  
     58  = forall e. PA e =>  
     59      !(PArr e -> PArr a -> PArr b) ::$ PArr e 
     60}}} 
     61We apply array closures as follows: 
     62{{{ 
     63($::) :: (a :=> b) -> PArr a -> PArr b 
     64(fs ::$ es) $:: as = fs es as 
     65}}} 
     66 
    3167=== Transformations === 
    3268