Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix a bug to get blsackscholes up

  • Loading branch information...
commit c9f218a3ac0c7a5257576b7d3cdd9b3ecb97cf08 1 parent e290815
@rrnewton rrnewton authored
View
14 backend-kit/Data/Array/Accelerate/BackendKit/IRs/SimpleAcc.hs
@@ -116,7 +116,7 @@ instance Read Var where
instance NFData Var where
rnf (Var s) = rnf s
#else
-#error "Need to define some symbol representation for SimpleAST.hs"
+#error "Need to define some symbol representation for SimpleAcc.hs"
#endif
var :: String -> Var
@@ -365,7 +365,7 @@ data OtherPrim = Ord | Chr | BoolToInt | FromIntegral
primArity :: Prim -> Int
-- Note: this would be safer with a normal case expression, but would be rather long:
primArity p = case M.lookup p mp of
- Nothing -> error$"SimpleAST.hs/primArity: prim was missing from table: "++show p
+ Nothing -> error$"SimpleAcc.hs/primArity: prim was missing from table: "++show p
Just x -> x
where
mp = M.fromList $
@@ -374,7 +374,9 @@ primArity p = case M.lookup p mp of
binaries =
[BP And, BP Or] ++
[NP Add, NP Sub, NP Mul, IP BNot] ++
- map IP [Quot, Rem, IDiv, Mod, BOr, BXor, BShiftL, BShiftR, BRotateL, BRotateR] ++
+-- [ BAnd , BOr | BXor | BNot | BShiftL | BShiftR | BRotateL | BRotateR
+ map IP [Quot, Rem, IDiv, Mod, BShiftL, BShiftR, BRotateL, BRotateR,
+ BOr, BXor, BAnd ] ++
map FP [FDiv, FPow, LogBase, Atan2, Truncate, Round, Floor, Ceiling] ++
map SP [Lt, Gt, LtEq, GtEq, Eq, NEq, Max, Min]
unaries =
@@ -437,7 +439,7 @@ data SliceComponent = Fixed | All
--
-- Note, this is a different presentation of the same data as
-- contained in a "Data.Array.Accelerate.Array". Going with the
--- theme of "SimpleAST", the idea is to provide access in a form
+-- theme of "SimpleAcc", the idea is to provide access in a form
-- that doesn't require complex types. However, while simple in
-- that respect, this representation is also a pain to work with
-- because `ArrayPayload` is a large sum type.
@@ -694,7 +696,7 @@ constToInteger c =
-- instance Integral Const where
-- toInteger x =
--- | Unwrap a SimpleAST `Const` (satisfying isIntConst) into a raw
+-- | Unwrap a SimpleAcc `Const` (satisfying isIntConst) into a raw
-- Haskell number. Note that this function may perform a size
-- conversion IF the type of the Const does not match the destination
-- Haskell type.
@@ -743,7 +745,7 @@ mkZeroConst ty =
}
--- | Unwrap a SimpleAST `Const` (satisfying isNumConst) into a raw
+-- | Unwrap a SimpleAcc `Const` (satisfying isNumConst) into a raw
-- Haskell Rational.
constToRational :: Const -> Rational
constToRational c =
View
10 icc-opencl/Data/Array/Accelerate/Shared/EmitCommon.hs
@@ -43,7 +43,7 @@ import Control.Monad
import Prelude as P
import Text.PrettyPrint.GenericPretty (Out(doc))
import Text.PrettyPrint.HughesPJ as PP ((<>), (<+>), semi, parens)
--- import Debug.Trace (trace)
+import Debug.Trace (trace)
----------------------------------------------------------------------------------------------------
@@ -280,7 +280,9 @@ emitConst e cnst =
-- | Emit a PrimApp provided that the operands have already been convinced to `Syntax`.
-- It returns EasyEmit `Syntax` representing a C expression.
emitPrimApp :: EmitBackend e => e -> Type -> Prim -> [Syntax] -> Syntax
-emitPrimApp e outTy prim args = E.parens$
+emitPrimApp e outTy prim args =
+-- trace ("emitPrimApp: "++ show(outTy, prim, args))$
+ E.parens$
case prim of
NP np -> case np of
Add -> binop "+"
@@ -318,11 +320,11 @@ emitPrimApp e outTy prim args = E.parens$
Asinh -> unary "asinh"
Acosh -> unary "acosh"
Atanh -> unary "atanh"
- ExpFloating -> binop ""
+ ExpFloating -> unary "expf"
Sqrt -> case outTy of
TFloat -> unary "sqrtf"
TDouble -> unary "sqrt"
- Log -> binop "log" -- natural log
+ Log -> unary "log" -- natural log
FDiv -> binop "/"
-- FPow -> binfun "expt"
FPow -> binfun "pow"
Please sign in to comment.
Something went wrong with that request. Please try again.