Skip to content

Commit

Permalink
Stub out the optional passes while we mess with the CoreIR/SimpIR.
Browse files Browse the repository at this point in the history
  • Loading branch information
dougalm committed May 15, 2024
1 parent cf06eb5 commit 3853784
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 25 deletions.
16 changes: 8 additions & 8 deletions dex.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ library
, ImpToLLVM
, IncState
, Inference
, Inline
-- , Inline
, IRVariants
, JAX.Concrete
, JAX.Rename
Expand All @@ -64,14 +64,14 @@ library
, LLVM.CUDA
, LLVM.Shims
, Lexing
, Linearize
-- , Linearize
, MonadUtil
, MTL1
, Name
, Occurrence
, OccAnalysis
, Optimize
, PeepholeOptimize
-- , Occurrence
-- , OccAnalysis
-- , Optimize
-- , PeepholeOptimize
, PPrint
, RawName
, Runtime
Expand All @@ -82,7 +82,7 @@ library
, SourceRename
, SourceIdTraversal
, TopLevel
, Transpose
-- , Transpose
, Types.Core
, Types.Imp
, Types.Primitives
Expand All @@ -92,7 +92,7 @@ library
, QueryType
, QueryTypePure
, Util
, Vectorize
-- , Vectorize
, Actor
, Live.Eval
, Live.Web
Expand Down
2 changes: 1 addition & 1 deletion src/lib/AbstractSyntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import Control.Monad (forM, when)
import Data.Functor
import Data.Either
import Data.Maybe (catMaybes)
import Data.Set qualified as S
-- import Data.Set qualified as S
import Data.Text (Text)

import ConcreteSyntax
Expand Down
6 changes: 5 additions & 1 deletion src/lib/Builder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import IRVariants
import MTL1
import Subst
import Name
import PeepholeOptimize
-- import PeepholeOptimize
import PPrint
import QueryType
import Types.Core
Expand All @@ -38,6 +38,10 @@ import Types.Source
import Types.Top
import Util (enumerate, transitiveClosureM, bindM2, toSnocList, popList)

-- temporary stub
peepholeExpr :: a -> a
peepholeExpr = id

-- === Ordinary (local) builder class ===

class (EnvReader m, Fallible1 m, IRRep r)
Expand Down
12 changes: 6 additions & 6 deletions src/lib/Simplify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import Core
import Err
import Generalize
import IRVariants
import Linearize
-- import Linearize
import Name
import Subst
import PPrint
import QueryType
import RuntimePrint
import Transpose
-- import Transpose
import Types.Core
import Types.Top
import Types.Primitives
Expand Down Expand Up @@ -475,10 +475,10 @@ simplifyHof = \case
-- result' <- liftSimpAtom lamResultTy result
-- linFun' <- liftSimpFun linFunTy linFun
-- return $ PairVal result' linFun'
Transpose lam x -> do
lam' <- simplifyLam lam
x' <- toDataAtom x
SimpAtom <$> transpose lam' x'
-- Transpose lam x -> do
-- lam' <- simplifyLam lam
-- x' <- toDataAtom x
-- SimpAtom <$> transpose lam' x'

liftSimpFun :: EnvReader m => Type CoreIR n -> LamExpr SimpIR n -> m n (SimpVal n)
liftSimpFun = undefined -- (TyCon (Pi piTy)) f = mkStuck $ LiftSimpFun piTy f
Expand Down
28 changes: 24 additions & 4 deletions src/lib/TopLevel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ import IRVariants
import Imp
import ImpToLLVM
import Inference
import Inline
-- import Inline
import MonadUtil
import MTL1
import Subst
import Name
import OccAnalysis
import Optimize
-- import OccAnalysis
-- import Optimize
import Paths_dex (getDataFileName)
import QueryType
import Runtime
Expand All @@ -77,7 +77,27 @@ import Types.Primitives
import Types.Source
import Types.Top
import Util ( Tree (..), File (..), readFileWithHash)
import Vectorize
-- import Vectorize


-- temporary stubs
optimize :: EnvReader m => STopLam n -> m n (STopLam n)
optimize x = return x

inlineBindings :: (EnvReader m) => STopLam n -> m n (STopLam n)
inlineBindings x = return x

analyzeOccurrences :: EnvReader m => TopLam SimpIR n -> m n (TopLam SimpIR n)
analyzeOccurrences x = return x

vectorizeLoops :: EnvReader m => a -> STopLam n -> m n (STopLam n, [Err])
vectorizeLoops _ x = return (x, [])

hoistLoopInvariant :: EnvReader m => STopLam n -> m n (STopLam n)
hoistLoopInvariant x = return x

dceTop :: EnvReader m => STopLam n -> m n (STopLam n)
dceTop x = return x

-- === top-level monad ===

Expand Down
10 changes: 5 additions & 5 deletions src/lib/Types/Primitives.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import GHC.Float
import GHC.Generics (Generic (..))

import PPrint
import Occurrence
-- import Occurrence
import Types.OpNames (UnOp (..), BinOp (..), CmpOp (..), Projection (..))
import Name

Expand Down Expand Up @@ -70,11 +70,11 @@ data LetAnn =
| LinearLet
-- Bound expression is pure, and the binding's occurrences are summarized by
-- the UsageInfo
| OccInfoPure UsageInfo
-- | OccInfoPure UsageInfo
-- Bound expression is impure, and the binding's occurrences are summarized by
-- the UsageInfo. For now, the inliner does not distinguish different effects,
-- so no additional information on effects is needed.
| OccInfoImpure UsageInfo
-- | OccInfoImpure UsageInfo
deriving (Show, Eq, Generic)

-- === Primitive scalar values and base types ===
Expand Down Expand Up @@ -233,8 +233,8 @@ instance Pretty LetAnn where
InlineLet -> "%inline"
NoInlineLet -> "%noinline"
LinearLet -> "%linear"
OccInfoPure u -> pretty u <> hardline
OccInfoImpure u -> pretty u <> ", impure" <> hardline
-- OccInfoPure u -> pretty u <> hardline
-- OccInfoImpure u -> pretty u <> ", impure" <> hardline

instance PrettyPrec Direction where
prettyPrec d = atPrec ArgPrec $ case d of
Expand Down

0 comments on commit 3853784

Please sign in to comment.