Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-schultz committed Jan 16, 2024
1 parent efd6269 commit f6fe074
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
30 changes: 3 additions & 27 deletions hail/src/main/scala/is/hail/expr/ir/Emit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -839,15 +839,12 @@ class Emit[C](

emitI(cond).consume(cb, {}, m => cb.if_(m.asBoolean.value, emitVoid(cnsq), emitVoid(altr)))

case x @ Let(bindings, body) =>
val (voidBindings, valueBindings) = bindings.partition(_._2.typ == TVoid)
val voidOps = voidBindings.map(_._2) :+ body

case Let(bindings, body) =>
def go(env: EmitEnv): IndexedSeq[(String, IR)] => Unit = {
case (name, value) +: rest =>
if (value.typ == TVoid) {
assert(false)
emitVoid(value, env = env)
go(env)(rest)
} else {
val xVal =
if (value.typ.isInstanceOf[TStream]) emitStream(value, region, env = env)
Expand All @@ -858,31 +855,10 @@ class Emit[C](
}
}
case Seq() =>
if (
!ctx.inLoopCriticalPath.contains(x) && voidOps.forall(x =>
!ctx.inLoopCriticalPath.contains(x)
)
) {
voidOps.grouped(16).zipWithIndex.foreach { case (group, idx) =>
val mb = cb.emb.genEmitMethod(
s"begin_group_$idx",
FastSeq[ParamType](classInfo[Region]),
UnitInfo,
)
mb.voidWithBuilder { cb =>
group.foreach(x =>
emitVoid(x, cb, mb.getCodeParam[Region](1), env, container, loopEnv)
)
}
cb.invokeVoid(mb, region)
}
} else
voidOps.foreach(x => emitVoid(x))
emitVoid(body, env = env)
}

go(env)(valueBindings)
// go(env)(bindings)
go(env)(bindings)

case StreamFor(a, valueName, body) =>
emitStream(a, region).toI(cb).consume(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ object LowerOrInterpretNonCompilable {
case Some(failReason) =>
log.info(s"LowerOrInterpretNonCompilable: cannot efficiently lower query: $failReason")
log.info(s"interpreting non-compilable result: ${value.getClass.getSimpleName}")
println(s"interpreting subtree:\n${Pretty.sexprStyle(value)}\n============\n")
val v = Interpret.alreadyLowered(ctx, value)
if (value.typ == TVoid) {
Begin(FastSeq())
} else Literal.coerce(value.typ, v)
case None =>
log.info(s"LowerOrInterpretNonCompilable: whole stage code generation is a go!")
log.info(s"lowering result: ${value.getClass.getSimpleName}")
println(s"lowering and executing subtree:\n${Pretty.sexprStyle(ir)}\n============\n")
val fullyLowered = LowerToDistributedArrayPass(DArrayLowering.All).transform(ctx, value)
.asInstanceOf[IR]
log.info(s"compiling and evaluating result: ${value.getClass.getSimpleName}")
Expand Down Expand Up @@ -63,12 +61,6 @@ object LowerOrInterpretNonCompilable {
}
}

println(s"LowerOrInterpretNonCompilable:\n${Pretty.sexprStyle(ir)}\n============\n")

val res = rewrite(ir.noSharing(ctx), mutable.HashMap.empty)

println("LowerOrInterpretNonCompilable done")

res
rewrite(ir.noSharing(ctx), mutable.HashMap.empty)
}
}

0 comments on commit f6fe074

Please sign in to comment.