Changes between Version 9 and Version 10 of DataParallel/Replicate


Ignore:
Timestamp:
Aug 7, 2011 7:41:14 AM (4 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/Replicate

    v9 v10  
    3232== A plan to fix the problem == 
    3333 
     34Generally, we don't want to copy replicated data — it's a waste of space!  We definitely don't want to do it for large data structures, and in particular, we don't want to do it for arrays.  After all, that can change the asymptotic work complexity of a program.  To keep it simple, we are for the moment focusing on avoiding replicating arrays, as this is were our practical problems are coming from at the moment.  (Some cases of replicated scalars are also eliminated by fusion.) 
     35 
     36=== Repeated segments === 
     37 
     38A replicated array results is always represented by a segmented array; more precisely, by a segmented array where a contiguous sequence of segments contains the same data.  For example, we have 
     39{{{ 
     40replicateP 3 [:1, 2, 3:] = [:[:1, 2, 3:], [:1, 2, 3:], [:1, 2, 3:]:] 
     41  where 
     42    [:[:1, 2, 3:], [:1, 2, 3:], [:1, 2, 3:]:] = ([:3, 3, 3:], [:1, 2, 3, 1, 2, 3, 1, 2, 3:]) 
     43}}} 
     44and 
     45{{{ 
     46replicateP^ [:2, 3:] [:[:1, 2:], [:3:]:] = [:[:1, 2:], [:1, 2:], [:3:], [:3:], [:3:]:] 
     47  where 
     48    [:[:1, 2:], [:1, 2:], [:3:], [:3:], [:3:]:] = ([:2, 2, 1, 1, 1:], [:1, 2, 1, 2, 3, 3, 3:]) 
     49}}} 
     50 
     51=== Collapse repeated segments === 
     52 
     53In practice, segments descriptors store more information than just the segment length.  They at least additionally store the start position of each segment in the data array.  In the conventional representation, an invariant is that the start positions are such that the segments don't overlap.  To represent arrays with repeated segments more efficiently, we propose to relax that invariant.  Specifically, all start positions of a contiguous sequence of repeated segments are the same; i.e., the segment data is stored only once per sequence of repeated segments. 
     54 
     55== Related work == 
     56 
     57 * The work-efficient vectorisation paper by Prins et al.  Their approach only works in a first-order language. 
     58 * Blelloch's work on the space-behaviour of data-parallel programs. 
     59 
     60---- 
     61 
     62= OLD MATERIAL = 
     63 
     64 
     65== A plan to fix the problem == 
     66 
    3467Generally, we don't want to copy replicated data — it's a waste of space!  We definitely don't want to do it for large data structures, and in particular, we don't want to do it for arrays.  After all, that can change the asymptotic work complexity of a program.  So, instead of having `replicateP` allocate and fill a new array with multiple copies of the same data, we use a special array representation that stores the data (once!) together with the replication count.  This is surely the most space efficient representation for a replicated array. 
    3568 
     
    6295 
    6396'''***''' Is this really an issue?  After all, we don't replicated thread-local slices of parallel arrays (which in turn may be sliced vectors), but replicate parallel arrays (which are already distributed over multiple threads). 
    64  
    65 == Related work == 
    66  
    67  * The work-efficient vectorisation paper by Prins et al.  Their approach only works in a first-order language. 
    68  * Blelloch's work on the space-behaviour of data-parallel programs.