Skip to content

Commit

Permalink
Upgraded to scala 2.12, added Bloop support, fixed compilation warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Steuwer committed Jan 1, 2020
1 parent a800c08 commit de5b2a5
Show file tree
Hide file tree
Showing 171 changed files with 239 additions and 410 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ project
target
modules.xml
.vscode
.metals
.bloop

*.aux
*.bbl
Expand Down
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / scalaVersion := "2.11.12"
ThisBuild / scalaVersion := "2.12.10"
ThisBuild / organization := "org.rise-lang"

lazy val shine = (project in file("."))
Expand All @@ -25,18 +25,18 @@ lazy val shine = (project in file("."))
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
libraryDependencies += "org.scala-lang" % "scala-library" % scalaVersion.value,
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.5",
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.2.0",

// JUnit
libraryDependencies += "junit" % "junit" % "4.11",

// Scalatest
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0" % "test",

// Silencer: Scala compiler plugin for warning suppression
libraryDependencies ++= Seq(
compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.4.0"),
"com.github.ghik" %% "silencer-lib" % "1.4.0" % Provided
compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.4.3" cross CrossVersion.full),
"com.github.ghik" %% "silencer-lib" % "1.4.3" % Provided cross CrossVersion.full
)
)

Expand Down
2 changes: 1 addition & 1 deletion lib/executor
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.0-RC1")
1 change: 0 additions & 1 deletion src/main/scala/FSmooth/Differentiation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package FSmooth

import DSL._
import FSmooth.MSmooth._
import FSmooth.traversal._

