Skip to content

Julia 1.11 Unsupported #1358

@gdalle

Description

@gdalle

I wanted to use split reverse mode in order to compute pullbacks with array outputs. The only doc I found is

https://enzymead.github.io/Enzyme.jl/stable/api/#EnzymeCore.autodiff_thunk-Union{Tuple{RABI},%20Tuple{ModifiedBetweenT},%20Tuple{Width},%20Tuple{ReturnShadow},%20Tuple{ReturnPrimal},%20Tuple{A},%20Tuple{FA},%20Tuple{EnzymeCore.ReverseModeSplit{ReturnPrimal,%20ReturnShadow,%20Width,%20ModifiedBetweenT,%20RABI},%20Type{FA},%20Type{A},%20Vararg{Any}}}%20where%20{FA%3C:Annotation,%20A%3C:Annotation,%20ReturnPrimal,%20ReturnShadow,%20Width,%20ModifiedBetweenT,%20RABI%3C:EnzymeCore.ABI}

so I tried it but it fails on Julia 1.11:

julia> using Enzyme

julia> A = [2.2]; ∂A = zero(A)
1-element Vector{Float64}:
 0.0

julia> v = 3.3
3.3

julia> function f(A, v)
           res = A[1] * v
           A[1] = 0
           res
       end
f (generic function with 1 method)

julia> forward, reverse = autodiff_thunk(ReverseSplitWithPrimal, Const{typeof(f)}, Active, Duplicated{typeof(A)}, Active{typeof(v)})
ERROR: MethodError: no method matching get_inference_world(::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
The function `get_inference_world` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  get_inference_world(::REPL.REPLCompletions.REPLInterpreter)
   @ REPL ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPLCompletions.jl:550
  get_inference_world(::Core.Compiler.NativeInterpreter)
   @ Core compiler/types.jl:402

Stacktrace:
       internal @ Core.Compiler, Enzyme.Compiler, GPUCompiler, Core, Unknown
 [11] autodiff_thunk(::EnzymeCore.ReverseModeSplit{true, true, 0, true, FFIABI}, ::Type{Const{typeof(f)}}, ::Type{Active}, ::Type, ::Vararg{Type})
    @ Enzyme ~/.julia/packages/Enzyme/l4FS0/src/Enzyme.jl:524
Use `err` to retrieve the full stack trace.

julia> err
1-element ExceptionStack:
MethodError: no method matching get_inference_world(::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
The function `get_inference_world` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  get_inference_world(::REPL.REPLCompletions.REPLInterpreter)
   @ REPL ~/.julia/juliaup/julia-1.11.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPLCompletions.jl:550
  get_inference_world(::Core.Compiler.NativeInterpreter)
   @ Core compiler/types.jl:402

Stacktrace:
  [1] Core.Compiler.InferenceState(result::Core.Compiler.InferenceResult, cache_mode::UInt8, interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
    @ Core.Compiler ./compiler/inferencestate.jl:493
  [2] Core.Compiler.InferenceState(result::Core.Compiler.InferenceResult, cache_mode::Symbol, interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
    @ Core.Compiler ./compiler/inferencestate.jl:499
  [3] typeinf(interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter, result::Core.Compiler.InferenceResult, cache_mode::Symbol)
    @ Core.Compiler ./compiler/typeinfer.jl:9
  [4] typeinf_type(interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter, mi::Core.MethodInstance)
    @ Core.Compiler ./compiler/typeinfer.jl:1072
  [5] typeinf_type(interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter, method::Method, atype::Any, sparams::Core.SimpleVector)
    @ Core.Compiler ./compiler/typeinfer.jl:1059
  [6] (::Enzyme.Compiler.var"#532#533"{})(ctx::LLVM.Context)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/l4FS0/src/compiler.jl:5495
  [7] JuliaContext(f::Enzyme.Compiler.var"#532#533"{})
    @ GPUCompiler ~/.julia/packages/GPUCompiler/U36Ed/src/driver.jl:47
  [8] #s1883#531
    @ ~/.julia/packages/Enzyme/l4FS0/src/compiler.jl:5482 [inlined]
  [9] 
    @ Enzyme.Compiler ./none:0
 [10] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
    @ Core ./boot.jl:705
 [11] autodiff_thunk(::EnzymeCore.ReverseModeSplit{true, true, 0, true, FFIABI}, ::Type{Const{typeof(f)}}, ::Type{Active}, ::Type, ::Vararg{Type})
    @ Enzyme ~/.julia/packages/Enzyme/l4FS0/src/Enzyme.jl:524
 [12] top-level scope
    @ REPL[23]:1
Some type information was truncated. Use `show(err)` to see complete types.

(docs) pkg> st
Status `~/Work/GitHub/Julia/DifferentiationInterface.jl/docs/Project.toml`
  [47edcb42] ADTypes v0.2.7
  [d360d2e6] ChainRulesCore v1.23.0
  [0ca39b1e] Chairmarks v1.2.0
  [a93c6f00] DataFrames v1.6.1
  [163ba53b] DiffResults v1.1.0
  [a0c0ee7d] DifferentiationInterface v0.1.0 `..`
  [9f5e2b26] Diffractor v0.2.5
  [e30172f5] Documenter v1.3.0
  [a078cd44] DocumenterMermaid v0.1.1
  [7da242da] Enzyme v0.11.20
  [eb9bf01b] FastDifferentiation v0.3.6
  [1a297f60] FillArrays v1.9.3
  [6a86dc24] FiniteDiff v2.23.0
  [26cc04aa] FiniteDifferences v0.12.31
  [f6369f11] ForwardDiff v0.10.36
  [c3a54625] JET v0.8.29
  [98d1487c] PolyesterForwardDiff v0.1.1
  [37e2e3b7] ReverseDiff v1.15.1
  [9f7883ad] Tracker v0.2.33
  [e88e6eb3] Zygote v0.6.69
  [d6f4376e] Markdown v1.11.0
  [9a3f8284] Random v1.11.0
  [8dfed614] Test v1.11.0

julia> versioninfo()
Julia Version 1.11.0-alpha2
Commit 9dfd28ab751 (2024-03-18 20:35 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions