Commit e435fd4b authored by Simon Marlow's avatar Simon Marlow

Add the GC benchmark suite

These are the benchmarks uesd in our ISMM'08 paper on Parallel GC
parent 042fa8ec
TOP = ..
include $(TOP)/mk/boilerplate.mk
SUBDIRS= circsim constraints fibheaps fulsom gc_bench happy lcss power spellcheck ghc
# Discount treejoin: runs too quickly to see any speedup beyond a few procs
# Discount linear: heap is too small
# Discount cacheprof: heap is too small, runs too quickly, too much variation in the results
OTHER_SUBDIRS = treejoin linear cacheprof
date=$(shell date +%F)
# set 'tag' from the cmdline to add an extra tag to each logfile
logid=$(date)$(tag)
.DUMMY: allways threaded-1 threaded-2
HEAD ::
$(MAKE) clean boot
$(MAKE) -k EXTRA_HC_OPTS=-L$$HOME/builds/ghc/rts 2>&1 | tee log-$(logid)-HEAD
allways ::
$(MAKE) clean boot
$(MAKE) baseline
$(MAKE) parways
$(MAKE) analyse
parways ::
$(MAKE) clean boot
$(MAKE) threaded THREADS=1
$(MAKE) threaded THREADS=2
$(MAKE) threaded THREADS=3
$(MAKE) threaded THREADS=4
$(MAKE) threaded THREADS=5
$(MAKE) threaded THREADS=6
$(MAKE) threaded THREADS=7
$(MAKE) threaded THREADS=8
# HEAP=OLD
HEAP=LARGE
# default
THREADS=1
# baseline with the old heap settings (-H10m)
baseline ::
$(MAKE) -k HEAP=$(HEAP) 2>&1 | tee log-$(logid)-baseline
threaded ::
$(MAKE) -k HEAP=$(HEAP) EXTRA_HC_OPTS=-threaded EXTRA_RUNTEST_OPTS="+RTS -g$(THREADS) -RTS" 2>&1 | tee log-$(logid)-threaded-$(THREADS)
analyse ::
../../utils/nofib-analyse/nofib-analyse log-$(logid)-baseline log-$(logid)-threaded-* >nofib-analyse-$(logid)
include $(TOP)/mk/target.mk
This diff is collapsed.
{------------------------------------------------------------------------}
{--- Generic stuff for all architectures. Generics.hs ---}
{------------------------------------------------------------------------}
{-
This file is part of Cacheprof, a profiling tool for finding
sources of cache misses in programs.
Copyright (C) 1999 Julian Seward (jseward@acm.org)
Home page: http://www.cacheprof.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file LICENSE.
-}
module Generics where
internal msg
= error ("\ncacheann: Internal error: " ++ msg ++ "\n")
incomplete msg
= error ("\ncacheann: Unhandled instruction set artefact:\n "
++ msg ++ "\n")
inputerr msg
= error ("\ncacheann: Bad input: " ++ msg ++ "\n")
{-----------------------------------------------------------}
{--- A data type for lexemes ---}
{-----------------------------------------------------------}
{- In here, LReg, LLiteral and LName are arch/syntax
specific, but I don't think this matters, so long
as the arch-specific lexer produces the Right Things.
Note that lexers themselves are arch/syntax
specific.
-}
data Lex
= LReg String -- a register name eg "%eax"
| LNum String -- a number "456"
| LLiteral String -- a literal value "$12"
| LName String -- a name "fprintf"
| LLabel String -- a label ".L3345"
| LComma
| LLParen
| LRParen
| LPlus
| LMinus
| LStar
| LDollar
deriving (Show, Eq)
unLReg (LReg s) = s
isLReg lx = case lx of { LReg _ -> True; _ -> False }
unLNum (LNum s) = s
isLNum lx = case lx of { LNum _ -> True; _ -> False }
unLLiteral (LLiteral s) = s
isLLiteral lx = case lx of { LLiteral _ -> True; _ -> False }
unLName (LName s) = s
isLName lx = case lx of { LName _ -> True; _ -> False }
unLLabel (LLabel s) = s
isLLabel lx = case lx of { LLabel _ -> True; _ -> False }
{-----------------------------------------------------------}
{--- Combinator parser generics -- building blocks for ---}
{--- parsers ---}
{-----------------------------------------------------------}
data PResult a
= PFail
| POk a [Lex]
deriving Show
type Parser a = [Lex] -> PResult a
pEmpty :: a -> Parser a
pEmpty x ts = POk x ts
pSat :: (Lex -> Bool) -> Parser Lex
pSat p [] = PFail
pSat p (t:ts) = if p t then POk t ts else PFail
pApply :: (a -> b) -> Parser a -> Parser b
pApply f p ts
= case p ts of
PFail -> PFail
POk x uu -> POk (f x) uu
pName :: String -> a -> Parser a
pName w x ((LName w2):lxs)
= if w == w2 then POk x lxs else PFail
pName w x _ = PFail
p2 :: (a -> b -> c)
-> Parser a -> Parser b -> Parser c
p2 f p1 p2 ts1
= case p1 ts1 of { PFail -> PFail ; POk x1 uu1 ->
case p2 uu1 of { PFail -> PFail ; POk x2 uu2 ->
POk (f x1 x2) uu2
}}
p3 :: (a -> b -> c -> d)
-> Parser a -> Parser b -> Parser c -> Parser d
p3 f p1 p2 p3 ts1
= case p1 ts1 of { PFail -> PFail ; POk x1 uu1 ->
case p2 uu1 of { PFail -> PFail ; POk x2 uu2 ->
case p3 uu2 of { PFail -> PFail ; POk x3 uu3 ->
POk (f x1 x2 x3) uu3
}}}
pStar :: Parser a -> Parser [a]
pStar p ts
= case p ts of
PFail -> POk [] ts
POk x uu1 -> case pStar p uu1 of
POk xs uu2 -> POk (x:xs) uu2
PFail -> internal "pStar failed"
pPlus :: Parser a -> Parser [a]
pPlus p = p2 (:) p (pStar p)
pAlt2 :: Parser a -> Parser a -> Parser a
pAlt2 p1 p2 ts
= case p1 ts of
POk x1 uu -> POk x1 uu
PFail -> p2 ts
pAlts :: [Parser a] -> Parser a
pAlts = foldl1 pAlt2
pOpt :: Parser a -> Parser (Maybe a)
pOpt p ts
= case p ts of
PFail -> POk Nothing ts
POk x uu -> POk (Just x) uu
pStarComma p
= pAlts [
p2 (\xs y -> xs++[y]) (pPlus (p2 (\x y -> x) p pLComma)) p,
pApply (\x -> [x]) p,
pEmpty []
]
pLComma = pSat (== LComma)
pLMinus = pSat (== LMinus)
pLPlus = pSat (== LPlus)
pLLParen = pSat (== LLParen)
pLRParen = pSat (== LRParen)
pLStar = pSat (== LStar)
pLDollar = pSat (== LDollar)
pInParens p = p3 (\_ r _ -> r) pLLParen p pLRParen
pPreComma p = p2 (\_ r -> r) pLComma p
pPreCommaOpt p = p2 (\_ r -> r) (pOpt pLComma) p
{------------------------------------------------------------------------}
{--- end Generics.hs ---}
{------------------------------------------------------------------------}
This diff is collapsed.
TOP = ../..
include $(TOP)/mk/boilerplate.mk
ifeq "$(HEAP)" "LARGE"
SRC_RUNTEST_OPTS += +RTS -H16m -RTS
endif
ifeq "$(HEAP)" "OLD"
SRC_RUNTEST_OPTS += +RTS -H10m -RTS
endif
include $(TOP)/mk/target.mk
This diff is collapsed.
This diff is collapsed.
.section .ctors,"aw"
.long cacheprof_register2_me
.section .dtors,"aw"
.long cacheprof_finalise2_me
.text
.align 4
cacheprof_hook_Rd1:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Rd1
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Rd2:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Rd2
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Rd4:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Rd4
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Rd8:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Rd8
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Mo1:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Mo1
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Mo2:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Mo2
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Mo4:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Mo4
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Mo8:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Mo8
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Wr1:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Wr1
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Wr2:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Wr2
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Wr4:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Wr4
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_hook_Wr8:
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
pushl %ebp
pushfl
pushl %eax # eax has addr referenced
pushl %ebx # ebx has addr of cc
call cacheprof_log_Wr8
addl $8,%esp
popfl
popl %ebp
popl %edi
popl %esi
popl %edx
popl %ecx
ret
cacheprof_register2_me:
pushal
pushfl
movl $.Lcacheprof_magic_table,%eax
pushl %eax
call cacheprof_register2_module
popl %eax
popfl
popal
ret
cacheprof_finalise2_me:
pushal
pushfl
movl $.Lcacheprof_magic_table,%eax
pushl %eax
call cacheprof_finalise2_module
popl %eax
popfl
popal
ret
This diff is collapsed.
TOP = ../..
include $(TOP)/mk/boilerplate.mk
FAST_OPTS = 8 100
NORM_OPTS = 8 5000
SLOW_OPTS = 8 5000
ifeq "$(HEAP)" "LARGE"
SRC_RUNTEST_OPTS += +RTS -H256m -RTS
endif
ifeq "$(HEAP)" "OLD"
SRC_RUNTEST_OPTS += +RTS -H30m -RTS
endif
include $(TOP)/mk/target.mk
[[F,F,F,F,F,F,F,F],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],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,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T],[T,T,T,T,T,T,T,T]]
This diff is collapsed.
{- Andrew Tolmach and Thomas Nordin's contraint solver
See Proceedings of WAAAPL '99
-}
import Prelude hiding (Maybe(Just,Nothing))
import List
import System
-----------------------------
-- The main program
-----------------------------
main = do
[arg] <- getArgs
let
n = read arg :: Int
try algorithm = print (length (search algorithm (queens n)))
sequence_ (map try [bt, bm, bjbt, bjbt', fc])
-----------------------------
-- Figure 1. CSPs in Haskell.
-----------------------------
type Var = Int
type Value = Int
data Assign = Var := Value deriving (Eq, Ord, Show)
type Relation = Assign -> Assign -> Bool
data CSP = CSP { vars, vals :: Int, rel :: Relation }
type State = [Assign]
level :: Assign -> Var
level (var := val) = var
value :: Assign -> Value
value (var := val) = val
maxLevel :: State -> Var
maxLevel [] = 0
maxLevel ((var := val):_) = var
complete :: CSP -> State -> Bool
complete CSP{vars=vars} s = maxLevel s == vars
generate :: CSP -> [State]
generate CSP{vals=vals,vars=vars} = g vars
where g 0 = [[]]
g var = [ (var := val):st | val <- [1..vals], st <- g (var-1) ]
inconsistencies :: CSP -> State -> [(Var,Var)]
inconsistencies CSP{rel=rel} as = [ (level a, level b) | a <- as, b <- reverse as, a > b, not (rel a b) ]
consistent :: CSP -> State -> Bool
consistent csp = null . (inconsistencies csp)
test :: CSP -> [State] -> [State]
test csp = filter (consistent csp)
solver :: CSP -> [State]
solver csp = test csp candidates
where candidates = generate csp
queens :: Int -> CSP
queens n = CSP {vars = n, vals = n, rel = safe}
where safe (i := m) (j := n) = (m /= n) && abs (i - j) /= abs (m - n)
-------------------------------
-- Figure 2. Trees in Haskell.
-------------------------------
data Tree a = Node a [Tree a]
label :: Tree a -> a
label (Node lab _) = lab
type Transform a b = Tree a -> Tree b
mapTree :: (a -> b) -> Transform a b
mapTree f (Node a cs) = Node (f a) (map (mapTree f) cs)
foldTree :: (a -> [b] -> b) -> Tree a -> b
foldTree f (Node a cs) = f a (map (foldTree f) cs)
filterTree :: (a -> Bool) -> Transform a a
filterTree p = foldTree f
where f a cs = Node a (filter (p . label) cs)
prune :: (a -> Bool) -> Transform a a
prune p = filterTree (not . p)
leaves :: Tree a -> [a]
leaves (Node leaf []) = [leaf]
leaves (Node _ cs) = concat (map leaves cs)
initTree :: (a -> [a]) -> a -> Tree a
initTree f a = Node a (map (initTree f) (f a))
--------------------------------------------------
-- Figure 3. Simple backtracking solver for CSPs.
--------------------------------------------------
mkTree :: CSP -> Tree State
mkTree CSP{vars=vars,vals=vals} = initTree next []
where next ss = [ ((maxLevel ss + 1) := j):ss | maxLevel ss < vars, j <- [1..vals] ]
data Maybe a = Just a | Nothing deriving Eq
earliestInconsistency :: CSP -> State -> Maybe (Var,Var)
earliestInconsistency CSP{rel=rel} [] = Nothing
earliestInconsistency CSP{rel=rel} (a:as) =
case filter (not . rel a) (reverse as) of
[] -> Nothing
(b:_) -> Just (level a, level b)
labelInconsistencies :: CSP -> Transform State (State,Maybe (Var,Var))
labelInconsistencies csp = mapTree f
where f s = (s,earliestInconsistency csp s)
btsolver0 :: CSP -> [State]
btsolver0 csp =
(filter (complete csp) . leaves . (mapTree fst) . prune ((/= Nothing) . snd)
. (labelInconsistencies csp) . mkTree) csp
-----------------------------------------------
-- Figure 6. Conflict-directed solving of CSPs.
-----------------------------------------------
data ConflictSet = Known [Var] | Unknown deriving Eq
knownConflict :: ConflictSet -> Bool
knownConflict (Known (a:as)) = True
knownConflict _ = False