Skip to content

Commit

Permalink
investigate issue #222
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastacyclop committed Feb 17, 2022
1 parent cfa3a1b commit caee15b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/apps/mm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ object mm {
mapWorkGroup(0)(fun(p3 =>
zip(p2)(p3) |> // O'.(v8.v5.f x v8.v7.f)
// FIXME: there seems to be a bug in AdjustArraySizesForAllocations
// oclReduceSeq(AddressSpace.Private)(fun((p13, p14) =>
oclReduceSeq(AddressSpace.Local)(fun((p13, p14) =>
oclReduceSeq(AddressSpace.Private)(fun((p13, p14) =>
// oclReduceSeq(AddressSpace.Local)(fun((p13, p14) =>
// (v5/^v4).(v7/^v3).v4.v3.f x (v8.v5.f x v8.v7.f)
let (toLocal(makePair(
p14._1 |> join |> split(v6) |> // ((v8 x v5) /^ v6).v6.f
Expand Down
14 changes: 9 additions & 5 deletions src/main/scala/rise/autotune/execution.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ object execution {

val codegenStart = System.currentTimeMillis()

val codegenResult = try {
val codegenResult = /* try */ {

// run code-generation with timeout
val codgenResult = autoTuningUtils.runWithTimeout(
timeouts.codegenerationTimeout)(gen.opencl.hosted("fun").fromExpr(expression))
val codgenResult: Option[gen.opencl.HostedModule] = /*autoTuningUtils.runWithTimeout(
timeouts.codegenerationTimeout)(*/Some(gen.opencl.hosted("fun").fromExpr(expression))//)

// check if timeout was triggered
codgenResult match {
Expand All @@ -58,10 +58,10 @@ object execution {
)
)
}
} catch {
} /* catch {
case e:Throwable =>
Left(AutoTuningError(CODE_GENERATION_ERROR, Some(e.getCause.getMessage)))
}
} */

val codegenTime = TimeSpan.inMilliseconds((System.currentTimeMillis() - codegenStart).toDouble)

Expand Down Expand Up @@ -92,6 +92,8 @@ object execution {

assert(executionIterations > 0)

println(program)

// execute program
val result = executeWithRuntime(
program,
Expand All @@ -103,6 +105,8 @@ object execution {
execution
)

println(result)

ExecutionResult(
runtime = result._1,
codegenTime = Some(codegenTime),
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/shine/C/Compilation/CodeGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class CodeGenerator(val decls: CodeGenerator.Declarations,
visitAndGenerateNat(phrase match {
case Phrases.IfThenElse(cond, thenP, elseP) =>
cond |> exp(env, Nil, cond =>
C.AST.IfThenElse(cond, cmd(env)(thenP), Some(cmd(env)(elseP))))
C.AST.IfThenElse(cond, C.AST.Block(scala.Seq(cmd(env)(thenP))),
Some(C.AST.Block(scala.Seq(cmd(env)(elseP))))))

case i: Identifier[CommType] => env.commEnv(i)

Expand Down
13 changes: 11 additions & 2 deletions src/main/scala/shine/DPIA/Compilation/Passes/UnrollLoops.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,18 @@ object UnrollLoops {
shine.DPIA.DSL.comment(s"unrolling loop of $numIter"))({
case (prev, i) =>
val index = init + Cst(i * incr)
assert(isSmaller(index, n).contains(true)) //TODO add if-guards otherwise.
//TODO store result of init in temporary variable
Seq(prev, genBody(index))
val current = if (isSmaller(index, n).contains(true)) {
genBody(index)
} else {
shine.DPIA.Phrases.IfThenElse(
shine.DPIA.Phrases.BinOp(shine.DPIA.Phrases.Operators.Binary.LT,
shine.DPIA.Phrases.Natural(index),
shine.DPIA.Phrases.Natural(n)),
genBody(index),
shine.DPIA.primitives.imperative.Skip())
}
Seq(prev, current)
})

tmp
Expand Down

0 comments on commit caee15b

Please sign in to comment.