Skip to content

ScalaCLPlugin : tuple assignment in deconstructive assignment appears to be broken #12

Description

@ochafik

From @ochafik on September 1, 2011 18:35

The pair @ alias is not properly handled anymore :
{{{
// mvn compile scala:run -DmainClass=scalacl.plugin.Compile "-DaddArgs=Test.scala|-cp|../ScalaCL/target/scalacl-0.3-SNAPSHOT-shaded.jar"
object Test {
import scalacl._
import scala.math._
implicit val context = Context.best
// prefer CPUs ? Context.best(CPU)
val array = (100 until 300).cl

val r2 =
array.map(v => {

def someFun(x: Int) = // becomes a top-level function inside the OpenCL kernel
  exp(x / 1000).toInt

val pair @ (init, foo) = { // tuples will be flattened in the OpenCL kernel
   val d = v - 10     // unless they match an OpenCL tuple type like int2
   (d * d, 1 / d)
}
var sum = init + 1.0
for (i <- 0 until 10; if (i % 2) != 0) {
   sum += cos(v) * i + someFun(pair._2 - foo)
}
(sum, foo)

})
println(r2)
}
}}}

Google Code Info:
Issue #: 78
Author: olivier.chafik
Created On: 2011-07-15T00:41:35.000Z
Closed On:

Copied from original issue: nativelibs4java/nativelibs4java#80

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions