module Futhark.Optimise.MemoryBlockMerging.Types
( MName
, MNames
, MemorySrc(..)
, MemoryLoc(..)
, VarMemMappings
, MemAliases
, VarAliases
, FirstUses
, StmOrRes(..)
, LastUses
, Interferences
, ActualVariables
, PotentialKernelDataRaceInterferences
, PotentialKernelDataRaceInterferenceGroup
, KernelFirstUse
)
where
import qualified Data.Map.Strict as M
import Futhark.Representation.AST
import qualified Futhark.Representation.ExplicitMemory as ExpMem
type MName = VName
type MNames = Names
data MemorySrc = MemorySrc
{ memSrcName :: MName
, memSrcIxFun :: ExpMem.IxFun
, memSrcShape :: Shape
}
deriving (Show, Eq)
data MemoryLoc = MemoryLoc
{ memLocName :: MName
, memLocIxFun :: ExpMem.IxFun
}
deriving (Show, Eq)
type VarMemMappings t = M.Map VName t
type MemAliases = M.Map MName MNames
type VarAliases = M.Map VName Names
type FirstUses = M.Map VName MNames
data StmOrRes = FromStm VName
| FromRes VName
deriving (Show, Eq, Ord)
type LastUses = M.Map StmOrRes MNames
type Interferences = M.Map MName MNames
type PotentialKernelDataRaceInterferences =
[PotentialKernelDataRaceInterferenceGroup]
type PotentialKernelDataRaceInterferenceGroup = [KernelFirstUse]
type KernelFirstUse = (MName, VName, PrimType, ExpMem.IxFun)
type ActualVariables = M.Map VName Names
newtype Log = Log (M.Map VName [(String, String)])
deriving (Show, Eq, Ord)
instance Semigroup Log where
Log a <> Log b = Log $ M.unionWith (++) a b
instance Monoid Log where
mempty = Log M.empty