Permalink
Browse files

Merge branch 'master' of git@github.com:nushio3/Paraiso

  • Loading branch information...
2 parents 4068a4a + f1b853e commit 52635e7ce9408b606a4212863f0eaafbda51e9c7 @nushio3 committed Feb 12, 2012
Showing with 94 additions and 83 deletions.
  1. +4 −3 Language/Paraiso/Annotation.hs
  2. +2 −1 Language/Paraiso/Annotation/Allocation.hs
  3. +2 −1 Language/Paraiso/Annotation/Balloon.hs
  4. +1 −1 Language/Paraiso/Annotation/Boundary.hs
  5. +1 −1 Language/Paraiso/Annotation/Comment.hs
  6. +1 −1 Language/Paraiso/Annotation/Dependency.hs
  7. +1 −1 Language/Paraiso/Annotation/Execution.hs
  8. +1 −1 Language/Paraiso/Annotation/SyncThreads.hs
  9. +3 −1 Language/Paraiso/Generator.hs
  10. +2 −1 Language/Paraiso/Generator/Claris.hs
  11. +4 −2 Language/Paraiso/Generator/ClarisTrans.hs
  12. +2 −2 Language/Paraiso/Generator/Cpp-old.hs
  13. +1 −1 Language/Paraiso/Generator/Cpp.hs
  14. +1 −1 Language/Paraiso/Generator/Native.hs
  15. +2 −2 Language/Paraiso/Generator/OMTrans.hs
  16. +3 −1 Language/Paraiso/Generator/Plan.hs
  17. +12 −10 Language/Paraiso/Generator/PlanTrans.hs
  18. +1 −1 Language/Paraiso/Interval.hs
  19. +1 −1 Language/Paraiso/OM.hs
  20. +1 −1 Language/Paraiso/OM/Arithmetic.hs
  21. +1 −1 Language/Paraiso/OM/Builder.hs
  22. +1 −1 Language/Paraiso/OM/Builder/Boolean.hs
  23. +2 −1 Language/Paraiso/OM/Builder/Internal.hs
  24. +2 −1 Language/Paraiso/OM/PrettyPrint.hs
  25. +1 −1 Language/Paraiso/OM/Realm.hs
  26. +2 −2 Language/Paraiso/Optimization.hs
  27. +3 −2 Language/Paraiso/Optimization/BoundaryAnalysis.hs
  28. +3 −1 Language/Paraiso/Optimization/DeadCodeElimination.hs
  29. +1 −2 Language/Paraiso/Optimization/DecideAllocation.hs
  30. +1 −2 Language/Paraiso/Optimization/DependencyAnalysis.hs
  31. +2 −3 Language/Paraiso/Optimization/Graph.hs
  32. +1 −1 Language/Paraiso/Optimization/Identity.hs
  33. +1 −1 Language/Paraiso/Orthotope.hs
  34. +1 −1 Language/Paraiso/PiSystem.hs
  35. +6 −14 Language/Paraiso/Prelude.hs
  36. +13 −12 Language/Paraiso/Tuning/Genetic.hs
  37. +2 −3 Paraiso.cabal
  38. +5 −0 include/numeric-prelude-restricted.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE CPP #-}
{-# OPTIONS -Wall #-}
-- | 'Annotation' is a collection of 'Typeable's
-- with which you can annotate each OM node.
@@ -8,10 +8,11 @@ module Language.Paraiso.Annotation
Annotation, add, empty, map, set, weakSet, toList, toMaybe
) where
+import Control.Monad
import Data.Dynamic
import Data.Maybe
-import Language.Paraiso.Prelude hiding (map, toList)
-import qualified Language.Paraiso.Prelude as P (map)
+import Prelude hiding (map)
+import qualified Prelude as P (map)
type Annotation = [Dynamic]
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# OPTIONS -Wall #-}
-- | An 'Annotation' that selects whether the data should be
-- stored globally on memory or to be calculated.
@@ -9,6 +9,7 @@ module Language.Paraiso.Annotation.Allocation (
import Data.Dynamic
import Language.Paraiso.Prelude
+import Prelude (Eq, Show)
data Allocation
= Existing -- ^ This entity is already allocated as a static variable.
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# OPTIONS -Wall #-}
-- | An 'Annotation' that sets the execution priority of the
-- statements. Statements with 'Ballon's will be allocated
@@ -11,6 +11,7 @@ module Language.Paraiso.Annotation.Balloon (
import Data.Dynamic
import Language.Paraiso.Prelude
+import Prelude (Eq, Ord)
data (Ord a, Typeable a) => Balloon a
= Balloon a
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, NoImplicitPrelude, StandaloneDeriving,
+{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleContexts, StandaloneDeriving,
UndecidableInstances #-}
{-# OPTIONS -Wall #-}
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# OPTIONS -Wall #-}
-- | An effectless 'Annotation' with a comment
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# OPTIONS -Wall #-}
-- | An 'Annotation' that describes the dependency of the nodes
-- and labels certain group of Manifest nodes
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# OPTIONS -Wall #-}
-- | An effectless 'Annotation' with a comment
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# OPTIONS -Wall #-}
-- | An 'Annotation' that lets you call __syncthreads() before
-- or after a statement.
@@ -1,11 +1,12 @@
-{-# LANGUAGE FlexibleInstances, FlexibleContexts, MultiParamTypeClasses, NoImplicitPrelude, OverloadedStrings #-}
+{-# LANGUAGE CPP, FlexibleInstances, FlexibleContexts, MultiParamTypeClasses, OverloadedStrings #-}
{-# OPTIONS -Wall #-}
-- | a general code generator definition.
module Language.Paraiso.Generator
(
generate, generateIO
) where
+import Control.Monad
import qualified Language.Paraiso.Annotation as Anot
import qualified Language.Paraiso.Generator.Claris as C
import qualified Language.Paraiso.Generator.ClarisTrans as C
@@ -20,6 +21,7 @@ import qualified Data.Text as T
import qualified Data.Text.IO as T
import System.Directory (createDirectoryIfMissing)
import System.FilePath ((</>))
+import Prelude hiding ((++))
-- | Perform the code generation and returns the list of written
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, MultiParamTypeClasses,
+{-# LANGUAGE CPP, DeriveDataTypeable, MultiParamTypeClasses,
NoImplicitPrelude, OverloadedStrings, RankNTypes #-}
{-# OPTIONS -Wall #-}
-- | [CLARIS] C++-Like Abstract Representation of Intermediate Syntax.
@@ -36,6 +36,7 @@ module Language.Paraiso.Generator.Claris (
import qualified Data.Dynamic as Dyn
import Language.Paraiso.Name
import Language.Paraiso.Prelude
+import NumericPrelude
-- | A Claris program.
data Program
@@ -1,5 +1,5 @@
-{-# LANGUAGE FlexibleContexts, ImpredicativeTypes,
-MultiParamTypeClasses, NoImplicitPrelude, OverloadedStrings,
+{-# LANGUAGE CPP, FlexibleContexts, ImpredicativeTypes, NoImplicitPrelude,
+MultiParamTypeClasses, OverloadedStrings,
RankNTypes #-}
{-# OPTIONS -Wall #-}
@@ -9,13 +9,15 @@ module Language.Paraiso.Generator.ClarisTrans (
headerFile, sourceFile, Context
) where
+import Control.Monad
import qualified Data.Dynamic as Dyn
import qualified Data.List as L
import qualified Data.ListLike as LL
import qualified Data.ListLike.String as LL
import Language.Paraiso.Generator.Claris
import Language.Paraiso.Name
import Language.Paraiso.Prelude
+import NumericPrelude hiding ((++))
class Translatable a where
translate :: Context -> a -> Text
@@ -1,5 +1,5 @@
-{-# LANGUAGE FlexibleContexts, FlexibleInstances,
- MultiParamTypeClasses, NoImplicitPrelude, PackageImports,
+{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances,
+ MultiParamTypeClasses, PackageImports,
TypeFamilies #-}
{-# OPTIONS -Wall #-}
-- | a code generator definition for single-core c++ program.
@@ -1,4 +1,4 @@
-{-# LANGUAGE OverloadedStrings, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, OverloadedStrings #-}
{-# OPTIONS -Wall #-}
-- | a code generator definition for single-core c++ program.
module Language.Paraiso.Generator.Cpp
@@ -1,4 +1,4 @@
-{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE CPP, KindSignatures #-}
{-# OPTIONS -Wall #-}
-- | informations for generating native codes.
@@ -1,4 +1,4 @@
-{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
{-# OPTIONS -Wall #-}
module Language.Paraiso.Generator.OMTrans (
@@ -26,7 +26,7 @@ import qualified Language.Paraiso.OM.Realm as Realm
import qualified Language.Paraiso.Optimization as Opt
import qualified Language.Paraiso.PiSystem as Pi
import Language.Paraiso.Prelude
-
+import NumericPrelude hiding ((++))
data Triplet v g
@@ -1,4 +1,5 @@
-{-# LANGUAGE FunctionalDependencies, MultiParamTypeClasses, NoImplicitPrelude, OverloadedStrings #-}
+{-# LANGUAGE CPP, FunctionalDependencies, MultiParamTypeClasses, OverloadedStrings #-}
+{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS -Wall #-}
-- | Taking the optimized OM as the input,
@@ -24,6 +25,7 @@ import qualified Language.Paraiso.OM.DynValue as DVal
import qualified Language.Paraiso.OM.Graph as OM
import qualified Language.Paraiso.OM.Realm as Realm
import Language.Paraiso.Prelude
+import NumericPrelude hiding ((++))
-- | A data structure that contains all informations
@@ -1,5 +1,5 @@
-{-# LANGUAGE DeriveDataTypeable, ExistentialQuantification, NoImplicitPrelude,
-OverloadedStrings, TupleSections #-}
+{-# LANGUAGE CPP, DeriveDataTypeable, ExistentialQuantification,
+NoImplicitPrelude, OverloadedStrings, TupleSections #-}
{-# OPTIONS -Wall #-}
module Language.Paraiso.Generator.PlanTrans (
@@ -14,6 +14,7 @@ import qualified Data.Graph.Inductive as FGL
import Data.List (sortBy)
import qualified Data.ListLike.String as LL
import Data.ListLike.Text ()
+import qualified Data.Foldable as F
import Data.Maybe
import qualified Data.Set as Set
import Data.Tensor.TypeLevel
@@ -30,7 +31,8 @@ import qualified Language.Paraiso.OM.Graph as OM
import qualified Language.Paraiso.OM.Realm as Realm
import qualified Language.Paraiso.Optimization.Graph as Opt
import Language.Paraiso.Name
-import Language.Paraiso.Prelude
+import Language.Paraiso.Prelude hiding (Boolean(..))
+import NumericPrelude hiding ((++))
type AnAn = Anot.Annotation
@@ -106,10 +108,10 @@ memberFuncForSize env@(Env setup plan) =
makeMami True "upperMargin" uM ++
makeMami False "memorySize" memorySize
where
- size = toList $ Native.localSize setup
- memorySize = toList $ Native.localSize setup + Plan.lowerMargin plan + Plan.upperMargin plan
- lM = toList $ Plan.lowerMargin plan
- uM = toList $ Plan.upperMargin plan
+ size = F.toList $ Native.localSize setup
+ memorySize = F.toList $ Native.localSize setup + Plan.lowerMargin plan + Plan.upperMargin plan
+ lM = F.toList $ Plan.lowerMargin plan
+ uM = F.toList $ Plan.upperMargin plan
makeMami alone label xs =
(if not alone then (finale label xs :) else id) $
@@ -336,8 +338,8 @@ loopMaker env@(Env setup plan) realm subker = case realm of
loopStrideCuda = mkVarExpr "blockDim.x * gridDim.x"
loopCounter = C.Var tSizet (mkName "i")
- memorySize = toList $ Native.localSize setup + Plan.lowerMargin plan + Plan.upperMargin plan
- boundarySize = toList $ Native.localSize setup + Plan.lowerMargin plan + Plan.upperMargin plan
+ memorySize = F.toList $ Native.localSize setup + Plan.lowerMargin plan + Plan.upperMargin plan
+ boundarySize = F.toList $ Native.localSize setup + Plan.lowerMargin plan + Plan.upperMargin plan
- Plan.lowerBoundary subker - Plan.upperBoundary subker
codecDiv =
@@ -521,7 +523,7 @@ cursorToText :: Opt.Ready v g => Env v g -> v g -> T.Text
cursorToText _ cursor = cursorT
where
cursorT :: T.Text
- cursorT = foldl1 connector $ compose (\i -> T.map sanitize $ showT (cursor ! i))
+ cursorT = F.foldl1 connector $ compose (\i -> T.map sanitize $ showT (cursor ! i))
connector a b = a ++ "_" ++ b
sanitize c
| isDigit c = c
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, IncoherentInstances #-}
+{-# LANGUAGE CPP, DeriveDataTypeable, IncoherentInstances #-}
{- | an 'Interval' is a pair of 'lower' and 'upper',
representing some interval in ordered system.
The lower bound is inclusive and the upper bound is exclusive:
View
@@ -1,4 +1,4 @@
-{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
{-# OPTIONS -Wall #-}
module Language.Paraiso.OM
(
@@ -1,4 +1,4 @@
-{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
{-# OPTIONS -Wall #-}
module Language.Paraiso.OM.Arithmetic
(
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleInstances, NoImplicitPrelude, RankNTypes, TypeSynonymInstances #-}
+{-# LANGUAGE CPP, FlexibleInstances, RankNTypes, TypeSynonymInstances #-}
{-# OPTIONS -Wall #-}
-- | A monadic library to build dataflow graphs for OM.
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleInstances, NoImplicitPrelude, RankNTypes,
+{-# LANGUAGE CPP, FlexibleInstances, RankNTypes,
TypeSynonymInstances #-}
{-# OPTIONS -Wall #-}
-- | An extension module of building blocks. Contains booleans, comparison operations, branchings.
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleInstances, KindSignatures, NoImplicitPrelude,
+{-# LANGUAGE CPP, FlexibleInstances, KindSignatures, NoImplicitPrelude,
PackageImports, RankNTypes, TypeSynonymInstances #-}
{-# OPTIONS -Wall #-}
@@ -45,6 +45,7 @@ import Language.Paraiso.OM.Reduce as Reduce
import Language.Paraiso.OM.Value as Val
import Language.Paraiso.Prelude
import qualified Prelude (Num(..), Fractional(..))
+import NumericPrelude hiding ((++))
-- | Create a 'Kernel' from a 'Builder' monad.
buildKernel ::
@@ -1,4 +1,4 @@
-{-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-}
+{-# LANGUAGE CPP, OverloadedStrings #-}
{-# OPTIONS -Wall #-}
module Language.Paraiso.OM.PrettyPrint (
@@ -23,6 +23,7 @@ import Language.Paraiso.OM
import Language.Paraiso.OM.Graph
import Language.Paraiso.Optimization.Graph as Opt
import Language.Paraiso.Prelude
+import Prelude hiding ((++))
-- | pretty print the OM, neglecting any annotations.
prettyPrint :: Opt.Ready v g => OM v g a -> T.Text
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleInstances, UndecidableInstances #-}
+{-# LANGUAGE CPP, FlexibleInstances, UndecidableInstances #-}
{-# OPTIONS -Wall #-}
-- | The 'Realm' represents how the data reside in Orthotope Machines.
@@ -1,5 +1,5 @@
-{-# LANGUAGE DeriveDataTypeable, KindSignatures,
-MultiParamTypeClasses, NoImplicitPrelude, RankNTypes
+{-# LANGUAGE CPP, DeriveDataTypeable, KindSignatures,
+MultiParamTypeClasses, RankNTypes
#-}
{-# OPTIONS -Wall #-}
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable, NoImplicitPrelude #-}
{-# OPTIONS -Wall #-}
-- | The volume of mesh that contains the correct results shrinks as
@@ -15,6 +15,7 @@ module Language.Paraiso.Optimization.BoundaryAnalysis (
import qualified Algebra.Additive as Additive
import qualified Data.Graph.Inductive as FGL
+import Data.Foldable (toList)
import Data.Maybe
import Data.Tensor.TypeLevel
import Data.Typeable
@@ -27,7 +28,7 @@ import Language.Paraiso.OM.Graph
import Language.Paraiso.OM.Realm as Realm
import Language.Paraiso.PiSystem
import Language.Paraiso.Prelude
-
+import NumericPrelude hiding ((++))
boundaryAnalysis :: (Vector v, Additive.C g, Ord g, Typeable g)
=> Graph v g Anot.Annotation -> Graph v g Anot.Annotation
@@ -1,9 +1,10 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude, TupleSections #-}
+{-# LANGUAGE CPP, DeriveDataTypeable, TupleSections #-}
{-# OPTIONS -Wall #-}
module Language.Paraiso.Optimization.DeadCodeElimination (
deadCodeElimination
) where
+import Control.Applicative
import qualified Data.Graph.Inductive as FGL
import Data.Maybe
import qualified Data.Vector as V
@@ -12,6 +13,7 @@ import qualified Language.Paraiso.Annotation.Execution as Anot
import Language.Paraiso.Prelude
import Language.Paraiso.OM.Graph
import Language.Paraiso.Optimization.Graph
+import Prelude hiding ((++))
-- | an optimization that changes nothing.
deadCodeElimination :: Optimization
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# OPTIONS -Wall #-}
-- | The choice of making each Orthotope Machine node Manifest or not
@@ -17,7 +17,6 @@ import qualified Data.Graph.Inductive as FGL
import Data.Maybe
import qualified Language.Paraiso.Annotation as Anot
import Language.Paraiso.Annotation.Allocation as Alloc
-import Language.Paraiso.Prelude
import Language.Paraiso.OM.Graph
import Language.Paraiso.OM.DynValue as DVal
import Language.Paraiso.OM.Realm as Realm
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, DeriveDataTypeable #-}
{-# OPTIONS -Wall #-}
-- | This module performs dependency analysis for generating subroutines.
@@ -31,7 +31,6 @@ import qualified Language.Paraiso.OM.DynValue as DVal
import Language.Paraiso.OM.Graph
import qualified Language.Paraiso.OM.Realm as Realm
import qualified Language.Paraiso.Optimization.Graph as Opt
-import Language.Paraiso.Prelude
-- | Give unique numbering to each groups in the entire OM
-- in preparation for code generation
Oops, something went wrong.

0 comments on commit 52635e7

Please sign in to comment.