Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Finished Stencil by expanding nested Stencils for multi-dimensional S…

…tencils
  • Loading branch information...
commit db43d4d9098646290eda70797e6157fbb9b17f72 1 parent 3753c7e
@blambo authored
Showing with 44 additions and 0 deletions.
  1. +44 −0 Data/Array/Accelerate/Repa/Stencil.hs
View
44 Data/Array/Accelerate/Repa/Stencil.hs
@@ -70,6 +70,7 @@ baseStencils
$$ text "where"
$$ nest 1 (text "rf' id = rf (Z:.id)")))
+
nestedStencils
= text "instance" <+> parens (nestStenClass 3)
<+> text "=> MyStencil (sh:.Int:.Int) a (row1, row2, row3) where"
@@ -81,6 +82,49 @@ nestedStencils
$$ text "where"
$$ nest 1 (text "rf' d ds = rf (ds :. d)")))
+ $$ text "instance" <+> parens (nestStenClass 5)
+ <+> text "=> MyStencil (sh:.Int:.Int) a (row1, row2, row3, row4, row5) where"
+ $$ nest 1 ((stenData "ix:.i")
+ <+> (lparen <+> text "stencilData" <+> rf "i-2" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i-1" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+1" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+2" <+> text "ix"
+ $$ rparen
+ $$ text "where"
+ $$ nest 1 (text "rf' d ds = rf (ds :. d)")))
+
+ $$ text "instance" <+> parens (nestStenClass 7)
+ <+> text "=> MyStencil (sh:.Int:.Int) a (row1, row2, row3, row4, row5, row6, row7) where"
+ $$ nest 1 ((stenData "ix:.i")
+ <+> (lparen <+> text "stencilData" <+> rf "i-3" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i-2" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i-1" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+1" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+2" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+3" <+> text "ix"
+ $$ rparen
+ $$ text "where"
+ $$ nest 1 (text "rf' d ds = rf (ds :. d)")))
+
+ $$ text "instance" <+> parens (nestStenClass 9)
+ <+> text "=> MyStencil (sh:.Int:.Int) a (row1, row2, row3, row4, row5, row6, row7, row8, row9) where"
+ $$ nest 1 ((stenData "ix:.i")
+ <+> (lparen <+> text "stencilData" <+> rf "i-4" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i-3" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i-2" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i-1" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+1" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+2" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+3" <+> text "ix"
+ $$ comma <+> text "stencilData" <+> rf "i+4" <+> text "ix"
+ $$ rparen
+ $$ text "where"
+ $$ nest 1 (text "rf' d ds = rf (ds :. d)")))
+
+
boundary
= text "data Boundary a" <+> (text "= Clamp"
$$ text "| Mirror"
Please sign in to comment.
Something went wrong with that request. Please try again.