From: Ben Lippmeier Date: Thu, 5 May 2011 06:08:49 +0000 (+1000) Subject: Update vectoriser now that PRepr has moved X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=31b9ba54b309b7ad8043a7dade7dddb71d184b8b Update vectoriser now that PRepr has moved --- diff --git a/compiler/vectorise/Vectorise/Builtins/Initialise.hs b/compiler/vectorise/Vectorise/Builtins/Initialise.hs index 64172c6..b37f559 100644 --- a/compiler/vectorise/Vectorise/Builtins/Initialise.hs +++ b/compiler/vectorise/Vectorise/Builtins/Initialise.hs @@ -41,21 +41,38 @@ initBuiltins pkg = do mapM_ load dph_Orphans -- From dph-common:Data.Array.Parallel.PArray.PData - -- PData is a type family that maps an element type onto the type - -- we use to hold an array of those elements. + -- PData is a type family that maps an element type onto the type + -- we use to hold an array of those elements. pdataTyCon <- externalTyCon dph_PArray_PData (fsLit "PData") - -- PR is a type class that holds the primitive operators we can - -- apply to array data. Its functions take arrays in terms of PData types. + -- PR is a type class that holds the primitive operators we can + -- apply to array data. Its functions take arrays in terms of PData types. prClass <- externalClass dph_PArray_PData (fsLit "PR") let prTyCon = classTyCon prClass [prDataCon] = tyConDataCons prTyCon + -- From dph-common:Data.Array.Parallel.PArray.PRepr + preprTyCon <- externalTyCon dph_PArray_PRepr (fsLit "PRepr") + paClass <- externalClass dph_PArray_PRepr (fsLit "PA") + let paTyCon = classTyCon paClass + [paDataCon] = tyConDataCons paTyCon + paPRSel = classSCSelId paClass 0 + + replicatePDVar <- externalVar dph_PArray_PRepr (fsLit "replicatePD") + emptyPDVar <- externalVar dph_PArray_PRepr (fsLit "emptyPD") + packByTagPDVar <- externalVar dph_PArray_PRepr (fsLit "packByTagPD") + combines <- mapM (externalVar dph_PArray_PRepr) + [mkFastString ("combine" ++ show i ++ "PD") + | i <- [2..mAX_DPH_COMBINE]] + + let combinePDVars = listArray (2, mAX_DPH_COMBINE) combines + + -- From dph-common:Data.Array.Parallel.PArray.Scalar - -- Scalar is the class of scalar values. - -- The dictionary contains functions to coerce U.Arrays of scalars - -- to and from the PData representation. + -- Scalar is the class of scalar values. + -- The dictionary contains functions to coerce U.Arrays of scalars + -- to and from the PData representation. scalarClass <- externalClass dph_PArray_Scalar (fsLit "Scalar") @@ -65,14 +82,8 @@ initBuiltins pkg parrayTyCon <- externalTyCon dph_PArray (fsLit "PArray") let [parrayDataCon] = tyConDataCons parrayTyCon - paClass <- externalClass dph_PArray (fsLit "PA") - let paTyCon = classTyCon paClass - [paDataCon] = tyConDataCons paTyCon - paPRSel = classSCSelId paClass 0 - preprTyCon <- externalTyCon dph_PArray (fsLit "PRepr") - - closureTyCon <- externalTyCon dph_Closure (fsLit ":->") + closureTyCon <- externalTyCon dph_Closure (fsLit ":->") -- From dph-common:Data.Array.Parallel.Lifted.Repr voidTyCon <- externalTyCon dph_Repr (fsLit "Void") @@ -113,14 +124,6 @@ initBuiltins pkg applyVar <- externalVar dph_Closure (fsLit "$:") liftedClosureVar <- externalVar dph_Closure (fsLit "liftedClosure") liftedApplyVar <- externalVar dph_Closure (fsLit "liftedApply") - replicatePDVar <- externalVar dph_PArray (fsLit "replicatePD") - emptyPDVar <- externalVar dph_PArray (fsLit "emptyPD") - packByTagPDVar <- externalVar dph_PArray (fsLit "packByTagPD") - - combines <- mapM (externalVar dph_PArray) - [mkFastString ("combine" ++ show i ++ "PD") - | i <- [2..mAX_DPH_COMBINE]] - let combinePDVars = listArray (2, mAX_DPH_COMBINE) combines scalar_map <- externalVar dph_Scalar (fsLit "scalar_map") scalar_zip2 <- externalVar dph_Scalar (fsLit "scalar_zipWith") @@ -183,8 +186,9 @@ initBuiltins pkg -- the primitive array types and functions that vectorised code uses. mods@(Modules { dph_PArray = dph_PArray - , dph_PArray_PData = dph_PArray_PData , dph_PArray_Scalar = dph_PArray_Scalar + , dph_PArray_PRepr = dph_PArray_PRepr + , dph_PArray_PData = dph_PArray_PData , dph_Repr = dph_Repr , dph_Closure = dph_Closure , dph_Scalar = dph_Scalar @@ -269,7 +273,7 @@ initBuiltinDataCons _ -- | Get the names of all buildin instance functions for the PA class. initBuiltinPAs :: Builtins -> (InstEnv, InstEnv) -> DsM [(Name, Var)] initBuiltinPAs (Builtins { dphModules = mods }) insts - = liftM (initBuiltinDicts insts) (externalClass (dph_PArray mods) (fsLit "PA")) + = liftM (initBuiltinDicts insts) (externalClass (dph_PArray_PRepr mods) (fsLit "PA")) -- | Get the names of all builtin instance functions for the PR class. diff --git a/compiler/vectorise/Vectorise/Builtins/Modules.hs b/compiler/vectorise/Vectorise/Builtins/Modules.hs index 82e49bf..f562d5c 100644 --- a/compiler/vectorise/Vectorise/Builtins/Modules.hs +++ b/compiler/vectorise/Vectorise/Builtins/Modules.hs @@ -18,8 +18,9 @@ data Modules , dph_Instances :: Module , dph_Combinators :: Module , dph_Scalar :: Module - , dph_PArray_PData :: Module , dph_PArray_Scalar :: Module + , dph_PArray_PRepr :: Module + , dph_PArray_PData :: Module , dph_Prelude_PArr :: Module , dph_Prelude_Int :: Module , dph_Prelude_Word8 :: Module @@ -41,8 +42,9 @@ dph_Modules pkg , dph_Combinators = mk (fsLit "Data.Array.Parallel.Lifted.Combinators") , dph_Scalar = mk (fsLit "Data.Array.Parallel.Lifted.Scalar") - , dph_PArray_PData = mk (fsLit "Data.Array.Parallel.PArray.PData") , dph_PArray_Scalar = mk (fsLit "Data.Array.Parallel.PArray.Scalar") + , dph_PArray_PRepr = mk (fsLit "Data.Array.Parallel.PArray.PRepr") + , dph_PArray_PData = mk (fsLit "Data.Array.Parallel.PArray.PData") , dph_Prelude_PArr = mk (fsLit "Data.Array.Parallel.Prelude.Base.PArr") , dph_Prelude_Int = mk (fsLit "Data.Array.Parallel.Prelude.Base.Int")