Ben Lever Ben.Lever at
Thu Jul 29 22:36:50 EDT 2010

Hi Manuel,

Thanks for all your comments. I think we're very close to converging on a final set of requirements. Here's a summary of what's be covered so far - let us know what you think.

A stencil describes a set of values from the source array (and possibly constant values) that a reduction operator is eventually applied to:

 *   Stencil elements are drawn/gathered from a neighbourhood of locations in the source array; the neighbourhood is described by its:
    *   extent (dimensionality and size)
    *   focal point (origin)
 *   Locations outside the source array can be described:
    *   in terms of the source array:
       *   clamping
       *   wrap-around
       *   mirroring
    *   as constant values:
       *   independent of the outside element location
       *   dependent on the outside element location
 *   The gathered stencil elements (drawn from the constrained neighbourhood) are ordered

Although not complete, as it doesn't handle the boundary-conditions, below is a revised function type:

    :: (Ix dim, Ix dim', Ix dimN, Elem a, Elem b)
    => Exp dim'                                                 -- ^Extent of the destination array
    -> Exp dimN                                                 -- ^Extent of the neighbourhood array
    -> Exp dimN                                                 -- ^Focal point of the neighbourhood
    -> Exp Int                                                  -- ^Number of elements to gather
    -> (Exp dim' -> Exp Int -> dimN)                            -- ^Gathering function (doesn't handle constants or boundary-conditions)
    -> (Exp dim' -> Exp Int -> Exp b -> Exp a -> Exp b)         -- ^Reduction operator (now also passing in index of stencil element)
    -> Exp b                                                    -- ^Reduction identity value
    -> Acc (Array dim a)                                        -- ^Source array
    -> Acc (Array dim' b)                                       -- ^Destination array

It's starting to look overly complicated - I feel there's a better way. Perhaps the stencil description should be extracted out as something separate given that it specifies so much?


Ben Lever
Senior Researcher Engineer
National ICT Australia

NICTA l Locked Bag 9013 l Alexandria NSW 1435
T + 612 8306 0742 | F +612 9376 2027<> l ben.lever at<mailto:rami.mukhtar at>

More information about the Accelerate mailing list