From 3853784f07d1b7f38a0b31e0bef9445b14ec76b0 Mon Sep 17 00:00:00 2001 From: Dougal Date: Tue, 14 May 2024 22:23:16 -0400 Subject: [PATCH] Stub out the optional passes while we mess with the CoreIR/SimpIR. --- dex.cabal | 16 ++++++++-------- src/lib/AbstractSyntax.hs | 2 +- src/lib/Builder.hs | 6 +++++- src/lib/Simplify.hs | 12 ++++++------ src/lib/TopLevel.hs | 28 ++++++++++++++++++++++++---- src/lib/Types/Primitives.hs | 10 +++++----- 6 files changed, 49 insertions(+), 25 deletions(-) diff --git a/dex.cabal b/dex.cabal index 1b752a1ef..8fa762d71 100644 --- a/dex.cabal +++ b/dex.cabal @@ -54,7 +54,7 @@ library , ImpToLLVM , IncState , Inference - , Inline + -- , Inline , IRVariants , JAX.Concrete , JAX.Rename @@ -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 @@ -82,7 +82,7 @@ library , SourceRename , SourceIdTraversal , TopLevel - , Transpose + -- , Transpose , Types.Core , Types.Imp , Types.Primitives @@ -92,7 +92,7 @@ library , QueryType , QueryTypePure , Util - , Vectorize + -- , Vectorize , Actor , Live.Eval , Live.Web diff --git a/src/lib/AbstractSyntax.hs b/src/lib/AbstractSyntax.hs index 69a812897..7e680f23a 100644 --- a/src/lib/AbstractSyntax.hs +++ b/src/lib/AbstractSyntax.hs @@ -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 diff --git a/src/lib/Builder.hs b/src/lib/Builder.hs index 76d357f55..26b359d7b 100644 --- a/src/lib/Builder.hs +++ b/src/lib/Builder.hs @@ -28,7 +28,7 @@ import IRVariants import MTL1 import Subst import Name -import PeepholeOptimize +-- import PeepholeOptimize import PPrint import QueryType import Types.Core @@ -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) diff --git a/src/lib/Simplify.hs b/src/lib/Simplify.hs index f45d7b487..cc9e9d2f6 100644 --- a/src/lib/Simplify.hs +++ b/src/lib/Simplify.hs @@ -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 @@ -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 diff --git a/src/lib/TopLevel.hs b/src/lib/TopLevel.hs index 4f1877fcc..2b351fdad 100644 --- a/src/lib/TopLevel.hs +++ b/src/lib/TopLevel.hs @@ -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 @@ -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 === diff --git a/src/lib/Types/Primitives.hs b/src/lib/Types/Primitives.hs index bc48cc988..d861ab552 100644 --- a/src/lib/Types/Primitives.hs +++ b/src/lib/Types/Primitives.hs @@ -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 @@ -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 === @@ -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