repa 3.2.3.3 → 3.2.5.1
raw patch · 8 files changed
+89/−65 lines, 8 filesdep ~QuickCheckdep ~basedep ~template-haskell
Dependency ranges changed: QuickCheck, base, template-haskell
Files
- Data/Array/Repa/Arbitrary.hs +2/−2
- Data/Array/Repa/Eval/Chunked.hs +22/−9
- Data/Array/Repa/Eval/Cursored.hs +7/−7
- Data/Array/Repa/Eval/Interleaved.hs +8/−3
- Data/Array/Repa/Eval/Reduction.hs +17/−13
- Data/Array/Repa/Stencil/Dim2.hs +6/−6
- LICENSE +21/−20
- repa.cabal +6/−5
Data/Array/Repa/Arbitrary.hs view
@@ -72,12 +72,12 @@ instance (Shape a, CoArbitrary a) => CoArbitrary (a :. Int) where- coarbitrary (a :. b) = coarbitrary a >< coarbitrary b+ coarbitrary (a :. b) = coarbitrary a . coarbitrary b instance (CoArbitrary sh, CoArbitrary a, Source r a, Shape sh) => CoArbitrary (Array r sh a) where coarbitrary arr - = (coarbitrary . extent $ arr) >< (coarbitrary . toList $ arr)+ = (coarbitrary . extent $ arr) . (coarbitrary . toList $ arr) -- Wrappers -------------------------------------------------------------------
Data/Array/Repa/Eval/Chunked.hs view
@@ -27,7 +27,9 @@ fillLinearS !(I# len) write getElem = fill 0# where fill !ix- | ix >=# len = return ()+ | 1# <- ix >=# len+ = return ()+ | otherwise = do write (I# ix) (getElem (I# ix)) fill (ix +# 1#)@@ -63,14 +65,18 @@ {-# INLINE fillBlock #-} fillBlock !y !ix- | y >=# y1 = return ()+ | 1# <- y >=# y1+ = return ()+ | otherwise = do fillLine1 x0 ix fillBlock (y +# 1#) (ix +# imageWidth) where {-# INLINE fillLine1 #-} fillLine1 !x !ix'- | x >=# x1 = return ()+ | 1# <- x >=# x1+ = return ()+ | otherwise = do write (I# ix') (getElem (Z :. (I# y) :. (I# x))) fillLine1 (x +# 1#) (ix' +# 1#)@@ -107,13 +113,18 @@ {-# INLINE splitIx #-} splitIx thread- | thread <# chunkLeftover = thread *# (chunkLen +# 1#)- | otherwise = thread *# chunkLen +# chunkLeftover+ | 1# <- thread <# chunkLeftover + = thread *# (chunkLen +# 1#) + | otherwise + = thread *# chunkLen +# chunkLeftover+ -- Evaluate the elements of a single chunk. {-# INLINE fill #-} fill !ix !end- | ix >=# end = return ()+ | 1# <- ix >=# end + = return ()+ | otherwise = do write (I# ix) (getElem (I# ix)) fill (ix +# 1#) end@@ -153,8 +164,8 @@ {-# INLINE splitIx #-} splitIx thread- | thread <# chunkLeftover = thread *# (chunkLen +# 1#)- | otherwise = thread *# chunkLen +# chunkLeftover+ | 1# <- thread <# chunkLeftover = thread *# (chunkLen +# 1#)+ | otherwise = thread *# chunkLen +# chunkLeftover -- Given the threadId, starting and ending indices. -- Make a function to get each element for this chunk@@ -170,7 +181,9 @@ fill !getElem !ix0 !end = go ix0 where go !ix- | ix >=# end = return ()+ | 1# <- ix >=# end+ = return ()+ | otherwise = do x <- getElem (I# ix) write (I# ix) x
Data/Array/Repa/Eval/Cursored.hs view
@@ -11,8 +11,8 @@ import Data.Array.Repa.Eval.Elt import Data.Array.Repa.Eval.Gang import GHC.Base-import Prelude as P + -- Non-cursored interface ----------------------------------------------------- -- | Fill a block in a rank-2 array in parallel. --@@ -115,8 +115,8 @@ -- Get the starting pixel of a column in the image. {-# INLINE colIx #-} colIx !ix- | ix <# colChunkSlack = x0 +# (ix *# (colChunkLen +# 1#))- | otherwise = x0 +# (ix *# colChunkLen) +# colChunkSlack+ | 1# <- ix <# colChunkSlack = x0 +# (ix *# (colChunkLen +# 1#))+ | otherwise = x0 +# (ix *# colChunkLen) +# colChunkSlack -- Give one column to each thread {-# INLINE fillBlock #-}@@ -168,14 +168,14 @@ {-# INLINE fillBlock #-} fillBlock !y- | y >=# y1 = return ()+ | 1# <- y >=# y1 = return () | otherwise = do fillLine4 x0 fillBlock (y +# 1#) where {-# INLINE fillLine4 #-} fillLine4 !x- | x +# 4# >=# x1 = fillLine1 x+ | 1# <- x +# 4# >=# x = fillLine1 x | otherwise = do -- Compute each source cursor based on the previous one so that -- the variable live ranges in the generated code are shorter.@@ -209,9 +209,9 @@ {-# INLINE fillLine1 #-} fillLine1 !x- | x >=# x1 = return ()+ | 1# <- x >=# x1 = return () | otherwise- = do let val0 = (getElem $ makeCursor (Z :. (I# y) :. (I# x)))+ = do let val0 = (getElem $ makeCursor (Z :. (I# y) :. (I# x))) write (I# (x +# (y *# imageWidth))) val0 fillLine1 (x +# 1#)
Data/Array/Repa/Eval/Interleaved.hs view
@@ -40,8 +40,11 @@ -- How many elements to compute with this thread. elemsForThread thread- | thread <# chunkLenSlack = chunkLenBase +# 1#- | otherwise = chunkLenBase+ | 1# <- thread <# chunkLenSlack+ = chunkLenBase +# 1#++ | otherwise+ = chunkLenBase {-# INLINE elemsForThread #-} -- Evaluate the elements of a single chunk.@@ -49,7 +52,9 @@ = go ix0 count0 where go !ix !count- | count <=# 0# = return ()+ | 1# <- count <=# 0# + = return ()+ | otherwise = do write (I# ix) (getElem (I# ix)) go (ix +# step) (count -# 1#)
Data/Array/Repa/Eval/Reduction.hs view
@@ -26,7 +26,9 @@ {-# INLINE iter #-} iter !sh !sz - | sh >=# end = return ()+ | 1# <- sh >=# end + = return ()+ | otherwise = do let !next = sz +# n M.unsafeWrite vec (I# sh) (reduceAny get c r sz next)@@ -56,9 +58,9 @@ {-# INLINE split #-} split !ix = let !ix' = ix *# step- in if len <# ix' - then len- else ix'+ in case len <# ix' of+ 0# -> ix'+ _ -> len {-# INLINE fill #-} fill !start !end @@ -66,7 +68,9 @@ where {-# INLINE iter #-} iter !sh !sz - | sh >=# end = return ()+ | 1# <- sh >=# end + = return ()+ | otherwise = do let !next = sz +# n M.unsafeWrite vec (I# sh) (reduce f c r (I# sz) (I# next))@@ -148,8 +152,8 @@ where {-# INLINE iter #-} iter !i !z - | i >=# end = z - | otherwise = iter (i +# 1#) (f i `c` z)+ | 1# <- i >=# end = z + | otherwise = iter (i +# 1#) (f i `c` z) {-# INLINE [0] reduceInt #-}@@ -165,8 +169,8 @@ where {-# INLINE iter #-} iter !i !z - | i >=# end = z - | otherwise = iter (i +# 1#) (f i `c` z)+ | 1# <- i >=# end = z + | otherwise = iter (i +# 1#) (f i `c` z) {-# INLINE [0] reduceFloat #-}@@ -182,8 +186,8 @@ where {-# INLINE iter #-} iter !i !z - | i >=# end = z - | otherwise = iter (i +# 1#) (f i `c` z)+ | 1# <- i >=# end = z + | otherwise = iter (i +# 1#) (f i `c` z) {-# INLINE [0] reduceDouble #-}@@ -199,8 +203,8 @@ where {-# INLINE iter #-} iter !i !z - | i >=# end = z - | otherwise = iter (i +# 1#) (f i `c` z)+ | 1# <- i >=# end = z + | otherwise = iter (i +# 1#) (f i `c` z) {-# INLINE unboxInt #-}
Data/Array/Repa/Stencil/Dim2.hs view
@@ -190,8 +190,8 @@ {-# NOINLINE getData' #-} getData' :: Int# -> Int# -> a getData' !x !y- | x <# 0# || x >=# aWidth- || y <# 0# || y >=# aHeight+ | 1# <- (x <# 0#) `orI#` (x >=# aWidth)+ `orI#` (y <# 0#) `orI#` (y >=# aHeight) = fixed | otherwise@@ -239,15 +239,15 @@ {-# NOINLINE wrapLoadX #-} wrapLoadX :: Int# -> Int# -> a wrapLoadX !x !y- | x <# 0# = wrapLoadY 0# y- | x >=# aWidth = wrapLoadY (aWidth -# 1#) y+ | 1# <- x <# 0# = wrapLoadY 0# y+ | 1# <- x >=# aWidth = wrapLoadY (aWidth -# 1#) y | otherwise = wrapLoadY x y {-# NOINLINE wrapLoadY #-} wrapLoadY :: Int# -> Int# -> a wrapLoadY !x !y- | y <# 0# = loadXY x 0#- | y >=# aHeight = loadXY x (aHeight -# 1#)+ | 1# <- y <# 0# = loadXY x 0#+ | 1# <- y >=# aHeight = loadXY x (aHeight -# 1#) | otherwise = loadXY x y {-# INLINE loadXY #-}
LICENSE view
@@ -1,24 +1,25 @@-Copyright (c) 2010-2012, University of New South Wales.-All rights reserved.+Copyright (c) 2001-2014, The Data Parallel Haskell Team Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:- * Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.- * Redistributions in binary form must reproduce the above copyright- notice, this list of conditions and the following disclaimer in the- documentation and/or other materials provided with the distribution.- * Neither the name of the University of New South Wales nor the- names of its contributors may be used to endorse or promote products- derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE-DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+- Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++- Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++- The names of the copyright holders may not be used to endorse or promote+ products derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
repa.cabal view
@@ -1,5 +1,5 @@ Name: repa-Version: 3.2.3.3+Version: 3.2.5.1 License: BSD3 License-file: LICENSE Author: The DPH Team@@ -21,12 +21,12 @@ Library Build-Depends: - base == 4.6.*,- ghc-prim == 0.3.*,+ base == 4.7.*,+ template-haskell == 2.9.*, vector == 0.10.*,+ ghc-prim == 0.3.*, bytestring == 0.10.*,- template-haskell == 2.8.*,- QuickCheck >= 2.3 && < 2.7+ QuickCheck == 2.7.* ghc-options: -Wall -fno-warn-missing-signatures@@ -46,6 +46,7 @@ StandaloneDeriving ScopedTypeVariables PatternGuards+ ExistentialQuantification Exposed-modules: Data.Array.Repa.Eval.Gang