-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unary Stencil #512
base: master
Are you sure you want to change the base?
Unary Stencil #512
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,7 @@ module Data.Array.Accelerate.Language ( | |
-- * Conversions | ||
ord, chr, boolToInt, bitcast, | ||
|
||
) where | ||
Stencil1,Stencil1x3,Stencil1x5,Stencil1x1,Stencil3x1,Stencil5x1) where | ||
|
||
import Data.Array.Accelerate.AST ( PrimFun(..) ) | ||
import Data.Array.Accelerate.Pattern | ||
|
@@ -117,8 +117,8 @@ import Data.Array.Accelerate.Classes.Fractional | |
import Data.Array.Accelerate.Classes.Integral | ||
import Data.Array.Accelerate.Classes.Num | ||
import Data.Array.Accelerate.Classes.Ord | ||
|
||
import Prelude ( ($), (.), Maybe(..), Char ) | ||
import Data.Array.Accelerate.Sugar.Stencil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The imports were structured before -- whether that's useful is debatable. But I think |
||
|
||
|
||
-- $setup | ||
|
@@ -851,14 +851,20 @@ backpermute = Acc $$$ applyAcc (Backpermute $ shapeR @sh') | |
-- | ||
|
||
-- DIM1 stencil type | ||
type Stencil1 a = Unary (Exp a) | ||
type Stencil3 a = (Exp a, Exp a, Exp a) | ||
type Stencil5 a = (Exp a, Exp a, Exp a, Exp a, Exp a) | ||
type Stencil7 a = (Exp a, Exp a, Exp a, Exp a, Exp a, Exp a, Exp a) | ||
type Stencil9 a = (Exp a, Exp a, Exp a, Exp a, Exp a, Exp a, Exp a, Exp a, Exp a) | ||
|
||
-- DIM2 stencil type | ||
type Stencil1x1 a = Unary (Stencil1 a) | ||
type Stencil3x1 a = Unary (Stencil3 a) | ||
type Stencil5x1 a = Unary (Stencil5 a) | ||
type Stencil1x3 a = (Stencil1 a, Stencil1 a, Stencil1 a) | ||
type Stencil3x3 a = (Stencil3 a, Stencil3 a, Stencil3 a) | ||
type Stencil5x3 a = (Stencil5 a, Stencil5 a, Stencil5 a) | ||
type Stencil1x5 a = (Stencil1 a, Stencil1 a, Stencil1 a, Stencil1 a, Stencil1 a) | ||
type Stencil3x5 a = (Stencil3 a, Stencil3 a, Stencil3 a, Stencil3 a, Stencil3 a) | ||
type Stencil5x5 a = (Stencil5 a, Stencil5 a, Stencil5 a, Stencil5 a, Stencil5 a) | ||
|
||
|
@@ -908,15 +914,13 @@ type Stencil5x5x5 a = (Stencil5x5 a, Stencil5x5 a, Stencil5x5 a, Stencil5x5 a, S | |
-- <https://en.wikipedia.org/wiki/Gaussian_blur Gaussian blur> as a separable | ||
-- 2-pass operation. | ||
-- | ||
-- > type Stencil5x1 a = (Stencil3 a, Stencil5 a, Stencil3 a) | ||
-- > type Stencil1x5 a = (Stencil3 a, Stencil3 a, Stencil3 a, Stencil3 a, Stencil3 a) | ||
-- > | ||
-- > convolve5x1 :: Num a => [Exp a] -> Stencil5x1 a -> Exp a | ||
-- > convolve5x1 kernel (_, (a,b,c,d,e), _) | ||
-- > convolve5x1 kernel (a,b,c,d,e) | ||
-- > = Prelude.sum $ Prelude.zipWith (*) kernel [a,b,c,d,e] | ||
-- > | ||
-- > convolve1x5 :: Num a => [Exp a] -> Stencil1x5 a -> Exp a | ||
-- > convolve1x5 kernel ((_,a,_), (_,b,_), (_,c,_), (_,d,_), (_,e,_)) | ||
-- > convolve1x5 kernel (a,b,c,d,e) | ||
-- > = Prelude.sum $ Prelude.zipWith (*) kernel [a,b,c,d,e] | ||
-- > | ||
-- > gaussian = [0.06136,0.24477,0.38774,0.24477,0.06136] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,5 +123,5 @@ runQ $ | |
in | ||
tySynD (mkName ("Tup" ++ show n)) (map plainTV xs) rhs | ||
in | ||
mapM mkT [2..16] | ||
mapM mkT [0..16] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Zero as well? |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A newline before the
)
and an indent before the names would be nice here