{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE GADTs #-}
module Data.Array.Accelerate.Trafo.LetSplit (
convertAfun,
convertAcc,
) where
import Prelude hiding ( exp )
import Data.Array.Accelerate.AST
import Data.Array.Accelerate.AST.LeftHandSide
import Data.Array.Accelerate.AST.Environment
import Data.Array.Accelerate.Trafo.Substitution
convertAfun :: PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun :: PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun (Alam ALeftHandSide a aenv aenv'
lhs PreOpenAfun OpenAcc aenv' t
f) = ALeftHandSide a aenv aenv'
-> PreOpenAfun OpenAcc aenv' t -> PreOpenAfun OpenAcc aenv (a -> t)
forall a aenv aenv' (acc :: * -> * -> *) t.
ALeftHandSide a aenv aenv'
-> PreOpenAfun acc aenv' t -> PreOpenAfun acc aenv (a -> t)
Alam ALeftHandSide a aenv aenv'
lhs (PreOpenAfun OpenAcc aenv' t -> PreOpenAfun OpenAcc aenv' t
forall aenv f.
PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun PreOpenAfun OpenAcc aenv' t
f)
convertAfun (Abody OpenAcc aenv f
a) = OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
forall (acc :: * -> * -> *) aenv t.
acc aenv t -> PreOpenAfun acc aenv t
Abody (OpenAcc aenv f -> OpenAcc aenv f
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv f
a)
convertAcc :: OpenAcc aenv a -> OpenAcc aenv a
convertAcc :: OpenAcc aenv a -> OpenAcc aenv a
convertAcc (OpenAcc PreOpenAcc OpenAcc aenv a
pacc) = PreOpenAcc OpenAcc aenv a -> OpenAcc aenv a
forall aenv t. PreOpenAcc OpenAcc aenv t -> OpenAcc aenv t
OpenAcc (PreOpenAcc OpenAcc aenv a -> PreOpenAcc OpenAcc aenv a
forall aenv a.
PreOpenAcc OpenAcc aenv a -> PreOpenAcc OpenAcc aenv a
convertPreOpenAcc PreOpenAcc OpenAcc aenv a
pacc)
convertPreOpenAcc :: PreOpenAcc OpenAcc aenv a -> PreOpenAcc OpenAcc aenv a
convertPreOpenAcc :: PreOpenAcc OpenAcc aenv a -> PreOpenAcc OpenAcc aenv a
convertPreOpenAcc = \case
Alet ALeftHandSide bndArrs aenv aenv'
lhs OpenAcc aenv bndArrs
bnd OpenAcc aenv' a
body -> ALeftHandSide bndArrs aenv aenv'
-> OpenAcc aenv bndArrs
-> OpenAcc aenv' a
-> PreOpenAcc OpenAcc aenv a
forall bnd aenv aenv' a.
ALeftHandSide bnd aenv aenv'
-> OpenAcc aenv bnd -> OpenAcc aenv' a -> PreOpenAcc OpenAcc aenv a
convertLHS ALeftHandSide bndArrs aenv aenv'
lhs (OpenAcc aenv bndArrs -> OpenAcc aenv bndArrs
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv bndArrs
bnd) (OpenAcc aenv' a -> OpenAcc aenv' a
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv' a
body)
Avar ArrayVar aenv (Array sh e)
var -> ArrayVar aenv (Array sh e) -> PreOpenAcc OpenAcc aenv (Array sh e)
forall aenv sh e (acc :: * -> * -> *).
ArrayVar aenv (Array sh e) -> PreOpenAcc acc aenv (Array sh e)
Avar ArrayVar aenv (Array sh e)
var
Apair OpenAcc aenv as
a1 OpenAcc aenv bs
a2 -> OpenAcc aenv as
-> OpenAcc aenv bs -> PreOpenAcc OpenAcc aenv (as, bs)
forall (acc :: * -> * -> *) aenv as bs.
acc aenv as -> acc aenv bs -> PreOpenAcc acc aenv (as, bs)
Apair (OpenAcc aenv as -> OpenAcc aenv as
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv as
a1) (OpenAcc aenv bs -> OpenAcc aenv bs
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv bs
a2)
PreOpenAcc OpenAcc aenv a
Anil -> PreOpenAcc OpenAcc aenv a
forall (acc :: * -> * -> *) aenv. PreOpenAcc acc aenv ()
Anil
Apply ArraysR a
repr PreOpenAfun OpenAcc aenv (arrs1 -> a)
f OpenAcc aenv arrs1
a -> ArraysR a
-> PreOpenAfun OpenAcc aenv (arrs1 -> a)
-> OpenAcc aenv arrs1
-> PreOpenAcc OpenAcc aenv a
forall arrs2 (acc :: * -> * -> *) aenv arrs1.
ArraysR arrs2
-> PreOpenAfun acc aenv (arrs1 -> arrs2)
-> acc aenv arrs1
-> PreOpenAcc acc aenv arrs2
Apply ArraysR a
repr (PreOpenAfun OpenAcc aenv (arrs1 -> a)
-> PreOpenAfun OpenAcc aenv (arrs1 -> a)
forall aenv f.
PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun PreOpenAfun OpenAcc aenv (arrs1 -> a)
f) (OpenAcc aenv arrs1 -> OpenAcc aenv arrs1
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv arrs1
a)
Aforeign ArraysR a
repr asm (as -> a)
asm PreAfun OpenAcc (as -> a)
f OpenAcc aenv as
a -> ArraysR a
-> asm (as -> a)
-> PreAfun OpenAcc (as -> a)
-> OpenAcc aenv as
-> PreOpenAcc OpenAcc aenv a
forall (asm :: * -> *) bs as (acc :: * -> * -> *) aenv.
Foreign asm =>
ArraysR bs
-> asm (as -> bs)
-> PreAfun acc (as -> bs)
-> acc aenv as
-> PreOpenAcc acc aenv bs
Aforeign ArraysR a
repr asm (as -> a)
asm (PreAfun OpenAcc (as -> a) -> PreAfun OpenAcc (as -> a)
forall aenv f.
PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun PreAfun OpenAcc (as -> a)
f) (OpenAcc aenv as -> OpenAcc aenv as
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv as
a)
Acond Exp aenv PrimBool
e OpenAcc aenv a
a1 OpenAcc aenv a
a2 -> Exp aenv PrimBool
-> OpenAcc aenv a -> OpenAcc aenv a -> PreOpenAcc OpenAcc aenv a
forall aenv (acc :: * -> * -> *) arrs.
Exp aenv PrimBool
-> acc aenv arrs -> acc aenv arrs -> PreOpenAcc acc aenv arrs
Acond Exp aenv PrimBool
e (OpenAcc aenv a -> OpenAcc aenv a
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv a
a1) (OpenAcc aenv a -> OpenAcc aenv a
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv a
a2)
Awhile PreOpenAfun OpenAcc aenv (a -> Scalar PrimBool)
c PreOpenAfun OpenAcc aenv (a -> a)
f OpenAcc aenv a
a -> PreOpenAfun OpenAcc aenv (a -> Scalar PrimBool)
-> PreOpenAfun OpenAcc aenv (a -> a)
-> OpenAcc aenv a
-> PreOpenAcc OpenAcc aenv a
forall (acc :: * -> * -> *) aenv arrs.
PreOpenAfun acc aenv (arrs -> Scalar PrimBool)
-> PreOpenAfun acc aenv (arrs -> arrs)
-> acc aenv arrs
-> PreOpenAcc acc aenv arrs
Awhile (PreOpenAfun OpenAcc aenv (a -> Scalar PrimBool)
-> PreOpenAfun OpenAcc aenv (a -> Scalar PrimBool)
forall aenv f.
PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun PreOpenAfun OpenAcc aenv (a -> Scalar PrimBool)
c) (PreOpenAfun OpenAcc aenv (a -> a)
-> PreOpenAfun OpenAcc aenv (a -> a)
forall aenv f.
PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun PreOpenAfun OpenAcc aenv (a -> a)
f) (OpenAcc aenv a -> OpenAcc aenv a
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv a
a)
Use ArrayR (Array sh e)
repr Array sh e
arr -> ArrayR (Array sh e)
-> Array sh e -> PreOpenAcc OpenAcc aenv (Array sh e)
forall sh e (acc :: * -> * -> *) aenv.
ArrayR (Array sh e)
-> Array sh e -> PreOpenAcc acc aenv (Array sh e)
Use ArrayR (Array sh e)
repr Array sh e
arr
Unit TypeR e
tp Exp aenv e
e -> TypeR e -> Exp aenv e -> PreOpenAcc OpenAcc aenv (Scalar e)
forall e aenv (acc :: * -> * -> *).
TypeR e -> Exp aenv e -> PreOpenAcc acc aenv (Scalar e)
Unit TypeR e
tp Exp aenv e
e
Reshape ShapeR sh
shr Exp aenv sh
e OpenAcc aenv (Array sh' e)
a -> ShapeR sh
-> Exp aenv sh
-> OpenAcc aenv (Array sh' e)
-> PreOpenAcc OpenAcc aenv (Array sh e)
forall sh aenv (acc :: * -> * -> *) sh' e.
ShapeR sh
-> Exp aenv sh
-> acc aenv (Array sh' e)
-> PreOpenAcc acc aenv (Array sh e)
Reshape ShapeR sh
shr Exp aenv sh
e OpenAcc aenv (Array sh' e)
a
Generate ArrayR (Array sh e)
repr Exp aenv sh
e Fun aenv (sh -> e)
f -> ArrayR (Array sh e)
-> Exp aenv sh
-> Fun aenv (sh -> e)
-> PreOpenAcc OpenAcc aenv (Array sh e)
forall sh e aenv (acc :: * -> * -> *).
ArrayR (Array sh e)
-> Exp aenv sh
-> Fun aenv (sh -> e)
-> PreOpenAcc acc aenv (Array sh e)
Generate ArrayR (Array sh e)
repr Exp aenv sh
e Fun aenv (sh -> e)
f
Transform ArrayR (Array sh' b)
repr Exp aenv sh'
sh Fun aenv (sh' -> sh)
f Fun aenv (a -> b)
g OpenAcc aenv (Array sh a)
a -> ArrayR (Array sh' b)
-> Exp aenv sh'
-> Fun aenv (sh' -> sh)
-> Fun aenv (a -> b)
-> OpenAcc aenv (Array sh a)
-> PreOpenAcc OpenAcc aenv (Array sh' b)
forall sh' b aenv sh a (acc :: * -> * -> *).
ArrayR (Array sh' b)
-> Exp aenv sh'
-> Fun aenv (sh' -> sh)
-> Fun aenv (a -> b)
-> acc aenv (Array sh a)
-> PreOpenAcc acc aenv (Array sh' b)
Transform ArrayR (Array sh' b)
repr Exp aenv sh'
sh Fun aenv (sh' -> sh)
f Fun aenv (a -> b)
g (OpenAcc aenv (Array sh a) -> OpenAcc aenv (Array sh a)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh a)
a)
Replicate SliceIndex slix sl co sh
slix Exp aenv slix
sl OpenAcc aenv (Array sl e)
a -> SliceIndex slix sl co sh
-> Exp aenv slix
-> OpenAcc aenv (Array sl e)
-> PreOpenAcc OpenAcc aenv (Array sh e)
forall slix sl co sh aenv (acc :: * -> * -> *) e.
SliceIndex slix sl co sh
-> Exp aenv slix
-> acc aenv (Array sl e)
-> PreOpenAcc acc aenv (Array sh e)
Replicate SliceIndex slix sl co sh
slix Exp aenv slix
sl (OpenAcc aenv (Array sl e) -> OpenAcc aenv (Array sl e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sl e)
a)
Slice SliceIndex slix sl co sh
slix OpenAcc aenv (Array sh e)
a Exp aenv slix
sl -> SliceIndex slix sl co sh
-> OpenAcc aenv (Array sh e)
-> Exp aenv slix
-> PreOpenAcc OpenAcc aenv (Array sl e)
forall slix sl co sh (acc :: * -> * -> *) aenv e.
SliceIndex slix sl co sh
-> acc aenv (Array sh e)
-> Exp aenv slix
-> PreOpenAcc acc aenv (Array sl e)
Slice SliceIndex slix sl co sh
slix (OpenAcc aenv (Array sh e) -> OpenAcc aenv (Array sh e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh e)
a) Exp aenv slix
sl
Map TypeR e'
tp Fun aenv (e -> e')
f OpenAcc aenv (Array sh e)
a -> TypeR e'
-> Fun aenv (e -> e')
-> OpenAcc aenv (Array sh e)
-> PreOpenAcc OpenAcc aenv (Array sh e')
forall e' aenv e (acc :: * -> * -> *) sh.
TypeR e'
-> Fun aenv (e -> e')
-> acc aenv (Array sh e)
-> PreOpenAcc acc aenv (Array sh e')
Map TypeR e'
tp Fun aenv (e -> e')
f (OpenAcc aenv (Array sh e) -> OpenAcc aenv (Array sh e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh e)
a)
ZipWith TypeR e3
tp Fun aenv (e1 -> e2 -> e3)
f OpenAcc aenv (Array sh e1)
a1 OpenAcc aenv (Array sh e2)
a2 -> TypeR e3
-> Fun aenv (e1 -> e2 -> e3)
-> OpenAcc aenv (Array sh e1)
-> OpenAcc aenv (Array sh e2)
-> PreOpenAcc OpenAcc aenv (Array sh e3)
forall e3 aenv e1 e2 (acc :: * -> * -> *) sh.
TypeR e3
-> Fun aenv (e1 -> e2 -> e3)
-> acc aenv (Array sh e1)
-> acc aenv (Array sh e2)
-> PreOpenAcc acc aenv (Array sh e3)
ZipWith TypeR e3
tp Fun aenv (e1 -> e2 -> e3)
f (OpenAcc aenv (Array sh e1) -> OpenAcc aenv (Array sh e1)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh e1)
a1) (OpenAcc aenv (Array sh e2) -> OpenAcc aenv (Array sh e2)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh e2)
a2)
Fold Fun aenv (e -> e -> e)
f Maybe (Exp aenv e)
e OpenAcc aenv (Array (sh, Int) e)
a -> Fun aenv (e -> e -> e)
-> Maybe (Exp aenv e)
-> OpenAcc aenv (Array (sh, Int) e)
-> PreOpenAcc OpenAcc aenv (Array sh e)
forall aenv e (acc :: * -> * -> *) i.
Fun aenv (e -> e -> e)
-> Maybe (Exp aenv e)
-> acc aenv (Array (i, Int) e)
-> PreOpenAcc acc aenv (Array i e)
Fold Fun aenv (e -> e -> e)
f Maybe (Exp aenv e)
e (OpenAcc aenv (Array (sh, Int) e)
-> OpenAcc aenv (Array (sh, Int) e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array (sh, Int) e)
a)
FoldSeg IntegralType i
i Fun aenv (e -> e -> e)
f Maybe (Exp aenv e)
e OpenAcc aenv (Array (sh, Int) e)
a OpenAcc aenv (Segments i)
s -> IntegralType i
-> Fun aenv (e -> e -> e)
-> Maybe (Exp aenv e)
-> OpenAcc aenv (Array (sh, Int) e)
-> OpenAcc aenv (Segments i)
-> PreOpenAcc OpenAcc aenv (Array (sh, Int) e)
forall i aenv e (acc :: * -> * -> *) e.
IntegralType i
-> Fun aenv (e -> e -> e)
-> Maybe (Exp aenv e)
-> acc aenv (Array (e, Int) e)
-> acc aenv (Segments i)
-> PreOpenAcc acc aenv (Array (e, Int) e)
FoldSeg IntegralType i
i Fun aenv (e -> e -> e)
f Maybe (Exp aenv e)
e (OpenAcc aenv (Array (sh, Int) e)
-> OpenAcc aenv (Array (sh, Int) e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array (sh, Int) e)
a) (OpenAcc aenv (Segments i) -> OpenAcc aenv (Segments i)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Segments i)
s)
Scan Direction
d Fun aenv (e -> e -> e)
f Maybe (Exp aenv e)
e OpenAcc aenv (Array (sh, Int) e)
a -> Direction
-> Fun aenv (e -> e -> e)
-> Maybe (Exp aenv e)
-> OpenAcc aenv (Array (sh, Int) e)
-> PreOpenAcc OpenAcc aenv (Array (sh, Int) e)
forall aenv e (acc :: * -> * -> *) sh.
Direction
-> Fun aenv (e -> e -> e)
-> Maybe (Exp aenv e)
-> acc aenv (Array (sh, Int) e)
-> PreOpenAcc acc aenv (Array (sh, Int) e)
Scan Direction
d Fun aenv (e -> e -> e)
f Maybe (Exp aenv e)
e (OpenAcc aenv (Array (sh, Int) e)
-> OpenAcc aenv (Array (sh, Int) e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array (sh, Int) e)
a)
Scan' Direction
d Fun aenv (e -> e -> e)
f Exp aenv e
e OpenAcc aenv (Array (sh, Int) e)
a -> Direction
-> Fun aenv (e -> e -> e)
-> Exp aenv e
-> OpenAcc aenv (Array (sh, Int) e)
-> PreOpenAcc OpenAcc aenv (Array (sh, Int) e, Array sh e)
forall aenv e (acc :: * -> * -> *) sh.
Direction
-> Fun aenv (e -> e -> e)
-> Exp aenv e
-> acc aenv (Array (sh, Int) e)
-> PreOpenAcc acc aenv (Array (sh, Int) e, Array sh e)
Scan' Direction
d Fun aenv (e -> e -> e)
f Exp aenv e
e (OpenAcc aenv (Array (sh, Int) e)
-> OpenAcc aenv (Array (sh, Int) e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array (sh, Int) e)
a)
Permute Fun aenv (e -> e -> e)
f OpenAcc aenv (Array sh' e)
a1 Fun aenv (sh -> PrimMaybe sh')
g OpenAcc aenv (Array sh e)
a2 -> Fun aenv (e -> e -> e)
-> OpenAcc aenv (Array sh' e)
-> Fun aenv (sh -> PrimMaybe sh')
-> OpenAcc aenv (Array sh e)
-> PreOpenAcc OpenAcc aenv (Array sh' e)
forall aenv e (acc :: * -> * -> *) sh' sh.
Fun aenv (e -> e -> e)
-> acc aenv (Array sh' e)
-> Fun aenv (sh -> PrimMaybe sh')
-> acc aenv (Array sh e)
-> PreOpenAcc acc aenv (Array sh' e)
Permute Fun aenv (e -> e -> e)
f (OpenAcc aenv (Array sh' e) -> OpenAcc aenv (Array sh' e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh' e)
a1) Fun aenv (sh -> PrimMaybe sh')
g (OpenAcc aenv (Array sh e) -> OpenAcc aenv (Array sh e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh e)
a2)
Backpermute ShapeR sh'
shr Exp aenv sh'
sh Fun aenv (sh' -> sh)
f OpenAcc aenv (Array sh e)
a -> ShapeR sh'
-> Exp aenv sh'
-> Fun aenv (sh' -> sh)
-> OpenAcc aenv (Array sh e)
-> PreOpenAcc OpenAcc aenv (Array sh' e)
forall sh' aenv sh (acc :: * -> * -> *) e.
ShapeR sh'
-> Exp aenv sh'
-> Fun aenv (sh' -> sh)
-> acc aenv (Array sh e)
-> PreOpenAcc acc aenv (Array sh' e)
Backpermute ShapeR sh'
shr Exp aenv sh'
sh Fun aenv (sh' -> sh)
f (OpenAcc aenv (Array sh e) -> OpenAcc aenv (Array sh e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh e)
a)
Stencil StencilR sh e stencil
s TypeR e'
tp Fun aenv (stencil -> e')
f Boundary aenv (Array sh e)
b OpenAcc aenv (Array sh e)
a -> StencilR sh e stencil
-> TypeR e'
-> Fun aenv (stencil -> e')
-> Boundary aenv (Array sh e)
-> OpenAcc aenv (Array sh e)
-> PreOpenAcc OpenAcc aenv (Array sh e')
forall sh e stencil sh aenv (acc :: * -> * -> *).
StencilR sh e stencil
-> TypeR sh
-> Fun aenv (stencil -> sh)
-> Boundary aenv (Array sh e)
-> acc aenv (Array sh e)
-> PreOpenAcc acc aenv (Array sh sh)
Stencil StencilR sh e stencil
s TypeR e'
tp Fun aenv (stencil -> e')
f Boundary aenv (Array sh e)
b (OpenAcc aenv (Array sh e) -> OpenAcc aenv (Array sh e)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh e)
a)
Stencil2 StencilR sh a stencil1
s1 StencilR sh b stencil2
s2 TypeR c
tp Fun aenv (stencil1 -> stencil2 -> c)
f Boundary aenv (Array sh a)
b1 OpenAcc aenv (Array sh a)
a1 Boundary aenv (Array sh b)
b2 OpenAcc aenv (Array sh b)
a2 -> StencilR sh a stencil1
-> StencilR sh b stencil2
-> TypeR c
-> Fun aenv (stencil1 -> stencil2 -> c)
-> Boundary aenv (Array sh a)
-> OpenAcc aenv (Array sh a)
-> Boundary aenv (Array sh b)
-> OpenAcc aenv (Array sh b)
-> PreOpenAcc OpenAcc aenv (Array sh c)
forall sh a stencil1 b stencil2 c aenv (acc :: * -> * -> *).
StencilR sh a stencil1
-> StencilR sh b stencil2
-> TypeR c
-> Fun aenv (stencil1 -> stencil2 -> c)
-> Boundary aenv (Array sh a)
-> acc aenv (Array sh a)
-> Boundary aenv (Array sh b)
-> acc aenv (Array sh b)
-> PreOpenAcc acc aenv (Array sh c)
Stencil2 StencilR sh a stencil1
s1 StencilR sh b stencil2
s2 TypeR c
tp Fun aenv (stencil1 -> stencil2 -> c)
f Boundary aenv (Array sh a)
b1 (OpenAcc aenv (Array sh a) -> OpenAcc aenv (Array sh a)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh a)
a1) Boundary aenv (Array sh b)
b2 (OpenAcc aenv (Array sh b) -> OpenAcc aenv (Array sh b)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh b)
a2)
convertLHS
:: ALeftHandSide bnd aenv aenv'
-> OpenAcc aenv bnd
-> OpenAcc aenv' a
-> PreOpenAcc OpenAcc aenv a
convertLHS :: ALeftHandSide bnd aenv aenv'
-> OpenAcc aenv bnd -> OpenAcc aenv' a -> PreOpenAcc OpenAcc aenv a
convertLHS ALeftHandSide bnd aenv aenv'
lhs bnd :: OpenAcc aenv bnd
bnd@(OpenAcc PreOpenAcc OpenAcc aenv bnd
pbnd) a :: OpenAcc aenv' a
a@(OpenAcc PreOpenAcc OpenAcc aenv' a
pa) =
case ALeftHandSide bnd aenv aenv'
lhs of
LeftHandSideWildcard{} -> PreOpenAcc OpenAcc aenv a
PreOpenAcc OpenAcc aenv' a
pa
LeftHandSideSingle{} -> ALeftHandSide bnd aenv aenv'
-> OpenAcc aenv bnd -> OpenAcc aenv' a -> PreOpenAcc OpenAcc aenv a
forall bndArrs aenv aenv' (acc :: * -> * -> *) bodyArrs.
ALeftHandSide bndArrs aenv aenv'
-> acc aenv bndArrs
-> acc aenv' bodyArrs
-> PreOpenAcc acc aenv bodyArrs
Alet ALeftHandSide bnd aenv aenv'
lhs OpenAcc aenv bnd
bnd OpenAcc aenv' a
a
LeftHandSidePair LeftHandSide ArrayR v1 aenv env'
l1 LeftHandSide ArrayR v2 env' aenv'
l2 ->
case PreOpenAcc OpenAcc aenv bnd
pbnd of
Apair OpenAcc aenv as
b1 OpenAcc aenv bs
b2 -> LeftHandSide ArrayR v1 aenv env'
-> OpenAcc aenv v1 -> OpenAcc env' a -> PreOpenAcc OpenAcc aenv a
forall bnd aenv aenv' a.
ALeftHandSide bnd aenv aenv'
-> OpenAcc aenv bnd -> OpenAcc aenv' a -> PreOpenAcc OpenAcc aenv a
convertLHS LeftHandSide ArrayR v1 aenv env'
l1 OpenAcc aenv v1
OpenAcc aenv as
b1 (PreOpenAcc OpenAcc env' a -> OpenAcc env' a
forall aenv t. PreOpenAcc OpenAcc aenv t -> OpenAcc aenv t
OpenAcc (LeftHandSide ArrayR v2 env' aenv'
-> OpenAcc env' v2 -> OpenAcc aenv' a -> PreOpenAcc OpenAcc env' a
forall bnd aenv aenv' a.
ALeftHandSide bnd aenv aenv'
-> OpenAcc aenv bnd -> OpenAcc aenv' a -> PreOpenAcc OpenAcc aenv a
convertLHS LeftHandSide ArrayR v2 env' aenv'
l2 ((aenv :> env') -> OpenAcc aenv bs -> OpenAcc env' bs
forall (f :: * -> * -> *) env env' t.
Sink f =>
(env :> env') -> f env t -> f env' t
weaken (LeftHandSide ArrayR v1 aenv env' -> aenv :> env'
forall (s :: * -> *) t env env'.
LeftHandSide s t env env' -> env :> env'
weakenWithLHS LeftHandSide ArrayR v1 aenv env'
l1) OpenAcc aenv bs
b2) OpenAcc aenv' a
a))
PreOpenAcc OpenAcc aenv bnd
_ -> ALeftHandSide bnd aenv aenv'
-> OpenAcc aenv bnd -> OpenAcc aenv' a -> PreOpenAcc OpenAcc aenv a
forall bndArrs aenv aenv' (acc :: * -> * -> *) bodyArrs.
ALeftHandSide bndArrs aenv aenv'
-> acc aenv bndArrs
-> acc aenv' bodyArrs
-> PreOpenAcc acc aenv bodyArrs
Alet ALeftHandSide bnd aenv aenv'
lhs OpenAcc aenv bnd
bnd OpenAcc aenv' a
a