summaryrefslogtreecommitdiff
path: root/compiler/vectorise/Vectorise
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/vectorise/Vectorise')
-rw-r--r--compiler/vectorise/Vectorise/Env.hs7
-rw-r--r--compiler/vectorise/Vectorise/Exp.hs11
2 files changed, 11 insertions, 7 deletions
diff --git a/compiler/vectorise/Vectorise/Env.hs b/compiler/vectorise/Vectorise/Env.hs
index 345b4ba1c3..efda22a1c5 100644
--- a/compiler/vectorise/Vectorise/Env.hs
+++ b/compiler/vectorise/Vectorise/Env.hs
@@ -30,8 +30,6 @@ import NameSet
import Name
import NameEnv
import FastString
-import TysPrim
---import TysWiredIn
import Data.Maybe
@@ -201,8 +199,9 @@ modVectInfo env mg_ids mg_tyCons vectDecls info
{ vectInfoVar = mk_env ids (global_vars env)
, vectInfoTyCon = mk_env tyCons (global_tycons env)
, vectInfoDataCon = mk_env dataCons (global_datacons env)
- , vectInfoParallelVars = global_parallel_vars env `minusVarSet` vectInfoParallelVars info
- , vectInfoParallelTyCons = global_parallel_tycons env `minusNameSet` vectInfoParallelTyCons info
+ , vectInfoParallelVars = (global_parallel_vars env `minusVarSet` vectInfoParallelVars info)
+ `intersectVarSet` (mkVarSet ids)
+ , vectInfoParallelTyCons = global_parallel_tycons env `minusNameSet` vectInfoParallelTyCons info
}
where
vectIds = [id | Vect id _ <- vectDecls] ++
diff --git a/compiler/vectorise/Vectorise/Exp.hs b/compiler/vectorise/Vectorise/Exp.hs
index 6ce1b9b025..dd81e32a67 100644
--- a/compiler/vectorise/Vectorise/Exp.hs
+++ b/compiler/vectorise/Vectorise/Exp.hs
@@ -159,10 +159,10 @@ vectAnnPolyExpr loop_breaker expr
-- every expression that is not constant and contains at least one operation.
--
encapsulateScalars :: CoreExprWithVectInfo -> VM CoreExprWithVectInfo
-encapsulateScalars ce@(_, AnnType _ty)
+encapsulateScalars ce@(_, AnnType _ty)
= return ce
encapsulateScalars ce@((_, VISimple), AnnVar v)
- | isFunTy . varType $ v -- NB: diverts from the paper: encapsulate scalar function types
+ -- NB: diverts from the paper: encapsulate variables with scalar type (includes functions)
= liftSimpleAndCase ce
encapsulateScalars ce@(_, AnnVar _v)
= return ce
@@ -302,6 +302,10 @@ vectExpr aexpr
-- encapsulated expression of functional type => try to vectorise as a scalar subcomputation
| (isFunTy . annExprType $ aexpr) && isVIEncaps aexpr
= vectFnExpr True False aexpr
+ -- encapsulated constant => vectorise as a scalar constant
+ | isVIEncaps aexpr
+ = traceVt "vectExpr (encapsulated constant):" (ppr . deAnnotate $ aexpr) >>
+ vectConst (deAnnotate aexpr)
vectExpr (_, AnnVar v)
= vectVar v
@@ -310,7 +314,8 @@ vectExpr (_, AnnLit lit)
= vectConst $ Lit lit
vectExpr aexpr@(_, AnnLam _ _)
- = traceVt "vectExpr [AnnLam]:" (ppr . deAnnotate $ aexpr) >> vectFnExpr True False aexpr
+ = traceVt "vectExpr [AnnLam]:" (ppr . deAnnotate $ aexpr) >>
+ vectFnExpr True False aexpr
-- SPECIAL CASE: Vectorise/lift 'patError @ ty err' by only vectorising/lifting the type 'ty';
-- its only purpose is to abort the program, but we need to adjust the type to keep CoreLint