Skip to content
This repository

Internal error: "inconsistent valuation @ shared 'Exp' tree with stable name 54" #63

Open
shedoblyde opened this Issue July 16, 2012 · 1 comment

2 participants

Mark Gomer Trevor L. McDonell
Mark Gomer

When attempting to multiply a matrix by a vector on the left with the following code:

(*^) :: (Elt e,IsNum e) => Acc (Array DIM1 e) -> Acc (Array DIM2 e) -> Acc (Array DIM1 e)
(*^) v m = generate (index1 b)
        (\ ix -> let (Z:.cols) = unlift ix :: (Z:.Exp Int)
                  in the $ (.^) v
                   $ takeCol cols m )
    where (Z:.a:.b) = unlift $ shape m :: (Z:.Exp Int:.Exp Int)

(.^) :: (Elt e,IsNum e) => Acc (Array DIM1 e) -> Acc (Array DIM1 e) -> Acc (Scalar e)
(.^) u v = fold1 (+) (zipWith (*) u v)

takeCol :: Elt e => Exp Int -> Acc (Array DIM2 e) -> Acc (Array DIM1 e)
takeCol n xs = let (Z:.rows:.cols) = (unlift $ shape xs :: (Z:.Exp Int:.Exp Int))
                in flatten $ backpermute
                 ( index2 (1::Exp Int) cols)
                 ( \ix -> let (Z:.j:.i) = unlift ix :: (Z:.Exp Int:.Exp Int)
                           in index2 n i )
                   xs

and the following input:

run $ (use v) *^ (use m)

(where (v :: Array (Z:.5) Float) & (m :: Array (Z:.5:.3) Float)),

I get the following error in GHCi:

*** Exception:
*** Internal error in package accelerate ***
*** Please submit a bug report at https://github.com/mchakravarty/accelerate/issues
./Data/Array/Accelerate/Smart.hs:561 (convertSharingExp): inconsistent valuation @ shared 'Exp' tree with stable name 54;
env = [56]

Trevor L. McDonell
Collaborator

This looks to be encoding nested parallelism, as takeCols depends on the index given to it by generate. The error message could probably be better, however; it warns about nested parallelism in other cases.

/ping https://groups.google.com/d/topic/accelerate-haskell/eADGZJLkzbo/discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.