Skip to content

Commit 46fc109

Browse files
committed
iterate failing
1 parent 5361c99 commit 46fc109

File tree

6 files changed

+47
-17
lines changed

6 files changed

+47
-17
lines changed

gibbon-compiler/examples/layout_bench/GenerateLayout1.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ mkBlogs_layout1 length =
1515
id = (ID (10 - (mod length 10)))
1616
author = (Author (getRandomString 5))
1717
date = (Date (getRandomString 5))
18-
content = (Content (Plain (mkRandomInlineList 5)))
19-
tags = (TagList (mkSomeTags 50))
18+
content = (Content (Plain (mkRandomInlineList 50)))
19+
tags = (TagList (mkSomeTags 10))
2020
rst = (mkBlogs_layout1 (length - 1))
2121
in Layout1 header id author date content tags rst
2222

gibbon-compiler/examples/layout_bench/manyFuncs.hs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ filterByKeywordInTagList keyword blogs = case blogs of
2828
emphKeywordInTag :: Text -> Blog -> Blog
2929
emphKeywordInTag keyword blogs = case blogs of
3030
End -> End
31-
Layout1 header id author date content tags rst -> let present = iterate (searchBlogTags keyword tags)
31+
Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags
3232
in if (present)
33-
then let --newContent = iterate (emphasizeBlogContent keyword content)
34-
newContent = case content of
33+
then let newContent = case content of
3534
Content block -> Content (emphasizeKeywordInBlock keyword block)
36-
newRst = iterate (emphKeywordInTag keyword rst)
35+
newRst = emphKeywordInTag keyword rst
3736
in Layout1 header id author date newContent tags newRst
3837
else
3938
let newRst = emphKeywordInTag keyword rst
@@ -42,10 +41,10 @@ emphKeywordInTag keyword blogs = case blogs of
4241

4342
-- main function
4443
gibbon_main =
45-
let blogs = mkBlogs_layout1 1000000
44+
let blogs = mkBlogs_layout1 2
4645
keyword :: Vector Char
4746
keyword = "a"
48-
newblgs = iterate (emphKeywordInContent keyword blogs)
49-
newblgs' = iterate (emphKeywordInTag keyword newblgs)
50-
newblgs'' = iterate (filterByKeywordInTagList keyword newblgs')
51-
in () --printPacked newblgs''
47+
newblgs = emphKeywordInContent keyword blogs
48+
newblgs' = emphKeywordInTag keyword newblgs
49+
newblgs'' = filterByKeywordInTagList keyword newblgs'
50+
in printPacked newblgs''
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
3+
data List = Cons Int List | Nil
4+
5+
addOneList :: List -> List
6+
addOneList lst = case lst of
7+
Nil -> Nil
8+
Cons x rst -> let newVal = iterate (addOne x)
9+
newRst = addOneList rst
10+
in Cons newVal newRst
11+
12+
13+
length :: List -> Int
14+
length lst = case lst of
15+
Nil -> 0
16+
Cons x rst -> 1 + length rst
17+
18+
addOne :: Int -> Int
19+
addOne x = x + 1
20+
21+
22+
mkList :: Int -> List
23+
mkList len = if len <= 0 then Nil
24+
else Cons len (mkList (len-1))
25+
26+
27+
28+
29+
gibbon_main = length (addOneList (mkList 10))

gibbon-compiler/src/Gibbon/Passes/AccessPatternsAnalysis.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ getGreedyOrder edges fieldLength =
8484
completeOrder = P.foldl (\lst val -> if S.member val (S.fromList lst) then lst
8585
else lst ++ [val]
8686
) partial_order [0 .. (fieldLength - 1)]
87-
in P.map P.toInteger completeOrder --dbgTraceIt (sdoc (edges, completeOrder)) P.map P.toInteger completeOrder
87+
in dbgTraceIt (sdoc (edges, completeOrder)) P.map P.toInteger completeOrder
8888

8989
greedyOrderOfVertices :: [((Integer, Integer), Integer)] -> [Int]
9090
greedyOrderOfVertices ee = let edges' = P.map (\((a, b), c) -> ((P.fromIntegral a, P.fromIntegral b), P.fromIntegral c)) ee
@@ -244,7 +244,7 @@ freeVarsInOrder exp =
244244
var_list = L.concat var_list_list
245245
in var_list
246246
ProjE i e -> error "freeVarsInOrder: TODO ProjE"
247-
TimeIt e ty b -> freeVarsInOrder e
247+
TimeIt e ty b -> error "freeVarsInOrder: TODO TimeIt"
248248
WithArenaE v e -> error "freeVarsInOrder: TODO WithArenaE"
249249
SpawnE f locs args -> error "freeVarsInOrder: TODO SpawnE"
250250
SyncE -> error "freeVarsInOrder: TODO SyncE"

gibbon-compiler/src/Gibbon/Passes/OptimizeADTLayout.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ dataConsInFunBody funBody = case funBody of
165165
IfE a b c -> S.unions $ [dataConsInFunBody a] ++ [dataConsInFunBody b] ++ [dataConsInFunBody c]
166166
MkProdE xs -> S.unions $ P.map dataConsInFunBody xs
167167
ProjE i e -> error "getGeneratedVariable: TODO ProjE"
168-
TimeIt e ty b -> dataConsInFunBody e
168+
TimeIt e ty b -> error "getGeneratedVariable: TODO TimeIt"
169169
WithArenaE v e -> error "getGeneratedVariable: TODO WithArenaE"
170170
SpawnE f locs args -> error "getGeneratedVariable: TODO SpawnE"
171171
SyncE -> error "getGeneratedVariable: TODO SyncE"
@@ -611,7 +611,7 @@ changeCallNameInRecFunction
611611
IfE a b c -> IfE (fixExp a) (fixExp b) (fixExp c)
612612
MkProdE xs -> MkProdE (P.map fixExp xs)
613613
ProjE i e -> error "getExpTyEnv: TODO ProjE"
614-
TimeIt e ty b -> TimeIt (fixExp e) ty b
614+
TimeIt e ty b -> error "getExpTyEnv: TODO TimeIt"
615615
WithArenaE v e -> error "getExpTyEnv: TODO WithArenaE"
616616
SpawnE f locs args -> error "getExpTyEnv: TODO SpawnE"
617617
SyncE -> error "getExpTyEnv: TODO SyncE"
@@ -1492,8 +1492,7 @@ reOrderLetExpHelper (Just var) letExpOrder expr = fst $ run letExpOrder expr
14921492
MkProdE xs -> let (xs', releasedBinds) = lambdaHandleExpList xs letExpOrder'
14931493
in (MkProdE xs', releasedBinds)
14941494
ProjE {} -> error "reOrderLetExpHelper: TODO ProjE"
1495-
TimeIt e ty b -> let (e', releasedBinds) = run letExpOrder' e
1496-
in (TimeIt e' ty b, releasedBinds)
1495+
TimeIt {} -> error "reOrderLetExpHelper: TODO TimeIt"
14971496
WithArenaE {} -> error "reOrderLetExpHelper: TODO WithArenaE"
14981497
SpawnE {} -> error "reOrderLetExpHelper: TODO SpawnE"
14991498
SyncE -> error "reOrderLetExpHelper: TODO SyncE"

gibbon-compiler/tests/test-gibbon-examples.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,3 +915,6 @@ tests:
915915
answer-file: examples/layout_bench/manyFuncsGlobal.ans
916916
failing: [interp1,pointer,gibbon1, gibbon3]
917917
run-modes: ["gibbon2"]
918+
919+
- name: test_iterate.hs
920+
skip: true

0 commit comments

Comments
 (0)