diff --git a/src/main/scala/com/nec/spark/agile/core/CodeLines.scala b/src/main/scala/com/nec/spark/agile/core/CodeLines.scala index 7e5c0df29..bfea7f626 100644 --- a/src/main/scala/com/nec/spark/agile/core/CodeLines.scala +++ b/src/main/scala/com/nec/spark/agile/core/CodeLines.scala @@ -1,8 +1,9 @@ package com.nec.spark.agile.core -import scala.annotation.tailrec import sourcecode.{FullName, Line} +import scala.annotation.tailrec + object CodeLines { def parse(source: String): CodeLines = { CodeLines.from(source.split("\\r?\\n").toList) @@ -29,8 +30,9 @@ object CodeLines { CodeLines.from(s"if ($condition) { ", sub1.indented, "} else {", sub2.indented, "}") } - def forLoop(counter: String, until: String)(sub: => CodeLines): CodeLines = { + def forLoop(counter: String, until: String, vector: Boolean = false)(sub: => CodeLines): CodeLines = { CodeLines.from( + if (vector) "#pragma _NEC vector" else "", s"for (auto $counter = 0; $counter < $until; $counter++) {", sub.indented, "}" diff --git a/src/main/scala/com/nec/spark/agile/projection/ProjectionFunction.scala b/src/main/scala/com/nec/spark/agile/projection/ProjectionFunction.scala index 750228e28..82abc3415 100644 --- a/src/main/scala/com/nec/spark/agile/projection/ProjectionFunction.scala +++ b/src/main/scala/com/nec/spark/agile/projection/ProjectionFunction.scala @@ -1,10 +1,9 @@ package com.nec.spark.agile.projection -import com.nec.spark.agile.core._ import com.nec.spark.agile.CFunctionGeneration._ import com.nec.spark.agile.StringProducer.FrovedisStringProducer -import com.nec.spark.agile.core._ import com.nec.spark.agile.core.CFunction2.CFunctionArgument +import com.nec.spark.agile.core._ final case class ProjectionFunction(name: String, data: Seq[CVector], @@ -59,10 +58,24 @@ final case class ProjectionFunction(name: String, "#pragma _NEC vector", CodeLines.forLoop("i", s"${inputs.head.name}->count") { List( - s"bool validity = ${cexpr.isNotNullCode.getOrElse("1")};", - s"$outname->data[i] = ${cexpr.cCode};", - s"$outname->set_validity(i, validity);" + s"${outname}->data[i] = ${cexpr.cCode};", + ) + }, + if (cexpr.isNotNullCode.isEmpty) { + CodeLines.from( + s"size_t vcount = ceil(${inputs.head.name}->count / 64.0);", + CodeLines.forLoop("i", s"vcount", vector = true) { + List( + s"${outname}->validityBuffer[i] = 0xffffffff;" + ) + } ) + } else { + CodeLines.forLoop("i", s"${inputs.head.name}->count", vector = true) { + List( + s"$outname->set_validity(i, ${cexpr.isNotNullCode.getOrElse("1")});" + ) + } } ) } diff --git a/tests/tpchbench/dbgen/dbgen b/tests/tpchbench/dbgen/dbgen deleted file mode 100755 index 4a7135679..000000000 Binary files a/tests/tpchbench/dbgen/dbgen and /dev/null differ diff --git a/tests/tpchbench/dbgen/qgen b/tests/tpchbench/dbgen/qgen deleted file mode 100755 index cc6f80112..000000000 Binary files a/tests/tpchbench/dbgen/qgen and /dev/null differ diff --git a/tests/tpchbench/run_ve.sh b/tests/tpchbench/run_ve.sh index 9a7fe848e..998ea231e 100755 --- a/tests/tpchbench/run_ve.sh +++ b/tests/tpchbench/run_ve.sh @@ -17,7 +17,7 @@ time $SPARK_HOME/bin/spark-submit \ --conf spark.executorEnv.VE_OMP_NUM_THREADS=1 \ --conf spark.com.nec.spark.aggregate-on-ve=true \ --conf spark.com.nec.spark.sort-on-ve=true \ - --conf spark.com.nec.spark.project-on-ve=false \ + --conf spark.com.nec.spark.project-on-ve=true \ --conf spark.com.nec.spark.filter-on-ve=true \ --conf spark.com.nec.spark.exchange-on-ve=true \ --conf spark.com.nec.spark.join-on-ve=false \ @@ -31,3 +31,7 @@ time $SPARK_HOME/bin/spark-submit \ --conf spark.shuffle.partitions=8 \ target/scala-2.12/tpchbench-assembly-0.0.1.jar \ $* + +# --conf spark.executorEnv.VE_PROGINF=YES \ +# --conf spark.executorEnv.VE_ACC_IO=1 \ +# --conf spark.executorEnv.VEO_LOG_DEBUG=1 \