JuliaDiff / JuliaDiff/Diffractor.jl
Control flow not supported in higher order reverse mode AD
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 453
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
julia> using Diffractor: var"'"
julia> (x->x*x*x*x)''(1.0)
stmt = :(goto %3 if not %7)
stmt = :(goto %3 if not %7)
stmt = :(goto %3 if not %7)
stmt = :(goto %3 if not %7)
stmt = :(goto %3 if not %7)
ERROR:
Stacktrace:
[1] error()
@ Base ./error.jl:42
[2] transform!(ci::Core.CodeInfo, meth::Method, nargs::Int64, sparams::Core.SimpleVector, N::Int64)
@ Diffractor ~/.julia/packages/Diffractor/A8Ou2/src/stage1/recurse.jl:709
[3] perform_optic_transform(ff::Type{Diffractor.∂⃖recurse{2}}, args::Any)
@ Diffractor ~/.julia/packages/Diffractor/A8Ou2/src/stage1/generated.jl:25
[4] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
@ Core ./boot.jl:580
[5] (::Diffractor.∂⃖{2})(::typeof(Base.afoldl), ::Function, ::Vararg{Any})
@ Diffractor ~/.julia/packages/Diffractor/A8Ou2/src/stage1/generated.jl:218
[6] (::Diffractor.∂⃖{2})(::typeof(Core._apply_iterate), ::Function, ::Function, ::Tuple{typeof(*), Float64}, ::Vararg{Union{Tuple, NamedTuple}})
@ Diffractor ~/.julia/packages/Diffractor/A8Ou2/src/stage1/generated.jl:364
[7] *
@ ./operators.jl:655 [inlined]
[8] ∂⃖
@ ~/.julia/packages/Diffractor/A8Ou2/src/extra_rules.jl:85 [inlined]
[9] #1
@ ./REPL[2]:1 [inlined]
[10] ∂⃖
@ ~/.julia/packages/Diffractor/A8Ou2/src/stage1/generated.jl:218 [inlined]
[11] ∂⃖
@ ~/.julia/packages/Diffractor/A8Ou2/src/stage1/generated.jl:61 [inlined]
[12] PrimeDerivativeBack
@ ~/.julia/packages/Diffractor/A8Ou2/src/interface.jl:157 [inlined]
[13] (::Diffractor.∂⃖recurse{1})(::Diffractor.PrimeDerivativeBack{1, var"#1#2"}, ::Float64)
@ Diffractor ~/.julia/packages/Diffractor/A8Ou2/src/stage1/generated.jl:0
[14] ∂⃖
@ ~/.julia/packages/Diffractor/A8Ou2/src/stage1/generated.jl:211 [inlined]
[15] (::Diffractor.PrimeDerivativeBack{2, var"#1#2"})(x::Float64)
@ Diffractor ~/.julia/packages/Diffractor/A8Ou2/src/interface.jl:157
[16] top-level scope
@ REPL[2]:1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the higher-order reverse-mode example and read the transform! entry point in src/stage1/recurse.jl around line 709, along with the generated.jl and interface.jl frames shown in the stack trace. Done means the reported control-flow case no longer fails during transformation and produces the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100