Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Expressions/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
libraryDependencies += "com.thoughtworks.feature" %% "implicitapply" % "2.3.0-M6"
libraryDependencies += "com.thoughtworks.feature" %% "implicitapply" % "2.3.0-M7"

libraryDependencies += "com.thoughtworks.feature" %% "factory" % "2.3.0-M6"
libraryDependencies += "com.thoughtworks.feature" %% "factory" % "2.3.0-M7"

libraryDependencies += "com.lihaoyi" %% "sourcecode" % "0.1.4"

Expand Down
8 changes: 4 additions & 4 deletions OpenCL/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ libraryDependencies += "com.thoughtworks.raii" %% "asynchronous" % "3.0.0-M8"

libraryDependencies += "com.thoughtworks.raii" %% "asynchronouspool" % "3.0.0-M8"

libraryDependencies += "com.thoughtworks.feature" %% "partialapply" % "2.3.0-M6"
libraryDependencies += "com.thoughtworks.feature" %% "partialapply" % "2.3.0-M7"

libraryDependencies += "com.thoughtworks.feature" %% "implicitapply" % "2.3.0-M6"
libraryDependencies += "com.thoughtworks.feature" %% "implicitapply" % "2.3.0-M7"

libraryDependencies += "com.thoughtworks.feature" %% "mixins-implicitssingleton" % "2.3.0-M6"
libraryDependencies += "com.thoughtworks.feature" %% "mixins-implicitssingleton" % "2.3.0-M7"

libraryDependencies += "com.thoughtworks.feature" %% "factory" % "2.3.0-M6"
libraryDependencies += "com.thoughtworks.feature" %% "factory" % "2.3.0-M7"

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % Test

