#3259: A module-local combinator using Control.Parallel.par behaves differently
than when it's imported
-------------------------+--------------------------------------------------
    Reporter:  blamario  |        Owner:         
        Type:  bug       |       Status:  closed 
    Priority:  normal    |    Milestone:         
   Component:  Compiler  |      Version:  6.11   
    Severity:  normal    |   Resolution:  fixed  
    Keywords:            |   Difficulty:  Unknown
    Testcase:            |           Os:  Linux  
Architecture:  x86       |  
-------------------------+--------------------------------------------------
Changes (by simonpj):

  * status:  new => closed
  * resolution:  => fixed

Comment:

 OK so after talking to Simon I indeed moved the exposure of `lazy` into
 `CorePrep`.  That certainly fixes the bug.
 {{{
 Fri May 29 00:20:20 PDT 2009  simo...@microsoft.com
   * Fix Trac #3259: expose 'lazy' only after generating interface files
   Ignore-this: 3c762bda546981c4b4f01d28b8586ff8

   This patch fixes an insidious and long-standing bug in the way that
   parallelism is handled in GHC.  See Note [lazyId magic] in MkId.
 ...snip...
   The downside is that a little less optimisation may happen on programs
   that use 'lazy'.  And you'll only see this in the results -ddump-prep
   not in -ddump-simpl.  So KEEP AN EYE OUT (Simon and Satnam especially).
   Still, it should work properly now.  Certainly fixes #3259.

     M ./compiler/basicTypes/MkId.lhs -18 +23
     M ./compiler/coreSyn/CorePrep.lhs -2 +10
     M ./compiler/stranal/WorkWrap.lhs -10 +3
 }}}
 I have not added a test case, because I can't see a simple way to test it.
 But please do see if things improve.

 Do watch out for loss of optimisation as a result.  Simon and I do not
 think it'll be important, but we've been wrong before.

 For example, in your program you have way too many `lazy` calls:
 {{{
 parallelize a b = lazy a `par` (lazy b `pseq` (a, b))
 }}}
 Here the `lazy` calls are completely unnecessary, and indeed they (now)
 make the code a bit less efficient. Instead you can say
 {{{
 parallelize a b = a `par` (b `pseq` (a, b))
 }}}
 Thank you for identifying such an insidious bug.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3259#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to