import scala.collection.mutable

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/apps/acoustic3D.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object acoustic3D {
private val SR = 441.0f
private val alpha = 0.005f
private val c = 344.0f
private val NF = 4410
// private val NF = 4410
private val k = 1.0f / SR
private val h = Math.sqrt(3.0f) * c * k
private val lambda = c * k / h
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/apps/convolution.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import rise.core._
import rise.core.DSL._
import rise.core.types._
import rise.core.TypeLevelDSL._
import rise.core.primitives._
import rise.OpenCL.DSL._
import rise.core.HighLevelConstructs._
import util.{Time, TimeSpan}
Expand Down
5 changes: 1 addition & 4 deletions src/main/scala/apps/harrisCornerDetection.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package apps

import rise.core._
import rise.core.DSL._
import rise.core.TypeLevelDSL._
import rise.core.types._
import rise.core.primitives._
import rise.OpenCL.primitives._
import rise.OpenCL.DSL._
import rise.core.HighLevelConstructs._
import util.gen

import scala.reflect.ClassTag
Expand All @@ -17,7 +14,7 @@ object harrisCornerDetection {
private val id = C2D.id
private val mulT = C2D.mulT
private val sq = fun(x => x * x)
private def zip2D(a: Expr, b: Expr) = zipND(2)(a)(b)
// private def zip2D(a: Expr, b: Expr) = zipND(2)(a)(b)

// 5 for two scalar stencils of 3
private val hRange = arithexpr.arithmetic.RangeAdd(5, arithexpr.arithmetic.PosInf, 1)
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/apps/kmeans.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import rise.core._
import rise.core.DSL._
import rise.core.TypeLevelDSL._
import rise.core.types._
import rise.core.primitives._
import rise.OpenCL.DSL._

object kmeans {
Expand Down
2 changes: 0 additions & 2 deletions src/main/scala/apps/mm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import rise.core._
import rise.core.DSL._
import rise.core.TypeLevelDSL._
import rise.core.types._
import rise.core.primitives._
import rise.OpenCL.primitives._
import rise.OpenCL.DSL._

object mm {
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/apps/molecularDynamics.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import rise.core._
import rise.core.DSL._
import rise.core.TypeLevelDSL._
import rise.core.types._
import rise.core.primitives._
import rise.OpenCL.DSL._

object molecularDynamics {
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/apps/mriQ.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import rise.core._
import rise.core.DSL._
import rise.core.TypeLevelDSL._
import rise.core.types._
import rise.core.primitives._
import rise.OpenCL.DSL._

object mriQ {
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/apps/nbody.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import rise.core._
import rise.core.DSL._
import rise.core.TypeLevelDSL._
import rise.core.types._
import rise.core.primitives._
import rise.OpenCL.DSL._

object nbody {
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/apps/separableConvolution2D.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import rise.core.TypeLevelDSL._
import rise.core.types._
import rise.core.semantics._
import rise.core.primitives._
import rise.OpenCL.primitives._
import rise.OpenCL.DSL._
import rise.core.HighLevelConstructs._

Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/apps/sgemm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import rise.core.HighLevelConstructs.reorderWithStride
import rise.core._
import rise.core.DSL._
import rise.core.TypeLevelDSL._
import rise.core.primitives._
import rise.OpenCL.DSL._
import rise.core.types._
import util.{Time, TimeSpan, gen}
import util.{Time, TimeSpan}

object sgemm {
// we can use implicit type parameters and type annotations to specify the function type of mult
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/benchmarks/core/package.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package benchmarks

import opencl.executor.Executor
import util.{Time, TimeSpan}

package object core {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/elevate/fsmooth/traversal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object traversal {
case Success(f: FSmooth) => Success(Application(s(f).get, args, t))
case Failure(state) => {
val strategy = if(carryOverState) state else s
args.foldLeft[(Boolean, RewriteResult[FSmooth])](true, Failure(s))(
args.foldLeft[(Boolean, RewriteResult[FSmooth])]((true, Failure(s)))(
(state,expr) => {
val (cont, result) = (state._1, state._2)
if (cont) strategy(expr) match {
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/elevate/rise/rules/movement.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package elevate.rise.rules

import elevate.core.strategies.predicate._
import elevate.rise.rules.traversal._
import elevate.core.{Failure, RewriteResult, Strategy, Success}
import elevate.rise._
import rise.core._
Expand Down
2 changes: 0 additions & 2 deletions src/main/scala/elevate/rise/strategies/predicate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import elevate.rise.Rise
import rise.core.primitives.{Generate, Let, Map, Reduce, Zip}
import rise.core.{App, Identifier, Lambda}

import scala.language.implicitConversions

object predicate {

// Matching Single Nodes
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/shine/C/AST/Nodes.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package shine.C.AST

import arithexpr.arithmetic.ArithExpr
import shine.C
import shine.C.AST.Nodes.{VisitAndGenerateStmt, VisitAndRebuild}
import arithexpr.arithmetic.ArithExpr

/*
* This implementation follows the design from the Lift repository by Adam Harries
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/shine/C/AST/Printer.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package shine.C.AST

import shine.DPIA.NatFunCall
import shine.DPIA.Types.ExpType
import arithexpr.arithmetic._
import shine.DPIA.NatFunCall

trait Printer {
def printNode(n: Node): String
Expand Down
5 changes: 2 additions & 3 deletions src/main/scala/shine/C/CodeGeneration/CodeGenerator.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package shine.C.CodeGeneration

import arithexpr.arithmetic.BoolExpr.ArithPredicate
import arithexpr.arithmetic.{NamedVar, _}
import shine.C.AST.Block
import shine.C.AST.DefaultImplementations.ArrayLiteral
import shine.DPIA.Compilation.SimplifyNats
import shine.DPIA.DSL._
import shine.DPIA.FunctionalPrimitives._
Expand All @@ -12,8 +13,6 @@ import shine.DPIA.Semantics.OperationalSemantics._
import shine.DPIA.Types._
import shine.DPIA._
import shine._
import arithexpr.arithmetic.BoolExpr.ArithPredicate
import arithexpr.arithmetic.{NamedVar, _}

import scala.collection.immutable.VectorBuilder
import scala.collection.{immutable, mutable}
Expand Down
5 changes: 1 addition & 4 deletions src/main/scala/shine/C/Program.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package shine.C

import shine._
import shine.DPIA.Phrases.Identifier
import shine.DPIA.Types.{AccType, ExpType}

import scala.language.implicitConversions

import shine._

case class Program(decls: Seq[C.AST.Decl],
function: C.AST.FunDecl,
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/shine/C/ProgramGenerator.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package shine.C

import arithexpr.arithmetic.{Cst, Var}
import shine.DPIA.Compilation._
import shine.DPIA.DSL._
import shine.DPIA.FunctionalPrimitives.AsIndex
import shine.DPIA.{LetNatIdentifier, Lifting}
import shine.DPIA.Phrases._
import shine.DPIA.Types._
import shine.DPIA.{LetNatIdentifier, Lifting}
import shine._
import arithexpr.arithmetic.{Cst, Var}

import scala.collection._

Expand Down
8 changes: 3 additions & 5 deletions src/main/scala/shine/C/TranslationContext.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package shine.C

import shine.DPIA
import shine.DPIA.DSL._
import shine.DPIA.ImperativePrimitives.Assign
import shine.DPIA.IntermediatePrimitives.{DepMapSeqI, MapSeqI}
import shine.DPIA.Phrases.{DepLambda, Phrase}
import shine.DPIA.IntermediatePrimitives.DepMapSeqI
import shine.DPIA.Phrases.Phrase
import shine.DPIA.Types._
import shine.DPIA.freshName

class TranslationContext() extends shine.DPIA.Compilation.TranslationContext {
override def assign(dt: DataType,
Expand All @@ -26,7 +24,7 @@ class TranslationContext() extends shine.DPIA.Compilation.TranslationContext {
DepMapSeqI(n, ft, ft,
depFun[NatKind]()(k =>
λ(ExpType(ft(k), read))(x => λ(AccType( ft(k) ))(a => assign(ft(k), a, x) ))),
rhs, lhs)(this)
rhs, lhs)

case x => throw new Exception(s"Don't know how to assign value of type $x")
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/shine/DPIA/Compilation/CodeGenerator.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package shine.DPIA.Compilation

import shine.C.CodeGeneration.{CodeGenerator => CCodeGenerator}
import shine.DPIA.{LetNatIdentifier, Nat}
import shine.DPIA.Phrases.Phrase
import shine.DPIA.Types.{AccType, CommType, DataType, ExpType}
import shine.DPIA.{LetNatIdentifier, Nat}

trait CodeGenerator[Environment, Path, Stmt, Expr, Decl, Ident, Type] {
def name: String
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/shine/DPIA/Compilation/SimplifyNats.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package shine.DPIA.Compilation

import shine.DPIA._
import shine.DPIA.FunctionalPrimitives.AsIndex
import shine.DPIA.Phrases._
import shine.DPIA.Types._
import shine.DPIA.FunctionalPrimitives.AsIndex
import shine.DPIA._

object SimplifyNats {
def apply(p: Phrase[CommType]): Phrase[CommType] = {
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/shine/DPIA/Compilation/UnrollLoops.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package shine.DPIA.Compilation

import shine.DPIA._
import arithexpr.arithmetic.ArithExpr.isSmaller
import arithexpr.arithmetic.Cst
import shine.DPIA.FunctionalPrimitives.AsIndex
import shine.DPIA.ImperativePrimitives._
import shine.DPIA.Phrases._
import shine.DPIA.Types._
import shine.DPIA.ImperativePrimitives.{Comment, For, ForNat, IdxAcc, Seq}
import shine.DPIA.FunctionalPrimitives.AsIndex
import shine.DPIA._
import shine.OpenCL.ImperativePrimitives.OpenCLParFor
import arithexpr.arithmetic.Cst
import arithexpr.arithmetic.ArithExpr.isSmaller

object UnrollLoops {
def apply(p: Phrase[CommType]): Phrase[CommType] = {
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/shine/DPIA/DSL/Core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ object λ extends funDef

object nFun {
def apply[T <: PhraseType](f: NatIdentifier => Phrase[T],
range: arithexpr.arithmetic.Range)
(implicit w: Kind.IdentifierMaker[NatKind]): DepLambda[NatKind, T] = {
range: arithexpr.arithmetic.Range): DepLambda[NatKind, T] = {
val x = NatIdentifier(freshName("n"), range)
DepLambda[NatKind, T](x, f(x))
}
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/shine/DPIA/DSL/ImperativePrimitives.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import shine.DPIA.ImperativePrimitives._
import shine.DPIA.Phrases.{Identifier, IfThenElse, Phrase}
import shine.DPIA.Types._
import shine.DPIA._
import shine.OpenCL.ImperativePrimitives.Barrier

object `new` {
def apply(dt: DataType,
Expand Down
7 changes: 3 additions & 4 deletions src/main/scala/shine/DPIA/DSL/package.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package shine.DPIA

import shine.DPIA.Compilation.TranslationContext
import shine.DPIA.FunctionalPrimitives.{DepIdx, Idx, IdxVec, AsIndex}
import shine.DPIA.FunctionalPrimitives.{AsIndex, DepIdx, Idx, IdxVec}
import shine.DPIA.ImperativePrimitives._
import shine.DPIA.Phrases._
import shine.DPIA.Phrases.{Operators, _}
import shine.DPIA.Semantics.OperationalSemantics.{FloatData, IntData}
import shine.DPIA.Types._
import shine.DPIA.Phrases.Operators

import scala.language.{implicitConversions, reflectiveCalls}
import scala.language.implicitConversions

package object DSL {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package shine.DPIA.FunctionalPrimitives

import shine.DPIA.Compilation.TranslationContext
import shine.DPIA.DSL._
import shine.DPIA.Phrases._
import shine.DPIA.Semantics.OperationalSemantics
import shine.DPIA.Semantics.OperationalSemantics._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package shine.DPIA.FunctionalPrimitives

import shine.DPIA.Compilation.{TranslationToImperative, TranslationContext}
import shine.DPIA._
import shine.DPIA.Compilation.{TranslationContext, TranslationToImperative}
import shine.DPIA.DSL._
import shine.DPIA.Phrases._
import shine.DPIA.Types._
import shine.DPIA._

abstract class AbstractMapLoop(override val n: Nat,
override val dt1: DataType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package shine.DPIA.FunctionalPrimitives

import shine.DPIA.Compilation.{TranslationContext, TranslationToImperative}
import shine.DPIA.DSL._
import shine.DPIA.IntermediatePrimitives.ScanSeqI
import shine.DPIA.Phrases._
import shine.DPIA.Semantics.OperationalSemantics._
import shine.DPIA.Types._
Expand Down
Loading

0 comments on commit de5b2a5

Please sign in to comment.