#4081: Strict constructor fields inspected in loop
---------------------------------+------------------------------------------
Reporter: rl | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.0.2
Component: Compiler | Version: 6.13
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Runtime performance bug
---------------------------------+------------------------------------------
Comment(by rl):
It turns out that this still is quite critical for DPH after all. We
implement a parallel `map` on vectors more or less like this:
{{{
splitD :: Vector a -> Dist (Vector a)
joinD :: Dist (Vector a) -> Vector a
mapD :: (a -> b) -> Dist a -> Dist b
mapPar :: (a -> b) -> Vector a -> Vector b
mapPar f = joinD . mapD (map f) . splitD
}}}
Here, `map f` is a loop which is applied in parallel to chunks of the
vector (which are themselves vectors). Although `mapD` will seq on the
vector before passing it to the loop, this isn't enough for, say, vectors
of pairs:
{{{
data instance Vector (a,b) = V_2 !Int !(Vector a) !(Vector b)
}}}
There is no way to have the inspection happen outside of the loop at the
moment. LiberateCase does catch this but it duplicates huge amounts of
code so relying on it isn't a good idea.
Fusion sometimes gets rid of this, too, but not always.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4081#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs