#5840: Extend the supported environment sizes of vectorised closures
------------------------------+---------------------------------------------
 Reporter:  mukesh.tiwari     |          Owner:  chak                 
     Type:  bug               |         Status:  new                  
 Priority:  normal            |      Component:  Data Parallel Haskell
  Version:  7.4.1             |       Keywords:                       
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple     
  Failure:  None/Unknown      |       Testcase:                       
Blockedby:                    |       Blocking:                       
  Related:                    |  
------------------------------+---------------------------------------------
Changes (by chak):

  * owner:  => chak
  * version:  7.2.1 => 7.4.1
  * component:  Compiler => Data Parallel Haskell


Comment:

 In the development version of GHC (and supposedly also in the just
 released GHC 7.4.1), your code works when modified as follows:
 {{{
 bSearch :: ( I.Int , I.Int , D.Double ) -> [: ( I.Int , I.Int , D.Double )
 :] -> I.Int
 bSearch elem@( i , j , val ) ys  = ret where
   ret = helpBsearch 0 (P.lengthP ys)  where
   helpBsearch :: I.Int -> I.Int -> I.Int
   helpBsearch lo hi
    | lo I.>= hi = if lo I.== (P.lengthP ys) then ( lo I.- 1 ) else lo
    | cond  = helpBsearch ( mid I.+ 1 ) hi
    | otherwise = helpBsearch lo mid
          where mid = I.div ( lo I.+ hi ) 2
                ( i' , j' , val' ) = ys P.!: mid
                cond = case () of
                         _| j' I.< j Pre.|| ( j I.== j' Pre.&& i' I.< i )
 -> True
                          | otherwise ->  False

 interfaceSearch ::  ( Int , Int , Double ) -> PArray ( Int , Int , Double
 ) -> Int
 {-# NOINLINE interfaceSearch #-}
 interfaceSearch x ys  =  bSearch  x ( P.fromPArrayP ys )
 }}}

 The new version uses `lengthP` instead of
 `Data.Array.Parallel.PArray.length`. The latter may not be used in
 vectorised code.  Basically only types and functions imported from
 `Data.Array.Parallel` and `Data.Array.Parallel.Prelude.*` may be used in
 vectorised code.

 However, I believe the problem you ran into is a limit on the size of
 vectorised closures in GHC. We need to lift (or, at least, significantly
 increase that limit). Hence, I rename this ticket and leave it open.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5840#comment:2>
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

Reply via email to