Skip to content

Commit 085e051

Browse files
committed
Add better error message for control flow in higher-order reverse
1 parent a7b3f75 commit 085e051

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/stage1/generated.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ function perform_optic_transform(@nospecialize(ff::Type{∂⃖recurse{N}}), @nos
2222
ci′ = copy(ci)
2323
ci′.edges = MethodInstance[mi]
2424

25-
transform!(ci′, mi.def, length(args) - 1, match.sparams, N)
25+
r = transform!(ci′, mi.def, length(args) - 1, match.sparams, N)
26+
if isa(r, Expr)
27+
return r
28+
end
2629

2730
ci′.ssavaluetypes = length(ci′.code)
2831
ci′.method_for_inference_limit_heuristics = match.method

src/stage1/recurse.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ function transform!(ci, meth, nargs, sparams, N)
704704
error()
705705
elseif isa(stmt, GlobalRef)
706706
fwds[i] = ZeroTangent()
707+
elseif isa(stmt, Union{GotoNode, GotoIfNot})
708+
return :(error("Control flow support not fully implemented yet for higher-order reverse mode (TODO)"))
707709
elseif !isa(stmt, Expr)
708710
@show stmt
709711
error()

0 commit comments

Comments
 (0)