gavgaurav / nativelibs4java

Automatically exported from code.google.com/p/nativelibs4java
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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)
}
}}}

Original issue reported on code.google.com by olivier.chafik@gmail.com on 15 Jul 2011 at 12:41

GoogleCodeExporter commented 9 years ago
Hi,
This issue moved to Github :
https://github.com/ochafik/nativelibs4java/issues/80

Thanks for not updating this page anymore and adding further comments on Github.
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 1 Sep 2011 at 7:32