]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Disable most of existing code generation framework.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Wed, 28 Mar 2012 16:10:24 +0000 (17:10 +0100)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Wed, 28 Mar 2012 16:10:24 +0000 (17:10 +0100)
17 files changed:
src/ofc/codegen/Expression.scala [new file with mode: 0644]
src/ofc/codegen/IterationTemplate.scala [new file with mode: 0644]
src/ofc/codegen/Symbol.scala [new file with mode: 0644]
src/ofc/generators/Onetep.scala
src/ofc/generators/onetep/Assignment.scala
src/ofc/generators/onetep/CodeGenerator.scala
src/ofc/generators/onetep/GeneralInnerProduct.scala
src/ofc/generators/onetep/Index.scala
src/ofc/generators/onetep/IterationSpace.scala
src/ofc/generators/onetep/Laplacian.scala
src/ofc/generators/onetep/LoopTree.scala
src/ofc/generators/onetep/PPDFunctionSet.scala
src/ofc/generators/onetep/Reciprocal.scala
src/ofc/generators/onetep/SPAM3.scala
src/ofc/generators/onetep/Scalar.scala
src/ofc/generators/onetep/SpatialRestriction.scala
src/ofc/generators/onetep/TreeBuilder.scala

diff --git a/src/ofc/codegen/Expression.scala b/src/ofc/codegen/Expression.scala
new file mode 100644 (file)
index 0000000..ab49031
--- /dev/null
@@ -0,0 +1,3 @@
+package ofc.codegen
+
+trait Expression
diff --git a/src/ofc/codegen/IterationTemplate.scala b/src/ofc/codegen/IterationTemplate.scala
new file mode 100644 (file)
index 0000000..723c045
--- /dev/null
@@ -0,0 +1,4 @@
+package ofc.codegen
+
+class IterationTemplate {
+}
diff --git a/src/ofc/codegen/Symbol.scala b/src/ofc/codegen/Symbol.scala
new file mode 100644 (file)
index 0000000..424c052
--- /dev/null
@@ -0,0 +1,3 @@
+package ofc.codegen
+
+class Symbol(name: String)
index 306b003f39875c5731258d5b6146a48d66f738cc..d5d125f28863a1eb4047ee71892c5fe5410f4b6e 100644 (file)
@@ -35,8 +35,8 @@ class Onetep extends Generator {
 
     call match {
       case Some(FunctionCall(matType, params)) => (matType, params) match {
-        case (Identifier("SPAM3"), ParameterList(StringParameter(name))) => 
-          dictionary.matrices += (id -> new SPAM3(name))
+        //case (Identifier("SPAM3"), ParameterList(StringParameter(name))) => 
+        //  dictionary.matrices += (id -> new SPAM3(name))
         case _ => throw new InvalidInputException("Unknown usage of type: "+matType.name)
       }
       case _ => throw new InvalidInputException("Undefined concrete type for matrix: "+id.name)
@@ -48,8 +48,8 @@ class Onetep extends Generator {
 
     call match {
       case Some(FunctionCall(fSetType, params)) => (fSetType, params) match {
-        case (Identifier("PPDFunctionSet"), ParameterList(StringParameter(basis), StringParameter(data))) => 
-          dictionary.functionSets += id -> new PPDFunctionSet(basis, data)
+        //case (Identifier("PPDFunctionSet"), ParameterList(StringParameter(basis), StringParameter(data))) => 
+        //  dictionary.functionSets += id -> new PPDFunctionSet(basis, data)
         case _ => throw new InvalidInputException("Unknown usage of type: "+fSetType.name)
       }
       case _ => throw new InvalidInputException("Undefined concrete type for function set: "+id.name)
@@ -86,8 +86,8 @@ class Onetep extends Generator {
   def buildDefinition(definition : parser.Definition) {
     val builder = new TreeBuilder(dictionary)
     val assignment = builder(definition.term, definition.expr)
-    val codeGenerator = new CodeGenerator()
-    codeGenerator(assignment)
+    //val codeGenerator = new CodeGenerator()
+    //codeGenerator(assignment)
   }
 
   def buildDefinitions(statements : List[parser.Statement]) {
index 4d779c4499457566b9239d48572e2d434219e74b..23c34a79ab0c8f82c9b67f494aa316849c818d10 100644 (file)
@@ -1,5 +1,5 @@
 package ofc.generators.onetep
-
+/*
 class Assignment(indexBindings: IndexBindings, lhs: DataSpace, rhs: IterationSpace) extends IterationSpace {
   def getIndexBindings = indexBindings
   def getOperands = List(rhs)
@@ -11,3 +11,4 @@ class Assignment(indexBindings: IndexBindings, lhs: DataSpace, rhs: IterationSpa
   def getTransformGenerator = None
   def getProducerGenerator = None
 }
+*/
index 7735c9eb3b74eae01020c891165f0b6a36c7263f..9f7c673942626232f596333f9b0dd2fae2ed66b5 100644 (file)
@@ -1,6 +1,6 @@
 package ofc.generators.onetep
 import scala.collection.mutable.HashMap
-
+/*
 class NameManager {
   var nextIndexID = 0
   val names = new HashMap[Index, String]()
@@ -107,3 +107,4 @@ class CodeGenerator {
     // We now generate the actual loop for space. This may involve a composite iteration construction
   }
 }
+*/
index 6b8e9b65ef2020d3245fa17aef20406ef6fc390c..267b7e56105b5cfa229cef102a2597d6966f8631 100644 (file)
@@ -1,5 +1,5 @@
 package ofc.generators.onetep
-
+/*
 class GeneralInnerProduct(operands: List[IterationSpace], removedIndices: Set[Index]) extends IterationSpace {
 
   class DenseSpatialIndex(parent: GeneralInnerProduct, original: SpatialIndex) extends SpatialIndex{
@@ -43,5 +43,4 @@ class GeneralInnerProduct(operands: List[IterationSpace], removedIndices: Set[In
   def getTransformGenerator = None
   def getProducerGenerator = None
 }
-
-
+*/
index 2b3e5c03e5fe90da426c0612535743ef79a81598..435d62e25af06095b0d69f5f8326a19c028c5a7c 100644 (file)
@@ -1,5 +1,7 @@
 package ofc.generators.onetep
+import ofc.codegen.Expression
 
+/*
 object Index {
   def sort(indices: Traversable[Index]) : List[Index] = {
     def helper(input: Index, seen: collection.mutable.Set[Index]) : List[Index] =
@@ -12,15 +14,14 @@ object Index {
     indices.toList.flatMap(helper(_, seen))
   }
 }
+*/
 
 trait Index {
   def getName : String
-  def getDependencies : Set[Index]
-  def getDenseWidth(names: NameManager) : String
-  def getDensePosition(names: NameManager) : String = names(this)
-  def generateIterationHeader(names: NameManager) : String
-  def generateIterationFooter(names: NameManager) : String
-  def getDeclarations(names: NameManager) : List[String]
+  def getMappingFunction : Expression
+  def getMinimumValue : Expression
+  def getLength : Expression
+  def isRandomAccess : Boolean
 }
 
 trait SpatialIndex extends Index
index bf02a196d8b337c9cc603173b15712b4bb8b778b..6b6ff2e5fd77ed50c2d68eac619b21b65e9dba9d 100644 (file)
@@ -1,5 +1,7 @@
 package ofc.generators.onetep
+import ofc.codegen.IterationTemplate
 
+/*
 object IterationSpace {
   def sort(spaces : Traversable[IterationSpace]) : List[IterationSpace] = {
     def helper(input: IterationSpace, seen: collection.mutable.Set[IterationSpace]) : List[IterationSpace] =
@@ -15,29 +17,22 @@ object IterationSpace {
   def flattenPostorder(term: IterationSpace) : Traversable[IterationSpace] = 
     term.getOperands.toTraversable.flatMap(flattenPostorder(_)) ++ List(term)
 }
+*/
 
 trait IterationSpace {
   def getOperands : List[IterationSpace]
   def getSpatialIndices : List[SpatialIndex]
   def getDiscreteIndices : List[DiscreteIndex]
-  def getExternalIndices : Set[Index]
-  def getInternalIndices : Set[Index] = (getSpatialIndices ++ getDiscreteIndices).toSet
-  def getIndices : Set[Index] = getInternalIndices ++ getExternalIndices
+  def getIndices : Set[Index] = (getSpatialIndices ++ getDiscreteIndices).toSet
   def getDependencies : Set[IterationSpace] = {
     val operands = getOperands
     operands.toSet ++ operands.flatMap(_.getDependencies)
   }
-
-  // Code generation
-  def getConsumerGenerator : Option[ConsumerGenerator]
-  def getTransformGenerator : Option[TransformGenerator]
-  def getProducerGenerator : Option[ProducerGenerator]
+  def getReader : IterationTemplate
 }
 
 trait DataSpace extends IterationSpace {
   def getOperands = Nil
-  def getConsumerGenerator = None
-  def getTransformGenerator = None
 }
 
 trait Matrix extends DataSpace
index e2d96491b79b5a15652f0d985bec69fb91a78c74..abab4c4de381e60764e65165d6acfdcd36c1c10b 100644 (file)
@@ -1,5 +1,5 @@
 package ofc.generators.onetep
-
+/*
 class Laplacian(op: IterationSpace) extends IterationSpace {
   def getOperands = List(op)
   def getSpatialIndices = op.getSpatialIndices
@@ -10,5 +10,4 @@ class Laplacian(op: IterationSpace) extends IterationSpace {
   def getTransformGenerator = None
   def getProducerGenerator = None
 }
-
-
+*/
index ae4f7fb3ad474c273d0148ffb8b40393022aa6dc..a2ae25fb639127b650559bb84e05f56cfb5f6f79 100644 (file)
@@ -7,6 +7,7 @@ import ofc.LogicError
 Stores the configuration of indices we will use for code generation.
 */
 
+/*
 object LoopNest {
   def apply(root: IterationSpace) : LoopNest = {
     val sortedSpaces = IterationSpace.flattenPostorder(root)
@@ -375,5 +376,4 @@ class LoopTree private[onetep](localIndex: Option[Index]) extends Fragment {
     result.toList
   }
 }
-
-
+*/
index f7adac480ce60d2949c3d730a4fa81708757e26b..ebd25373d190961f99ad79971e953dff05a65b80 100644 (file)
@@ -1,6 +1,7 @@
 package ofc.generators.onetep
 
 class PPDFunctionSet(val basis : String, data : String) extends FunctionSet {
+/*
   class SphereIndex(parent: PPDFunctionSet) extends DiscreteIndex {
     def getName = "sphere_index"
     def getDependencies = Set()
@@ -137,6 +138,7 @@ class PPDFunctionSet(val basis : String, data : String) extends FunctionSet {
       data+"("+getPPDIndex.getPPDPoint+")"
     }
   })
+*/
 }
 
 
index b16d5f3a8a90fee54fb7a3202375a8108250f05c..1391b790e35a698c950dab2157d6c274f932ab0a 100644 (file)
@@ -1,5 +1,5 @@
 package ofc.generators.onetep
-
+/*
 class Reciprocal(op: IterationSpace) extends IterationSpace {
   class BlockIndex(parent: Reciprocal, dimension: Int, original: SpatialIndex)  extends SpatialIndex {
     def getName = "reciprocal_index_" + dimension
@@ -22,5 +22,4 @@ class Reciprocal(op: IterationSpace) extends IterationSpace {
   def getTransformGenerator = None
   def getProducerGenerator = None
 }
-
-
+*/
index abbe79b89812ba684d0ea262ef3ba1a965fb866b..b9134448dbae99b87fa77cb62d701c4f29d2a2c7 100644 (file)
@@ -1,5 +1,5 @@
 package ofc.generators.onetep
-
+/*
 class SPAM3(name : String) extends Matrix {
   override def toString = name
   def getName = name
@@ -44,5 +44,4 @@ class SPAM3(name : String) extends Matrix {
 
   def getProducerGenerator = None
 }
-
-
+*/
index 2eb8437748a57af4e33ada156b0fa7fff93b32c8..97fe64e504266ee6a33d3a195f918606d3021e5b 100644 (file)
@@ -1,5 +1,5 @@
 package ofc.generators.onetep
-
+/*
 class Scalar(value: Double) extends DataSpace {
   def getSpatialIndices = Nil
   def getDiscreteIndices = Nil
@@ -8,5 +8,4 @@ class Scalar(value: Double) extends DataSpace {
     def generate(names: NameManager) = value.toString
   })
 }
-
-
+*/
index 3f5fe00ab3501df63997df93a7874057ac09e75b..4f546766128e34cf4ded941c42b7799757982869 100644 (file)
@@ -1,5 +1,5 @@
 package ofc.generators.onetep
-
+/*
 class SpatialRestriction(op: IterationSpace) extends IterationSpace {
   class RestrictedIndex(parent: SpatialRestriction, dimension: Int)  extends SpatialIndex {
     def getName = "restriction_index_" + dimension
@@ -26,5 +26,4 @@ class SpatialRestriction(op: IterationSpace) extends IterationSpace {
   def getTransformGenerator = None
   def getProducerGenerator = None
 }
-
-
+*/
index 738f571513deac962d6cd303ba7e3336e17a2567..9b878bd786c5dd48bb4752a8a1fd244796a817fe 100644 (file)
@@ -4,18 +4,6 @@ import ofc.parser
 import ofc.parser.Identifier
 import ofc.{InvalidInputException,UnimplementedException}
 
-trait ConsumerGenerator {
-  def generate(names: NameManager, indices: Map[Index,String], values : Map[IterationSpace, String]) : String
-}
-
-trait ProducerGenerator {
-  def generate(names: NameManager) : String
-}
-
-trait TransformGenerator {
-  def generate(names: NameManager) : String
-}
-
 class BindingIndex(name : String) {
   override def toString()  = name
 }
@@ -70,7 +58,7 @@ class TreeBuilder(dictionary : Dictionary) {
     val rhsTree = buildExpression(rhs)
 
     lhsTree match {
-      case (lhsTree: DataSpace) => new Assignment(indexBindings, lhsTree, rhsTree)
+      //case (lhsTree: DataSpace) => new Assignment(indexBindings, lhsTree, rhsTree)
       case _ => throw new InvalidInputException("Non-assignable expression on LHS of assignment.")
     }
   }
@@ -93,6 +81,7 @@ class TreeBuilder(dictionary : Dictionary) {
 
     term match {
       case (t: IndexedTerm) => buildIndexedTerm(t)
+/*
       case ScalarConstant(s) => new Scalar(s)
       case Multiplication(a, b) => 
         new GeneralInnerProduct(List(buildExpression(a), buildExpression(b)), Set())
@@ -114,6 +103,7 @@ class TreeBuilder(dictionary : Dictionary) {
       case Operator(Identifier("laplacian"), List(op)) => new Laplacian(buildExpression(op))
       case Operator(Identifier("fftbox"), List(op)) => new SpatialRestriction(buildExpression(op))
       case Operator(Identifier(name), _) => throw new UnimplementedException("Unknown or incorrectly called operator: "+name)
+*/
     }
   }
 }