Expand Down
8 changes: 8 additions & 0 deletions OpenCL/src/main/scala/com/thoughtworks/compute/OpenCL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ object OpenCL {
data: $data""")
}

@deprecated(
message = "[[finalize]] method should not be invoked by users.",
since = "[[finalize]] is deprecated in Java 9. However, it is the only way to clean up static native resources."
)
override protected def finalize(): Unit = {
contextCallback.close()
super.finalize()
Expand Down Expand Up @@ -779,6 +783,10 @@ object OpenCL {

object Program {

@deprecated(
message = "[[finalize]] method should not be invoked by users.",
since = "[[finalize]] is deprecated in Java 9. However, it is the only way to clean up static native resources."
)
override protected def finalize(): Unit = {
programCallback.close()
super.finalize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ trait Tensors extends OpenCL {
@tailrec def loop(i: Int): Unit = {
if (i < productArity) {
tree.productElement(i) match {
case child: TreeApi =>
case child: TreeApi @unchecked =>
val isNew = traversed.add(tree)
if (isNew) {
buildParameterList(child)
Expand Down
3 changes: 3 additions & 0 deletions Trees/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ scalacOptions += "-Xexperimental"

scalacOptions += "-Ypartial-unification"

addCompilerPlugin("com.github.ghik" %% "silencer-plugin" % "0.6")

libraryDependencies += "com.github.ghik" %% "silencer-lib" % "0.6"
21 changes: 18 additions & 3 deletions Trees/src/main/scala/com/thoughtworks/compute/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package com.thoughtworks.compute

import java.util.IdentityHashMap

import com.github.ghik.silencer.silent
import com.thoughtworks.compute.Expressions.{Arrays, FloatArrays, Floats, Values}
import com.thoughtworks.compute.NDimensionalAffineTransform.MatrixData
import com.thoughtworks.feature.Factory.{Factory1, Factory2, inject}

import scala.annotation.meta.companionObject
import scala.annotation.tailrec
import scala.collection.JavaConverters._
import scala.language.higherKinds
Expand All @@ -20,7 +22,7 @@ trait Trees extends Expressions {

private def childHashCode(child: Any, context: HashCodeContext): Int = {
child match {
case childTree: TreeApi =>
case childTree: TreeApi @unchecked =>
childTree.structuralHashCode(context)
case childArray: Array[_] =>
arrayHashCode(childArray, context)
Expand Down Expand Up @@ -74,9 +76,9 @@ trait Trees extends Expressions {

private def isSameChild(left: Any, right: Any, map: StructuralComparisonContext): Boolean = {
left match {
case left: TreeApi =>
case left: TreeApi @unchecked =>
right match {
case right: TreeApi =>
case right: TreeApi @unchecked =>
left.isSameStructure(right, map)
case _ =>
false
Expand Down Expand Up @@ -278,6 +280,7 @@ object Trees {

}

@(silent @companionObject)
final case class FloatParameter(id: Any) extends TreeApi with Parameter { thisParameter =>
type TermIn[C <: Category] = C#FloatTerm
def isSameStructure(that: TreeApi, map: StructuralComparisonContext): Boolean = {
Expand Down Expand Up @@ -316,6 +319,7 @@ object Trees {

}

@(silent @companionObject)
final case class FloatLiteral(value: Float) extends FloatOperatorApi {

def alphaConversion(context: AlphaConversionContext): TreeApi = this
Expand All @@ -327,6 +331,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class Plus(operand0: FloatTree, operand1: FloatTree) extends FloatOperatorApi {

def export(foreignCategory: Category, context: ExportContext): foreignCategory.FloatTerm = {
Expand All @@ -343,6 +348,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class Minus(operand0: FloatTree, operand1: FloatTree) extends FloatOperatorApi {
def export(foreignCategory: Category, context: ExportContext): foreignCategory.FloatTerm = {
context.asScala
Expand All @@ -358,6 +364,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class Times(operand0: FloatTree, operand1: FloatTree) extends FloatOperatorApi {
def export(foreignCategory: Category, context: ExportContext): foreignCategory.FloatTerm = {
context.asScala
Expand All @@ -373,6 +380,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class Div(operand0: FloatTree, operand1: FloatTree) extends FloatOperatorApi {
def export(foreignCategory: Category, context: ExportContext): foreignCategory.FloatTerm = {
context.asScala
Expand All @@ -388,6 +396,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class Percent(operand0: FloatTree, operand1: FloatTree) extends FloatOperatorApi {
def export(foreignCategory: Category, context: ExportContext): foreignCategory.FloatTerm = {
context.asScala
Expand All @@ -403,6 +412,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class UnaryMinus(operand: FloatTree) extends FloatOperatorApi {
def export(foreignCategory: Category, context: ExportContext): foreignCategory.FloatTerm = {
context.asScala
Expand All @@ -416,6 +426,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class UnaryPlus(operand: FloatTree) extends FloatOperatorApi {
def export(foreignCategory: Category, context: ExportContext): foreignCategory.FloatTerm = {
context.asScala
Expand Down Expand Up @@ -465,6 +476,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class Extract[LocalElement <: ValueTerm](array: ArrayTree[LocalElement]) extends TreeApi with Operator {
def export(foreignCategory: Category, map: ExportContext): TermIn[foreignCategory.type] = {
map.asScala
Expand All @@ -479,6 +491,7 @@ object Trees {
}
}

@(silent @companionObject)
final case class Transform[LocalElement <: ValueTerm](array: ArrayTree[LocalElement], matrix: MatrixData)
extends TreeApi
with Operator {
Expand Down Expand Up @@ -531,6 +544,7 @@ object Trees {

type ArrayTerm <: (Term with Any) with ArrayTermApi

@(silent @companionObject)
final case class Fill[LocalElement <: ValueTerm](element: TreeApi {
type TermIn[C <: Category] = LocalElement#TermIn[C]
}) extends TreeApi
Expand Down Expand Up @@ -583,6 +597,7 @@ object Trees {

type ValueTerm <: (Term with Any) with ValueTermApi

@(silent @companionObject)
final case class ArrayParameter[Padding, ElementType <: ValueType { type JvmValue = Padding }](
id: Any,
elementType: ElementType,
Expand Down