{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE GADTs      #-}
{-# OPTIONS_HADDOCK hide #-}
-- |
-- Module      : Data.Array.Accelerate.Trafo.LetSplit
-- Copyright   : [2012..2020] The Accelerate Team
-- License     : BSD3
--
-- Maintainer  : Trevor L. McDonell <trevor.mcdonell@gmail.com>
-- Stability   : experimental
-- Portability : non-portable (GHC extensions)
--

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 :: forall aenv f.
PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun (Alam ALeftHandSide a aenv aenv'
lhs PreOpenAfun OpenAcc aenv' t1
f) = ALeftHandSide a aenv aenv'
-> PreOpenAfun OpenAcc aenv' t1
-> PreOpenAfun OpenAcc aenv (a -> t1)
forall a aenv aenv' (acc :: * -> * -> *) t1.
ALeftHandSide a aenv aenv'
-> PreOpenAfun acc aenv' t1 -> PreOpenAfun acc aenv (a -> t1)
Alam ALeftHandSide a aenv aenv'
lhs (PreOpenAfun OpenAcc aenv' t1 -> PreOpenAfun OpenAcc aenv' t1
forall aenv f.
PreOpenAfun OpenAcc aenv f -> PreOpenAfun OpenAcc aenv f
convertAfun PreOpenAfun OpenAcc aenv' t1
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 :: forall aenv a. 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 :: forall aenv a.
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
PreOpenAcc OpenAcc aenv ()
forall (acc :: * -> * -> *) aenv. PreOpenAcc acc aenv ()
Anil
  Atrace Message arrs1
msg OpenAcc aenv arrs1
as OpenAcc aenv a
bs                -> Message arrs1
-> OpenAcc aenv arrs1
-> OpenAcc aenv a
-> PreOpenAcc OpenAcc aenv a
forall arrs1 (acc :: * -> * -> *) aenv a.
Message arrs1
-> acc aenv arrs1 -> acc aenv a -> PreOpenAcc acc aenv a
Atrace Message arrs1
msg (OpenAcc aenv arrs1 -> OpenAcc aenv arrs1
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv arrs1
as) (OpenAcc aenv a -> OpenAcc aenv a
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv a
bs)
  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 a (acc :: * -> * -> *) aenv arrs1.
ArraysR a
-> PreOpenAfun acc aenv (arrs1 -> a)
-> acc aenv arrs1
-> PreOpenAcc acc aenv a
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 :: * -> *) a as (acc :: * -> * -> *) aenv.
Foreign asm =>
ArraysR a
-> asm (as -> a)
-> PreAfun acc (as -> a)
-> acc aenv as
-> PreOpenAcc acc aenv a
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 :: * -> * -> *) a.
Exp aenv PrimBool
-> acc aenv a -> acc aenv a -> PreOpenAcc acc aenv a
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 a.
PreOpenAfun acc aenv (a -> Scalar PrimBool)
-> PreOpenAfun acc aenv (a -> a)
-> acc aenv a
-> PreOpenAcc acc aenv a
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 (Array () e)
forall e aenv (acc :: * -> * -> *).
TypeR e -> Exp aenv e -> PreOpenAcc acc aenv (Array () 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 (a1 -> b)
g OpenAcc aenv (Array sh a1)
a         -> ArrayR (Array sh' b)
-> Exp aenv sh'
-> Fun aenv (sh' -> sh)
-> Fun aenv (a1 -> b)
-> OpenAcc aenv (Array sh a1)
-> PreOpenAcc OpenAcc aenv (Array sh' b)
forall sh' b aenv sh a1 (acc :: * -> * -> *).
ArrayR (Array sh' b)
-> Exp aenv sh'
-> Fun aenv (sh' -> sh)
-> Fun aenv (a1 -> b)
-> acc aenv (Array sh a1)
-> PreOpenAcc acc aenv (Array sh' b)
Transform ArrayR (Array sh' b)
repr Exp aenv sh'
sh Fun aenv (sh' -> sh)
f Fun aenv (a1 -> b)
g (OpenAcc aenv (Array sh a1) -> OpenAcc aenv (Array sh a1)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh a1)
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 :: * -> * -> *) sh.
Fun aenv (e -> e -> e)
-> Maybe (Exp aenv e)
-> acc aenv (Array (sh, Int) e)
-> PreOpenAcc acc aenv (Array sh 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 :: * -> * -> *) sh.
IntegralType i
-> Fun aenv (e -> e -> e)
-> Maybe (Exp aenv e)
-> acc aenv (Array (sh, Int) e)
-> acc aenv (Segments i)
-> PreOpenAcc acc aenv (Array (sh, 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 e' aenv (acc :: * -> * -> *).
StencilR sh e stencil
-> TypeR e'
-> Fun aenv (stencil -> e')
-> Boundary aenv (Array sh e)
-> acc aenv (Array sh e)
-> PreOpenAcc acc aenv (Array sh e')
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 a1 stencil1
s1 StencilR sh b stencil2
s2 TypeR c
tp Fun aenv (stencil1 -> stencil2 -> c)
f Boundary aenv (Array sh a1)
b1 OpenAcc aenv (Array sh a1)
a1 Boundary aenv (Array sh b)
b2 OpenAcc aenv (Array sh b)
a2 -> StencilR sh a1 stencil1
-> StencilR sh b stencil2
-> TypeR c
-> Fun aenv (stencil1 -> stencil2 -> c)
-> Boundary aenv (Array sh a1)
-> OpenAcc aenv (Array sh a1)
-> Boundary aenv (Array sh b)
-> OpenAcc aenv (Array sh b)
-> PreOpenAcc OpenAcc aenv (Array sh c)
forall sh a1 stencil1 b stencil2 c aenv (acc :: * -> * -> *).
StencilR sh a1 stencil1
-> StencilR sh b stencil2
-> TypeR c
-> Fun aenv (stencil1 -> stencil2 -> c)
-> Boundary aenv (Array sh a1)
-> acc aenv (Array sh a1)
-> Boundary aenv (Array sh b)
-> acc aenv (Array sh b)
-> PreOpenAcc acc aenv (Array sh c)
Stencil2 StencilR sh a1 stencil1
s1 StencilR sh b stencil2
s2 TypeR c
tp Fun aenv (stencil1 -> stencil2 -> c)
f Boundary aenv (Array sh a1)
b1 (OpenAcc aenv (Array sh a1) -> OpenAcc aenv (Array sh a1)
forall aenv a. OpenAcc aenv a -> OpenAcc aenv a
convertAcc OpenAcc aenv (Array sh a1)
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 :: forall bnd aenv aenv' a.
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 :: * -> * -> *) a.
ALeftHandSide bndArrs aenv aenv'
-> acc aenv bndArrs -> acc aenv' a -> PreOpenAcc acc aenv a
Alet ALeftHandSide bnd aenv aenv'
lhs OpenAcc aenv bnd
bnd OpenAcc aenv' a
a
    LeftHandSidePair LeftHandSide ArrayR v1 aenv env'1
l1 LeftHandSide ArrayR v2 env'1 aenv'
l2 ->
      case PreOpenAcc OpenAcc aenv bnd
pbnd of
        Apair OpenAcc aenv as
b1 OpenAcc aenv bs
b2 -> LeftHandSide ArrayR v1 aenv env'1
-> OpenAcc aenv v1 -> OpenAcc env'1 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'1
l1 OpenAcc aenv v1
OpenAcc aenv as
b1 (PreOpenAcc OpenAcc env'1 a -> OpenAcc env'1 a
forall aenv t. PreOpenAcc OpenAcc aenv t -> OpenAcc aenv t
OpenAcc (LeftHandSide ArrayR v2 env'1 aenv'
-> OpenAcc env'1 v2
-> OpenAcc aenv' a
-> PreOpenAcc OpenAcc env'1 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'1 aenv'
l2 ((aenv :> env'1) -> forall t. OpenAcc aenv t -> OpenAcc env'1 t
forall env env'.
(env :> env') -> forall t. OpenAcc env t -> OpenAcc env' t
forall (f :: * -> * -> *) env env'.
Sink f =>
(env :> env') -> forall t. f env t -> f env' t
weaken (LeftHandSide ArrayR v1 aenv env'1 -> aenv :> env'1
forall (s :: * -> *) t env env'.
LeftHandSide s t env env' -> env :> env'
weakenWithLHS LeftHandSide ArrayR v1 aenv env'1
l1) OpenAcc aenv v2
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 :: * -> * -> *) a.
ALeftHandSide bndArrs aenv aenv'
-> acc aenv bndArrs -> acc aenv' a -> PreOpenAcc acc aenv a
Alet ALeftHandSide bnd aenv aenv'
lhs OpenAcc aenv bnd
bnd OpenAcc aenv' a
a