On 14/03/2011, at 7:22 AM, Edward Z. Yang wrote:

> I'm looking at the current failure of DPH with the new code generator,
> which is a bit different from what I've dealt with before.  The bug appears
> to be in the compiled libraries code, and I can tickle it with the
> following minimized example:
> 
>    {-# LANGUAGE ParallelArrays #-}
>    {-# OPTIONS -fvectorise #-}
>    module PrimesVect where
> 
>    import Data.Array.Parallel.Prelude
>    import qualified Prelude
> 
>    f :: PArray Bool
>    f = toPArrayP f'
> 
>    f' :: [:Bool:]
>    f' = [: True | _ <- singletonP True, g emptyP:]
> 
>    g :: [:Bool:] -> Bool
>    g ps = andP [: True | _ <- ps:]
> 
> and a runner:
> 
>    import qualified Data.Array.Parallel.PArray as P
>    import PrimesVect
> 
>    main = print (P.toList f)
> 
> I expect to get [True], but instead I get:
> 
>    dph-primespj-fast: libraries/vector/Data/Vector/Generic.hs:369 (slice): 
> invalid slice (0,1,0)
>    dph-primespj-fast: thread blocked indefinitely in an MVar operation
> 
> Now, in the situation that the library code is broken, I'd usually try to 
> inline
> all of the library code and then pare that down into something manageable.  
> Unfortunately,
> DPH is pretty closely tied to the compiler, so I don't see an easy way to do 
> that.
> So I'm not really sure how to go about debugging this.

That "thread blocked indefinitely" thing happens when the DPH thread gang tries 
to start up a new computation while it's already doing something. "invalid 
slice" hints at either a bug in the DPH library or a problem in the code 
generator. It may be bug in DPH, lack of bounds checks could trash some memory 
that only shows symptoms with the new code generator.

BTW. I've also hit 3 separate LLVM related bugs when working on Repa in the 
last week, though it'll need to be after the ICFP deadline before I chase them 
down. One of them even causes a panic in the LLVM compiler, but it goes away 
with -funfolding-use-threshold100.. joy!

Ben.


_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to