ad
ad copied to clipboard
AD with Accelerate types
It would be nice to be able to use AD with Accelerate types (like Exp Double
or Exp (Complex Double)
)
I think the big issues are:
- A lot of typeclass methods on accelerate types result in bottoms. e.g.
instance P.Eq (Exp a) where
(==) = preludeError "Eq.==" "(==)"
(/=) = preludeError "Eq./=" "(/=)"
instance Ord a => P.Ord (Exp a) where
compare = error "Prelude.Ord.compare applied to EDSL types"
(<) = preludeError "Ord.<" "(<)"
(<=) = preludeError "Ord.<=" "(<=)"
(>) = preludeError "Ord.>" "(>)"
(>=) = preludeError "Ord.>=" "(>=)"
min = min
max = max
instance P.Enum (Exp a) where
toEnum = preludeError "toEnum"
fromEnum = preludeError "fromEnum"
instance (Num a, Ord a) => P.Real (Exp a) where
toRational = P.error "Prelude.toRational not supported for Accelerate types"
- Accelerate appears to be very slow at compiling code with recursive functions. It seems better to iterate with
Data.Array.Accelerate.while
orData.Array.Accelerate.iterate
.